File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -610,6 +610,22 @@ _PyJit_translate_single_bytecode_to_trace(
610610 target -- ;
611611 }
612612
613+ if (_PyOpcode_Caches [_PyOpcode_Deopt [opcode ]] > 0 ) {
614+ uint16_t backoff = (this_instr + 1 )-> counter .value_and_backoff ;
615+ // adaptive_counter_cooldown is a fresh specialization.
616+ // trigger_backoff_counter is what we set during tracing.
617+ // All tracing backoffs should be freshly specialized or untouched.
618+ // If not, that indicates a deopt during tracing, and
619+ // thus the "actual" instruction executed is not the one that is
620+ // in the instruction stream, but rather the deopt.
621+ // It's important we check for this, as some specializations might make
622+ // no progress (they can immediately deopt after specializing).
623+ if (backoff != adaptive_counter_cooldown ().value_and_backoff &&
624+ backoff != trigger_backoff_counter ().value_and_backoff ) {
625+ opcode = _PyOpcode_Deopt [opcode ];
626+ }
627+ }
628+
613629 int old_stack_level = _tstate -> jit_tracer_state .prev_state .instr_stacklevel ;
614630
615631 // Strange control-flow
You can’t perform that action at this time.
0 commit comments