From ba64a5ba4a640753c286296ed41d92642a8b3405 Mon Sep 17 00:00:00 2001 From: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> Date: Mon, 20 Oct 2025 02:37:40 +0100 Subject: [PATCH] Support BINARY_OP_INPLACE_ADD_UNICODE --- Python/optimizer.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Python/optimizer.c b/Python/optimizer.c index a11244d4b54f..24e3d0614a2a 100644 --- a/Python/optimizer.c +++ b/Python/optimizer.c @@ -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); } -- 2.47.3