mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
gh-106529: Make FOR_ITER a viable uop (#112134)
This uses the new mechanism whereby certain uops are replaced by others during translation, using the `_PyUop_Replacements` table. We further special-case the `_FOR_ITER_TIER_TWO` uop to update the deoptimization target to point just past the corresponding `END_FOR` opcode. Two tiny code cleanups are also part of this PR.
This commit is contained in:
parent
d59feb5dbe
commit
1995955173
8 changed files with 138 additions and 43 deletions
|
@ -1074,7 +1074,7 @@ deoptimize:
|
|||
UOP_STAT_INC(opcode, miss);
|
||||
frame->return_offset = 0; // Dispatch to frame->instr_ptr
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
frame->instr_ptr = next_uop[-1].target + _PyCode_CODE((PyCodeObject *)frame->f_executable);
|
||||
frame->instr_ptr = next_uop[-1].target + _PyCode_CODE(_PyFrame_GetCode(frame));
|
||||
Py_DECREF(current_executor);
|
||||
// Fall through
|
||||
// Jump here from ENTER_EXECUTOR
|
||||
|
@ -1085,7 +1085,7 @@ enter_tier_one:
|
|||
// Jump here from _EXIT_TRACE
|
||||
exit_trace:
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
frame->instr_ptr = next_uop[-1].target + _PyCode_CODE((PyCodeObject *)frame->f_executable);
|
||||
frame->instr_ptr = next_uop[-1].target + _PyCode_CODE(_PyFrame_GetCode(frame));
|
||||
Py_DECREF(current_executor);
|
||||
OPT_HIST(trace_uop_execution_counter, trace_run_length_hist);
|
||||
goto enter_tier_one;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue