aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/optimizer_cases.c.h
diff options
context:
space:
mode:
authorTomas R. <tomas.roun8@gmail.com>2025-05-08 23:26:30 +0200
committerGitHub <noreply@github.com>2025-05-08 14:26:30 -0700
commitc492ac72525ea5887082ee991b45cc237cd02a40 (patch)
tree852add3d5172f601aa96d67d83466b882b78015d /Python/optimizer_cases.c.h
parentb2fabce6abb24b2f2c3afae0edc5eb53729fc624 (diff)
downloadcpython-c492ac72525ea5887082ee991b45cc237cd02a40.tar.gz
cpython-c492ac72525ea5887082ee991b45cc237cd02a40.zip
GH-131798: Split up and optimize CALL_ISINSTANCE (GH-133339)
Diffstat (limited to 'Python/optimizer_cases.c.h')
-rw-r--r--Python/optimizer_cases.c.h25
1 files changed, 23 insertions, 2 deletions
diff --git a/Python/optimizer_cases.c.h b/Python/optimizer_cases.c.h
index 4c49d106fa8..deb912662e4 100644
--- a/Python/optimizer_cases.c.h
+++ b/Python/optimizer_cases.c.h
@@ -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;
}