@@ -557,6 +557,14 @@ _PyJit_translate_single_bytecode_to_trace(
557557 _Py_CODEUNIT * next_instr )
558558{
559559
560+ #ifdef Py_DEBUG
561+ char * python_lltrace = Py_GETENV ("PYTHON_LLTRACE" );
562+ int lltrace = 0 ;
563+ if (python_lltrace != NULL && * python_lltrace >= '0' ) {
564+ lltrace = * python_lltrace - '0' ; // TODO: Parse an int and all that
565+ }
566+ #endif
567+
560568 PyCodeObject * old_code = tstate -> interp -> jit_state .prev_instr_code ;
561569 // Something else finalized the trace. This can happen in multi-threaded scenarios as our trace
562570 // addition from bytecode execution to here is not atomic.
@@ -576,13 +584,6 @@ _PyJit_translate_single_bytecode_to_trace(
576584 goto full ;
577585 }
578586
579- #ifdef Py_DEBUG
580- char * python_lltrace = Py_GETENV ("PYTHON_LLTRACE" );
581- int lltrace = 0 ;
582- if (python_lltrace != NULL && * python_lltrace >= '0' ) {
583- lltrace = * python_lltrace - '0' ; // TODO: Parse an int and all that
584- }
585- #endif
586587 _Py_CODEUNIT * this_instr = tstate -> interp -> jit_state .prev_instr ;
587588 _Py_CODEUNIT * target_instr = this_instr ;
588589 uint32_t target = 0 ;
@@ -593,8 +594,8 @@ _PyJit_translate_single_bytecode_to_trace(
593594 // We must point to the first EXTENDED_ARG when deopting.
594595 int oparg = tstate -> interp -> jit_state .prev_instr_oparg ;
595596 int opcode = this_instr -> op .code ;
596- // Failed specialization twice in a row . Deopt!
597- if (tstate -> interp -> jit_state .specialize_counter >= 1 ) {
597+ // Failed specialization many times . Deopt!
598+ if (tstate -> interp -> jit_state .specialize_counter >= MAX_SPECIALIZATION_TRIES ) {
598599 opcode = _PyOpcode_Deopt [opcode ];
599600 }
600601 int rewind_oparg = oparg ;
0 commit comments