mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
GH-104584: Don't call executors from JUMP_BACKWARD (GH-109347)
This commit is contained in:
parent
22e65eecaa
commit
6c13e13b13
4 changed files with 23 additions and 40 deletions
20
Python/generated_cases.c.h
generated
20
Python/generated_cases.c.h
generated
|
@ -2945,21 +2945,17 @@
|
|||
here[1].cache += (1 << OPTIMIZER_BITS_IN_COUNTER);
|
||||
if (here[1].cache > tstate->interp->optimizer_backedge_threshold &&
|
||||
// Double-check that the opcode isn't instrumented or something:
|
||||
here->op.code == JUMP_BACKWARD &&
|
||||
// _PyOptimizer_BackEdge is going to change frame->prev_instr,
|
||||
// which breaks line event calculations:
|
||||
next_instr->op.code != INSTRUMENTED_LINE
|
||||
)
|
||||
here->op.code == JUMP_BACKWARD)
|
||||
{
|
||||
OBJECT_STAT_INC(optimization_attempts);
|
||||
frame = _PyOptimizer_BackEdge(frame, here, next_instr, stack_pointer);
|
||||
if (frame == NULL) {
|
||||
frame = tstate->current_frame;
|
||||
goto resume_with_error;
|
||||
int optimized = _PyOptimizer_BackEdge(frame, here, next_instr, stack_pointer);
|
||||
if (optimized < 0) goto error;
|
||||
if (optimized) {
|
||||
// Rewind and enter the executor:
|
||||
assert(here->op.code == ENTER_EXECUTOR);
|
||||
next_instr = here;
|
||||
}
|
||||
assert(frame == tstate->current_frame);
|
||||
here[1].cache &= ((1 << OPTIMIZER_BITS_IN_COUNTER) -1);
|
||||
goto resume_frame;
|
||||
here[1].cache &= ((1 << OPTIMIZER_BITS_IN_COUNTER) - 1);
|
||||
}
|
||||
#endif /* ENABLE_SPECIALIZATION */
|
||||
DISPATCH();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue