]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-141861: Fix TRACE_RECORD if full (GH-141959)
authorSergey Miryanov <sergey.miryanov@gmail.com>
Wed, 26 Nov 2025 14:32:30 +0000 (19:32 +0500)
committerGitHub <noreply@github.com>
Wed, 26 Nov 2025 14:32:30 +0000 (14:32 +0000)
Lib/test/test_sys.py
Python/bytecodes.c
Python/generated_cases.c.h

index 2e87e38fe5dfdc4de9f6574c6509bc90985e4910..04018e9603ff135ff7310fa009dc7ae5ede8dda2 100644 (file)
@@ -2254,7 +2254,7 @@ class TestSysJIT(unittest.TestCase):
                 # 1 extra iteration for tracing.
                 for i in range(_testinternalcapi.TIER2_THRESHOLD + 2):
                     # Careful, doing this in the reverse order breaks tracing:
-                    expected = {enabled} and i >= _testinternalcapi.TIER2_THRESHOLD + 1
+                    expected = {enabled} and i >= _testinternalcapi.TIER2_THRESHOLD
                     assert sys._jit.is_active() is expected
                     frame_2_jit(expected)
                     assert sys._jit.is_active() is expected
index 6129ea2e72327351f5ebdf5fe6810db5ae18716a..01cd1e8359815aca152910600272082c01dc7f6a 100644 (file)
@@ -3018,7 +3018,7 @@ dummy_func(
                 goto stop_tracing;
             }
             PyCodeObject *code = _PyFrame_GetCode(frame);
-            _PyExecutorObject *executor = code->co_executors->executors[this_instr->op.arg];
+            _PyExecutorObject *executor = code->co_executors->executors[oparg & 255];
             assert(executor->vm_data.index == INSTR_OFFSET() - 1);
             assert(executor->vm_data.code == code);
             assert(executor->vm_data.valid);
@@ -5650,7 +5650,7 @@ dummy_func(
                 LEAVE_TRACING();
                 int err = stop_tracing_and_jit(tstate, frame);
                 ERROR_IF(err < 0);
-                DISPATCH_GOTO_NON_TRACING();
+                DISPATCH();
             }
             // 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.
index 47805c270f9a0ec5243b859e8db9fa081e91e665..57d5e71144d38c29bdbd93361b73fdd39a90d338 100644 (file)
                 JUMP_TO_LABEL(stop_tracing);
             }
             PyCodeObject *code = _PyFrame_GetCode(frame);
-            _PyExecutorObject *executor = code->co_executors->executors[this_instr->op.arg];
+            _PyExecutorObject *executor = code->co_executors->executors[oparg & 255];
             assert(executor->vm_data.index == INSTR_OFFSET() - 1);
             assert(executor->vm_data.code == code);
             assert(executor->vm_data.valid);
                 if (err < 0) {
                     JUMP_TO_LABEL(error);
                 }
-                DISPATCH_GOTO_NON_TRACING();
+                DISPATCH();
             }
             _PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate;
             if ((_tstate->jit_tracer_state.prev_state.instr->op.code == CALL_LIST_APPEND &&