From: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> Date: Fri, 24 Oct 2025 15:40:00 +0000 (+0100) Subject: Fix FT X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6bd1541a8ad54d08a8a49837b300cae58904179e;p=thirdparty%2FPython%2Fcpython.git Fix FT --- diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 31a433721fe4..fc12dc787bce 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -5229,7 +5229,7 @@ dummy_func( ERROR_IF(err < 0); DISPATCH_GOTO_NON_TRACING(); } - // Super instructions. Instruction deopted, There's a mismatch in what the stack expects + // Super instructions. Instruction deopted. There's a mismatch in what the stack expects // in the optimizer. So we have to reflect in the trace correctly. if ((tstate->interp->jit_state.prev_instr->op.code == CALL_LIST_APPEND && opcode == POP_TOP) || @@ -5470,10 +5470,6 @@ dummy_func( assert(exit != NULL); _Py_CODEUNIT *target = _PyFrame_GetBytecode(frame) + exit->target; _Py_BackoffCounter temperature = exit->temperature; - if (!backoff_counter_triggers(temperature)) { - exit->temperature = advance_backoff_counter(temperature); - GOTO_TIER_ONE(target); - } _PyExecutorObject *executor; if (target->op.code == ENTER_EXECUTOR) { PyCodeObject *code = _PyFrame_GetCode(frame); @@ -5481,6 +5477,10 @@ dummy_func( Py_INCREF(executor); } else { + if (!backoff_counter_triggers(temperature)) { + exit->temperature = advance_backoff_counter(temperature); + GOTO_TIER_ONE(target); + } _PyExecutorObject *previous_executor = _PyExecutor_FromExit(exit); assert(tstate->current_executor == (PyObject *)previous_executor); int chain_depth = previous_executor->vm_data.chain_depth + 1; diff --git a/Python/ceval_macros.h b/Python/ceval_macros.h index abef480b902a..f85a7f9e271a 100644 --- a/Python/ceval_macros.h +++ b/Python/ceval_macros.h @@ -355,7 +355,11 @@ GETITEM(PyObject *v, Py_ssize_t i) { #define RECORD_BRANCH_TAKEN(bitset, flag) #endif -#define RECORD_DYNAMIC_JUMP_TAKEN() tstate->interp->jit_state.dynamic_jump_taken = true; +#if _Py_TIER2 +# define RECORD_DYNAMIC_JUMP_TAKEN() tstate->interp->jit_state.dynamic_jump_taken = true; +#else +# define RECORD_DYNAMIC_JUMP_TAKEN() +#endif #define UNBOUNDLOCAL_ERROR_MSG \ "cannot access local variable '%s' where it is not associated with a value" diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h index 6d155cf81796..2fa109b049d1 100644 --- a/Python/executor_cases.c.h +++ b/Python/executor_cases.c.h @@ -7487,10 +7487,6 @@ assert(exit != NULL); _Py_CODEUNIT *target = _PyFrame_GetBytecode(frame) + exit->target; _Py_BackoffCounter temperature = exit->temperature; - if (!backoff_counter_triggers(temperature)) { - exit->temperature = advance_backoff_counter(temperature); - GOTO_TIER_ONE(target); - } _PyExecutorObject *executor; if (target->op.code == ENTER_EXECUTOR) { PyCodeObject *code = _PyFrame_GetCode(frame); @@ -7498,6 +7494,10 @@ Py_INCREF(executor); } else { + if (!backoff_counter_triggers(temperature)) { + exit->temperature = advance_backoff_counter(temperature); + GOTO_TIER_ONE(target); + } _PyExecutorObject *previous_executor = _PyExecutor_FromExit(exit); assert(tstate->current_executor == (PyObject *)previous_executor); int chain_depth = previous_executor->vm_data.chain_depth + 1;