From: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> Date: Tue, 23 Sep 2025 23:08:33 +0000 (+0100) Subject: Fix progress needed and warmup X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96b7bb2761502081765abeee357671915e59d4e4;p=thirdparty%2FPython%2Fcpython.git Fix progress needed and warmup --- diff --git a/Python/bytecodes.c b/Python/bytecodes.c index d033900c3083..658177c041dc 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -3047,13 +3047,7 @@ dummy_func( assert(executor != tstate->interp->cold_executor); tstate->jit_exit = NULL; if (IS_JIT_TRACING()) { - int old_opcode = executor->vm_data.opcode; - int old_oparg = (oparg & ~255) | executor->vm_data.oparg; RECORD_TRACE_NO_DISPATCH(); - opcode = old_opcode; - oparg = old_oparg; - next_instr = this_instr; - DISPATCH_GOTO(); } TIER1_TO_TIER2(executor); #else @@ -5453,6 +5447,7 @@ dummy_func( exit->temperature = advance_backoff_counter(temperature); GOTO_TIER_ONE(target, 0); } + exit->temperature = initial_temperature_backoff_counter(); _PyExecutorObject *previous_executor = _PyExecutor_FromExit(exit); assert(tstate->current_executor == (PyObject *)previous_executor); int chain_depth = is_dynamic ? 0 : current_executor->vm_data.chain_depth + 1; diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h index d4c7c6ad5687..b25fb61bd520 100644 --- a/Python/executor_cases.c.h +++ b/Python/executor_cases.c.h @@ -7537,6 +7537,7 @@ exit->temperature = advance_backoff_counter(temperature); GOTO_TIER_ONE(target, 0); } + exit->temperature = initial_temperature_backoff_counter(); _PyExecutorObject *previous_executor = _PyExecutor_FromExit(exit); assert(tstate->current_executor == (PyObject *)previous_executor); int chain_depth = is_dynamic ? 0 : current_executor->vm_data.chain_depth + 1; diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 229d75a8dc0d..70e3b7985639 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -5968,13 +5968,7 @@ assert(executor != tstate->interp->cold_executor); tstate->jit_exit = NULL; if (IS_JIT_TRACING()) { - int old_opcode = executor->vm_data.opcode; - int old_oparg = (oparg & ~255) | executor->vm_data.oparg; RECORD_TRACE_NO_DISPATCH(); - opcode = old_opcode; - oparg = old_oparg; - next_instr = this_instr; - DISPATCH_GOTO(); } TIER1_TO_TIER2(executor); #else @@ -19560,13 +19554,7 @@ assert(executor != tstate->interp->cold_executor); tstate->jit_exit = NULL; if (IS_JIT_TRACING()) { - int old_opcode = executor->vm_data.opcode; - int old_oparg = (oparg & ~255) | executor->vm_data.oparg; RECORD_TRACE_NO_DISPATCH(); - opcode = old_opcode; - oparg = old_oparg; - next_instr = this_instr; - DISPATCH_GOTO(); } TIER1_TO_TIER2(executor); #else diff --git a/Python/optimizer.c b/Python/optimizer.c index 8c7028b2a5a3..1afbadc207d5 100644 --- a/Python/optimizer.c +++ b/Python/optimizer.c @@ -638,7 +638,7 @@ _PyJIT_translate_single_bytecode_to_trace( /* Special case the first instruction, * so that we can guarantee forward progress */ - if (progress_needed && is_first_instr && tstate->interp->jit_tracer_code_curr_size == 0) { + if (progress_needed && is_first_instr) { if (OPCODE_HAS_EXIT(opcode) || OPCODE_HAS_DEOPT(opcode)) { opcode = _PyOpcode_Deopt[opcode]; }