]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Support BINARY_OP_INPLACE_ADD_UNICODE
authorKen Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Mon, 20 Oct 2025 01:37:40 +0000 (02:37 +0100)
committerKen Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Mon, 20 Oct 2025 01:37:40 +0000 (02:37 +0100)
Python/optimizer.c

index a11244d4b54f74592d087fde25e40925439c968e..24e3d0614a2a7651754db4b77f6b15ba888a7912 100644 (file)
@@ -615,8 +615,6 @@ _PyJIT_translate_single_bytecode_to_trace(
         // If we haven't guarded the IP, then it's untraceable.
         (frame != tstate->interp->jit_state.jit_tracer_current_frame && !needs_guard_ip) ||
         (oparg > 0xFFFF) ||
-        // TODO handle BINARY_OP_INPLACE_ADD_UNICODE
-        opcode == BINARY_OP_INPLACE_ADD_UNICODE ||
         // TODO (gh-140277): The constituent uops are invalid.
         opcode == BINARY_OP_SUBSCR_GETITEM ||
         // Exception stuff, could be handled in the future maybe?
@@ -838,6 +836,12 @@ _PyJIT_translate_single_bytecode_to_trace(
                         operand = 0;
                     }
                 }
+                if (uop == _BINARY_OP_INPLACE_ADD_UNICODE) {
+                    assert(i + 1 == nuops);
+                    _Py_CODEUNIT *next_instr = target_instr + 1 + _PyOpcode_Caches[_PyOpcode_Deopt[opcode]];
+                    assert(next_instr->op.code == STORE_FAST);
+                    operand = next_instr->op.arg;
+                }
                 // All other instructions
                 ADD_TO_TRACE(uop, oparg, operand, target);
             }