diff options
author | Brandt Bucher <brandtbucher@microsoft.com> | 2023-07-20 16:35:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-20 16:35:39 (GMT) |
commit | 214a25dd81dfe5ee0ab843cf665da2a7473a08db (patch) | |
tree | b8b3defdba096cbf70180c968a59531c8d1a7465 /Python/bytecodes.c | |
parent | 009e8f084c4cbb1f43d40b24b7f71fb189bbe36b (diff) | |
download | cpython-214a25dd81dfe5ee0ab843cf665da2a7473a08db.zip cpython-214a25dd81dfe5ee0ab843cf665da2a7473a08db.tar.gz cpython-214a25dd81dfe5ee0ab843cf665da2a7473a08db.tar.bz2 |
GH-104584: Miscellaneous fixes for -Xuops (GH-106908)
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r-- | Python/bytecodes.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c index ea136a3..81d6f80 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -2182,7 +2182,14 @@ dummy_func( JUMPBY(1-oparg); #if ENABLE_SPECIALIZATION here[1].cache += (1 << OPTIMIZER_BITS_IN_COUNTER); - if (here[1].cache > tstate->interp->optimizer_backedge_threshold) { + 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 + ) + { OBJECT_STAT_INC(optimization_attempts); frame = _PyOptimizer_BackEdge(frame, here, next_instr, stack_pointer); if (frame == NULL) { |