GH-131798: Split up and optimize CALL_ISINSTANCE (GH-133339)

This commit is contained in:
Tomas R. 2025-05-08 23:26:30 +02:00 committed by GitHub
parent b2fabce6ab
commit c492ac7252
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 392 additions and 301 deletions

View file

@ -1935,6 +1935,16 @@
break;
}
case _GUARD_THIRD_NULL: {
JitOptSymbol *null;
null = stack_pointer[-3];
if (sym_is_null(null)) {
REPLACE_OP(this_instr, _NOP, 0, 0);
}
sym_set_null(null);
break;
}
case _GUARD_CALLABLE_TYPE_1: {
JitOptSymbol *callable;
callable = stack_pointer[-3];
@ -2102,11 +2112,22 @@
break;
}
case _GUARD_CALLABLE_ISINSTANCE: {
JitOptSymbol *callable;
callable = stack_pointer[-4];
PyObject *isinstance = _PyInterpreterState_GET()->callable_cache.isinstance;
if (sym_get_const(ctx, callable) == isinstance) {
REPLACE_OP(this_instr, _NOP, 0, 0);
}
sym_set_const(callable, isinstance);
break;
}
case _CALL_ISINSTANCE: {
JitOptSymbol *res;
res = sym_new_not_null(ctx);
stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg;
stack_pointer[-4] = res;
stack_pointer += -3;
assert(WITHIN_STACK_BOUNDS());
break;
}