mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
GH-131798: Split up and optimize CALL_TUPLE_1 in the JIT (GH-132851)
This commit is contained in:
parent
15ff60aff0
commit
08e3389e8c
10 changed files with 277 additions and 161 deletions
|
@ -967,6 +967,16 @@ dummy_func(void) {
|
|||
}
|
||||
}
|
||||
|
||||
op(_CALL_TUPLE_1, (callable, null, arg -- res)) {
|
||||
if (sym_matches_type(arg, &PyTuple_Type)) {
|
||||
// e.g. tuple((1, 2)) or tuple(foo) where foo is known to be a tuple
|
||||
res = arg;
|
||||
}
|
||||
else {
|
||||
res = sym_new_type(ctx, &PyTuple_Type);
|
||||
}
|
||||
}
|
||||
|
||||
op(_GUARD_TOS_LIST, (tos -- tos)) {
|
||||
if (sym_matches_type(tos, &PyList_Type)) {
|
||||
REPLACE_OP(this_instr, _NOP, 0, 0);
|
||||
|
@ -1031,6 +1041,13 @@ dummy_func(void) {
|
|||
sym_set_const(callable, (PyObject *)&PyType_Type);
|
||||
}
|
||||
|
||||
op(_GUARD_CALLABLE_TUPLE_1, (callable, unused, unused -- callable, unused, unused)) {
|
||||
if (sym_get_const(ctx, callable) == (PyObject *)&PyTuple_Type) {
|
||||
REPLACE_OP(this_instr, _NOP, 0, 0);
|
||||
}
|
||||
sym_set_const(callable, (PyObject *)&PyTuple_Type);
|
||||
}
|
||||
|
||||
op(_GUARD_CALLABLE_STR_1, (callable, unused, unused -- callable, unused, unused)) {
|
||||
if (sym_get_const(ctx, callable) == (PyObject *)&PyUnicode_Type) {
|
||||
REPLACE_OP(this_instr, _NOP, 0, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue