]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix FT
authorKen Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Fri, 24 Oct 2025 15:40:00 +0000 (16:40 +0100)
committerKen Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Fri, 24 Oct 2025 15:40:00 +0000 (16:40 +0100)
Python/bytecodes.c
Python/ceval_macros.h
Python/executor_cases.c.h

index 31a433721fe4164b7b8e1c0da289ff9c88c6308b..fc12dc787bce58aa9629f7ce8eb9912ff57c29b2 100644 (file)
@@ -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;
index abef480b902a5cd9b5616da697a9a118e61b7e93..f85a7f9e271a50753ad60dbbdf61f705a05ec7e8 100644 (file)
@@ -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"
index 6d155cf8179661bd33f4a0ca33da51877f30d160..2fa109b049d1a909e0e91f72ff8b625e16c66afd 100644 (file)
             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);
                 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;