aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/optimizer_bytecodes.c
diff options
context:
space:
mode:
authorTomas R. <tomas.roun8@gmail.com>2025-05-19 18:00:53 -0400
committerGitHub <noreply@github.com>2025-05-19 18:00:53 -0400
commita7f317d7300235d9efff5a0350b1bae14720d42f (patch)
treee97a63958481969f48adec42e3ce22a48b4cb388 /Python/optimizer_bytecodes.c
parent1fbb0603a87669562e964cade336b3384778fbe0 (diff)
downloadcpython-a7f317d7300235d9efff5a0350b1bae14720d42f.tar.gz
cpython-a7f317d7300235d9efff5a0350b1bae14720d42f.zip
GH-131798: Add _POP_CALL_TWO_LOAD_CONST_INLINE_BORROW (GH-134268)
Diffstat (limited to 'Python/optimizer_bytecodes.c')
-rw-r--r--Python/optimizer_bytecodes.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/Python/optimizer_bytecodes.c b/Python/optimizer_bytecodes.c
index 708b436f6e4..9811e9f348c 100644
--- a/Python/optimizer_bytecodes.c
+++ b/Python/optimizer_bytecodes.c
@@ -550,6 +550,10 @@ dummy_func(void) {
value = sym_new_const(ctx, ptr);
}
+ op(_POP_CALL_TWO_LOAD_CONST_INLINE_BORROW, (ptr/4, unused, unused, unused, unused -- value)) {
+ value = sym_new_const(ctx, ptr);
+ }
+
op(_COPY, (bottom, unused[oparg-1] -- bottom, unused[oparg-1], top)) {
assert(oparg > 0);
top = bottom;
@@ -901,12 +905,12 @@ dummy_func(void) {
// known types, meaning we can deduce either True or False
// The below check is equivalent to PyObject_TypeCheck(inst, cls)
+ PyObject *out = Py_False;
if (inst_type == cls_o || PyType_IsSubtype(inst_type, cls_o)) {
- sym_set_const(res, Py_True);
- }
- else {
- sym_set_const(res, Py_False);
+ out = Py_True;
}
+ sym_set_const(res, out);
+ REPLACE_OP(this_instr, _POP_CALL_TWO_LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)out);
}
}