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

@ -1067,6 +1067,13 @@ dummy_func(void) {
sym_set_null(null);
}
op(_GUARD_THIRD_NULL, (null, unused, unused -- null, unused, unused)) {
if (sym_is_null(null)) {
REPLACE_OP(this_instr, _NOP, 0, 0);
}
sym_set_null(null);
}
op(_GUARD_CALLABLE_TYPE_1, (callable, unused, unused -- callable, unused, unused)) {
if (sym_get_const(ctx, callable) == (PyObject *)&PyType_Type) {
REPLACE_OP(this_instr, _NOP, 0, 0);
@ -1100,6 +1107,14 @@ dummy_func(void) {
sym_set_const(callable, len);
}
op(_GUARD_CALLABLE_ISINSTANCE, (callable, unused, unused, unused -- callable, unused, unused, unused)) {
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);
}
// END BYTECODES //
}