From d820e22378966553002e718930c77c1edfa50997 Mon Sep 17 00:00:00 2001 From: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> Date: Mon, 20 Oct 2025 00:43:35 +0100 Subject: [PATCH] Don't JIT short traces except if they end in a loop --- Python/optimizer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/optimizer.c b/Python/optimizer.c index c46c23aa1288..53f3c6e8bfc8 100644 --- a/Python/optimizer.c +++ b/Python/optimizer.c @@ -1234,7 +1234,7 @@ uop_optimize( int curr_stackentries = tstate->interp->jit_state.jit_tracer_initial_stack_depth; int length = interp->jit_state.jit_tracer_code_curr_size; // Trace too short, don't bother. - if (length <= 20) { + if (length <= 20 && buffer[length-1].opcode != _JUMP_TO_TOP) { return 0; } assert(length > 0); -- 2.47.3