]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Don't JIT short traces except if they end in a loop
authorKen Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Sun, 19 Oct 2025 23:43:35 +0000 (00:43 +0100)
committerKen Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Sun, 19 Oct 2025 23:43:35 +0000 (00:43 +0100)
Python/optimizer.c

index c46c23aa128825b2c743ee5d0183d82a694ca9c2..53f3c6e8bfc887a69ed187a353ab87eb57378793 100644 (file)
@@ -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);