diff options
author | Brandt Bucher <brandtbucher@microsoft.com> | 2023-09-13 17:26:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-13 17:26:50 (GMT) |
commit | 6c13e13b13bebfdde8ad4019536499820cdfc926 (patch) | |
tree | 4b3768dc20494d11f8135a6e9633fc088d23e12a /Python/generated_cases.c.h | |
parent | 22e65eecaad3f5337862319687047afe9861e1ef (diff) | |
download | cpython-6c13e13b13bebfdde8ad4019536499820cdfc926.zip cpython-6c13e13b13bebfdde8ad4019536499820cdfc926.tar.gz cpython-6c13e13b13bebfdde8ad4019536499820cdfc926.tar.bz2 |
GH-104584: Don't call executors from JUMP_BACKWARD (GH-109347)
Diffstat (limited to 'Python/generated_cases.c.h')
-rw-r--r-- | Python/generated_cases.c.h | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index fff47a1..ebb87a8 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -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(); |