summaryrefslogtreecommitdiffstats
path: root/Python/executor_cases.c.h
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2025-05-05 16:46:56 (GMT)
committerGitHub <noreply@github.com>2025-05-05 16:46:56 (GMT)
commit082dbf77884264a8470b1ea132cc458d0b5bf08a (patch)
tree3d441ff384d05c127bc67c3a9e4a8df8c8a2f6ad /Python/executor_cases.c.h
parent07f416a3f063db6b91b8b99ff61a51b64b0503f1 (diff)
downloadcpython-082dbf77884264a8470b1ea132cc458d0b5bf08a.zip
cpython-082dbf77884264a8470b1ea132cc458d0b5bf08a.tar.gz
cpython-082dbf77884264a8470b1ea132cc458d0b5bf08a.tar.bz2
gh-133395: add option for extension modules to specialize BINARY_OP/SUBSCR, apply to arrays (#133396)
Diffstat (limited to 'Python/executor_cases.c.h')
-rw-r--r--Python/executor_cases.c.h24
1 files changed, 4 insertions, 20 deletions
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h
index 7f3c314..662e050 100644
--- a/Python/executor_cases.c.h
+++ b/Python/executor_cases.c.h
@@ -1147,26 +1147,7 @@
break;
}
- case _GUARD_BINARY_OP_EXTEND: {
- _PyStackRef right;
- _PyStackRef left;
- right = stack_pointer[-1];
- left = stack_pointer[-2];
- PyObject *descr = (PyObject *)CURRENT_OPERAND0();
- PyObject *left_o = PyStackRef_AsPyObjectBorrow(left);
- PyObject *right_o = PyStackRef_AsPyObjectBorrow(right);
- _PyBinaryOpSpecializationDescr *d = (_PyBinaryOpSpecializationDescr*)descr;
- assert(INLINE_CACHE_ENTRIES_BINARY_OP == 5);
- assert(d && d->guard);
- _PyFrame_SetStackPointer(frame, stack_pointer);
- int res = d->guard(left_o, right_o);
- stack_pointer = _PyFrame_GetStackPointer(frame);
- if (!res) {
- UOP_STAT_INC(uopcode, miss);
- JUMP_TO_JUMP_TARGET();
- }
- break;
- }
+ /* _GUARD_BINARY_OP_EXTEND is not a viable micro-op for tier 2 because it uses the 'this_instr' variable */
case _BINARY_OP_EXTEND: {
_PyStackRef right;
@@ -1193,6 +1174,9 @@
stack_pointer = _PyFrame_GetStackPointer(frame);
stack_pointer += -2;
assert(WITHIN_STACK_BOUNDS());
+ if (res_o == NULL) {
+ JUMP_TO_ERROR();
+ }
res = PyStackRef_FromPyObjectSteal(res_o);
stack_pointer[0] = res;
stack_pointer += 1;