diff options
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) { |