From 8a672c3cfc03e5039111ecbc0aba821205ca2bdd Mon Sep 17 00:00:00 2001 From: Sergey Miryanov Date: Wed, 26 Nov 2025 00:24:14 +0500 Subject: [PATCH 1/4] Revert changes for ENTER_EXECUTOR --- Python/bytecodes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 6129ea2e723273..12ee506e4f2bc4 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -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); From b0432ae5d8effab84febf3dbc63dae2544908b5d Mon Sep 17 00:00:00 2001 From: Sergey Miryanov Date: Wed, 26 Nov 2025 00:24:40 +0500 Subject: [PATCH 2/4] Fix TRACE_RECORD if trace full --- Python/bytecodes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 12ee506e4f2bc4..01cd1e8359815a 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -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. From be75204768fe0c178bd45e2e4f1e72da74ee7a49 Mon Sep 17 00:00:00 2001 From: Sergey Miryanov Date: Wed, 26 Nov 2025 00:29:32 +0500 Subject: [PATCH 3/4] Update generated_cases --- Python/generated_cases.c.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 47805c270f9a0e..57d5e71144d38c 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -5476,7 +5476,7 @@ 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); @@ -11714,7 +11714,7 @@ 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 && From 2896c2d5632c9cf3ba1c50c702957e84a0f08c95 Mon Sep 17 00:00:00 2001 From: Sergey Miryanov Date: Wed, 26 Nov 2025 01:07:04 +0500 Subject: [PATCH 4/4] Fix test_jit_is_active --- Lib/test/test_sys.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index 2e87e38fe5dfdc..04018e9603ff13 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -2254,7 +2254,7 @@ def frame_3_jit() -> None: # 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