]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
revert last 2 changes
authorKen Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Mon, 20 Oct 2025 01:31:30 +0000 (02:31 +0100)
committerKen Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Mon, 20 Oct 2025 01:31:30 +0000 (02:31 +0100)
Python/optimizer.c
Python/optimizer_analysis.c

index 53f3c6e8bfc887a69ed187a353ab87eb57378793..a11244d4b54f74592d087fde25e40925439c968e 100644 (file)
@@ -710,19 +710,11 @@ _PyJIT_translate_single_bytecode_to_trace(
         case POP_JUMP_IF_FALSE:
         case POP_JUMP_IF_TRUE:
         {
-            int counter = target_instr[1].cache;
-            int bitcount = _Py_popcount32(counter);
-            int jump_likely = bitcount > 8;
             _Py_CODEUNIT *computed_next_instr_without_modifiers = target_instr + 1 + _PyOpcode_Caches[_PyOpcode_Deopt[opcode]];
             _Py_CODEUNIT *computed_next_instr = computed_next_instr_without_modifiers + (computed_next_instr_without_modifiers->op.code == NOT_TAKEN);
             _Py_CODEUNIT *computed_jump_instr = computed_next_instr_without_modifiers + oparg;
             assert(next_instr == computed_next_instr || next_instr == computed_jump_instr);
             int jump_happened = computed_jump_instr == next_instr;
-            // Jump is likely but it did not happen this time. Indicates we are likely tracing
-            // an uncommmon path. Stop the trace early here to prevent trace explosion.
-            if (jump_likely != jump_happened) {
-                goto unsupported;
-            }
             uint32_t uopcode = BRANCH_TO_GUARD[opcode - POP_JUMP_IF_FALSE][jump_happened];
             ADD_TO_TRACE(uopcode, 0, 0, INSTR_IP(jump_happened ? computed_next_instr : computed_jump_instr, old_code));
             break;
@@ -1234,7 +1226,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 && buffer[length-1].opcode != _JUMP_TO_TOP) {
+    if (length <= 5) {
         return 0;
     }
     assert(length > 0);
index 7cee20bd8ee2a0c9aaf752a4718e991bbce028d5..9f2a12efee6799e52b85cf3706c9be5d17894a56 100644 (file)
@@ -528,14 +528,10 @@ _Py_uop_analyze_and_optimize(
 {
     OPT_STAT_INC(optimizer_attempts);
 
-    int err = optimize_uops(
+    optimize_uops(
          initial_func, buffer,
          length, curr_stacklen, dependencies);
 
-    if (err == 0) {
-        return err;
-    }
-
     assert(length > 0);
 
     length = remove_unneeded_uops(buffer, length);