GH-131798: Split up and optimize CALL_TUPLE_1 in the JIT (GH-132851)

This commit is contained in:
Tomas R. 2025-04-25 00:55:03 +02:00 committed by GitHub
parent 15ff60aff0
commit 08e3389e8c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 277 additions and 161 deletions

View file

@ -1918,9 +1918,26 @@
break;
}
case _GUARD_CALLABLE_TUPLE_1: {
JitOptSymbol *callable;
callable = stack_pointer[-3];
if (sym_get_const(ctx, callable) == (PyObject *)&PyTuple_Type) {
REPLACE_OP(this_instr, _NOP, 0, 0);
}
sym_set_const(callable, (PyObject *)&PyTuple_Type);
break;
}
case _CALL_TUPLE_1: {
JitOptSymbol *arg;
JitOptSymbol *res;
res = sym_new_not_null(ctx);
arg = stack_pointer[-1];
if (sym_matches_type(arg, &PyTuple_Type)) {
res = arg;
}
else {
res = sym_new_type(ctx, &PyTuple_Type);
}
stack_pointer[-3] = res;
stack_pointer += -2;
assert(WITHIN_STACK_BOUNDS());