aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/generated_cases.c.h
diff options
context:
space:
mode:
Diffstat (limited to 'Python/generated_cases.c.h')
-rw-r--r--Python/generated_cases.c.h109
1 files changed, 80 insertions, 29 deletions
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h
index 80af8a7bcd5..f6322df566c 100644
--- a/Python/generated_cases.c.h
+++ b/Python/generated_cases.c.h
@@ -8,6 +8,7 @@
}
TARGET(RESUME) {
+ #if TIER_ONE
assert(frame == tstate->current_frame);
/* Possibly combine this with eval breaker */
if (_PyFrame_GetCode(frame)->_co_instrumentation_version != tstate->interp->monitoring_version) {
@@ -15,7 +16,9 @@
if (err) goto error;
next_instr--;
}
- else if (oparg < 2) {
+ else
+ #endif
+ if (oparg < 2) {
CHECK_EVAL_BREAKER();
}
DISPATCH();
@@ -970,20 +973,40 @@
TARGET(RETURN_VALUE) {
PyObject *retval;
+ // SAVE_CURRENT_IP
+ {
+ #if TIER_ONE
+ frame->prev_instr = next_instr - 1;
+ #endif
+ #if TIER_TWO
+ // Relies on a preceding SAVE_IP
+ frame->prev_instr--;
+ #endif
+ }
+ // _POP_FRAME
retval = stack_pointer[-1];
STACK_SHRINK(1);
- assert(EMPTY());
- _PyFrame_SetStackPointer(frame, stack_pointer);
- _Py_LeaveRecursiveCallPy(tstate);
- assert(frame != &entry_frame);
- // GH-99729: We need to unlink the frame *before* clearing it:
- _PyInterpreterFrame *dying = frame;
- frame = tstate->current_frame = dying->previous;
- _PyEvalFrameClearAndPop(tstate, dying);
- frame->prev_instr += frame->return_offset;
- _PyFrame_StackPush(frame, retval);
- goto resume_frame;
- STACK_SHRINK(1);
+ {
+ assert(EMPTY());
+ _PyFrame_SetStackPointer(frame, stack_pointer);
+ _Py_LeaveRecursiveCallPy(tstate);
+ // GH-99729: We need to unlink the frame *before* clearing it:
+ _PyInterpreterFrame *dying = frame;
+ #if TIER_ONE
+ assert(frame != &entry_frame);
+ #endif
+ frame = tstate->current_frame = dying->previous;
+ _PyEval_FrameClearAndPop(tstate, dying);
+ frame->prev_instr += frame->return_offset;
+ _PyFrame_StackPush(frame, retval);
+ #if TIER_ONE
+ goto resume_frame;
+ #endif
+ #if TIER_TWO
+ stack_pointer = _PyFrame_GetStackPointer(frame);
+ ip_offset = (_Py_CODEUNIT *)_PyFrame_GetCode(frame)->co_code_adaptive;
+ #endif
+ }
}
TARGET(INSTRUMENTED_RETURN_VALUE) {
@@ -1001,7 +1024,7 @@
// GH-99729: We need to unlink the frame *before* clearing it:
_PyInterpreterFrame *dying = frame;
frame = tstate->current_frame = dying->previous;
- _PyEvalFrameClearAndPop(tstate, dying);
+ _PyEval_FrameClearAndPop(tstate, dying);
frame->prev_instr += frame->return_offset;
_PyFrame_StackPush(frame, retval);
goto resume_frame;
@@ -1009,19 +1032,46 @@
}
TARGET(RETURN_CONST) {
- PyObject *retval = GETITEM(FRAME_CO_CONSTS, oparg);
- Py_INCREF(retval);
- assert(EMPTY());
- _PyFrame_SetStackPointer(frame, stack_pointer);
- _Py_LeaveRecursiveCallPy(tstate);
- assert(frame != &entry_frame);
- // GH-99729: We need to unlink the frame *before* clearing it:
- _PyInterpreterFrame *dying = frame;
- frame = tstate->current_frame = dying->previous;
- _PyEvalFrameClearAndPop(tstate, dying);
- frame->prev_instr += frame->return_offset;
- _PyFrame_StackPush(frame, retval);
- goto resume_frame;
+ PyObject *value;
+ PyObject *retval;
+ // LOAD_CONST
+ {
+ value = GETITEM(FRAME_CO_CONSTS, oparg);
+ Py_INCREF(value);
+ }
+ // SAVE_CURRENT_IP
+ {
+ #if TIER_ONE
+ frame->prev_instr = next_instr - 1;
+ #endif
+ #if TIER_TWO
+ // Relies on a preceding SAVE_IP
+ frame->prev_instr--;
+ #endif
+ }
+ // _POP_FRAME
+ retval = value;
+ {
+ assert(EMPTY());
+ _PyFrame_SetStackPointer(frame, stack_pointer);
+ _Py_LeaveRecursiveCallPy(tstate);
+ // GH-99729: We need to unlink the frame *before* clearing it:
+ _PyInterpreterFrame *dying = frame;
+ #if TIER_ONE
+ assert(frame != &entry_frame);
+ #endif
+ frame = tstate->current_frame = dying->previous;
+ _PyEval_FrameClearAndPop(tstate, dying);
+ frame->prev_instr += frame->return_offset;
+ _PyFrame_StackPush(frame, retval);
+ #if TIER_ONE
+ goto resume_frame;
+ #endif
+ #if TIER_TWO
+ stack_pointer = _PyFrame_GetStackPointer(frame);
+ ip_offset = (_Py_CODEUNIT *)_PyFrame_GetCode(frame)->co_code_adaptive;
+ #endif
+ }
}
TARGET(INSTRUMENTED_RETURN_CONST) {
@@ -1038,7 +1088,7 @@
// GH-99729: We need to unlink the frame *before* clearing it:
_PyInterpreterFrame *dying = frame;
frame = tstate->current_frame = dying->previous;
- _PyEvalFrameClearAndPop(tstate, dying);
+ _PyEval_FrameClearAndPop(tstate, dying);
frame->prev_instr += frame->return_offset;
_PyFrame_StackPush(frame, retval);
goto resume_frame;
@@ -4575,7 +4625,8 @@
goto error;
}
- func_obj->func_version = ((PyCodeObject *)codeobj)->co_version;
+ _PyFunction_SetVersion(
+ func_obj, ((PyCodeObject *)codeobj)->co_version);
func = (PyObject *)func_obj;
stack_pointer[-1] = func;
DISPATCH();