summaryrefslogtreecommitdiffstats
path: root/Python/generated_cases.c.h
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2025-04-29 17:00:35 (GMT)
committerGitHub <noreply@github.com>2025-04-29 17:00:35 (GMT)
commitccf1b0b1c18e6d00fb919bce107f2793bab0a471 (patch)
tree94c1bd2fd030defe28291ae62acbfcb1c2cb4b2b /Python/generated_cases.c.h
parentcaee16f05229de5bc5ed2743c531f1696641888a (diff)
downloadcpython-ccf1b0b1c18e6d00fb919bce107f2793bab0a471.zip
cpython-ccf1b0b1c18e6d00fb919bce107f2793bab0a471.tar.gz
cpython-ccf1b0b1c18e6d00fb919bce107f2793bab0a471.tar.bz2
GH-132508: Use tagged integers on the evaluation stack for the last instruction offset (GH-132545)
Diffstat (limited to 'Python/generated_cases.c.h')
-rw-r--r--Python/generated_cases.c.h24
1 files changed, 4 insertions, 20 deletions
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h
index fbd1f23..7d3e6c7 100644
--- a/Python/generated_cases.c.h
+++ b/Python/generated_cases.c.h
@@ -10191,20 +10191,7 @@
PyObject *exc = PyStackRef_AsPyObjectSteal(exc_st);
assert(oparg >= 0 && oparg <= 2);
if (oparg) {
- PyObject *lasti = PyStackRef_AsPyObjectBorrow(values[0]);
- if (PyLong_Check(lasti)) {
- frame->instr_ptr = _PyFrame_GetBytecode(frame) + PyLong_AsLong(lasti);
- assert(!_PyErr_Occurred(tstate));
- }
- else {
- stack_pointer += -1;
- assert(WITHIN_STACK_BOUNDS());
- _PyFrame_SetStackPointer(frame, stack_pointer);
- _PyErr_SetString(tstate, PyExc_SystemError, "lasti is not an int");
- Py_DECREF(exc);
- stack_pointer = _PyFrame_GetStackPointer(frame);
- JUMP_TO_LABEL(error);
- }
+ frame->instr_ptr = _PyFrame_GetBytecode(frame) + PyStackRef_UntagInt(values[0]);
}
assert(exc && PyExceptionInstance_Check(exc));
stack_pointer += -1;
@@ -12059,7 +12046,7 @@
if (tb == NULL) {
tb = Py_None;
}
- assert(PyStackRef_LongCheck(lasti));
+ assert(PyStackRef_IsTaggedInt(lasti));
(void)lasti;
PyObject *stack[5] = {NULL, PyStackRef_AsPyObjectBorrow(exit_self), exc, val_o, tb};
int has_self = !PyStackRef_IsNull(exit_self);
@@ -12231,11 +12218,8 @@ JUMP_TO_LABEL(error);
}
if (lasti) {
int frame_lasti = _PyInterpreterFrame_LASTI(frame);
- PyObject *lasti = PyLong_FromLong(frame_lasti);
- if (lasti == NULL) {
- JUMP_TO_LABEL(exception_unwind);
- }
- _PyFrame_StackPush(frame, PyStackRef_FromPyObjectSteal(lasti));
+ _PyStackRef lasti = PyStackRef_TagInt(frame_lasti);
+ _PyFrame_StackPush(frame, lasti);
}
PyObject *exc = _PyErr_GetRaisedException(tstate);
_PyFrame_StackPush(frame, PyStackRef_FromPyObjectSteal(exc));