From: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> Date: Thu, 6 Nov 2025 20:33:05 +0000 (+0000) Subject: move strange control flow detection up X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5de2756564af7e9e9da654f54ad2ce0afec8f9d;p=thirdparty%2FPython%2Fcpython.git move strange control flow detection up --- diff --git a/Python/optimizer.c b/Python/optimizer.c index cef8ae4fadce..b31b4ddfefe2 100644 --- a/Python/optimizer.c +++ b/Python/optimizer.c @@ -628,6 +628,14 @@ _PyJit_translate_single_bytecode_to_trace( goto done; } + // Strange control-flow + bool has_dynamic_jump_taken = OPCODE_HAS_UNPREDICTABLE_JUMP(opcode) && + (next_instr != this_instr + 1 + _PyOpcode_Caches[_PyOpcode_Deopt[opcode]]); + if (has_dynamic_jump_taken) { + DPRINTF(2, "Unsupported: dynamic jump taken\n"); + goto unsupported; + } + /* Special case the first instruction, * so that we can guarantee forward progress */ if (progress_needed && tstate->interp->jit_state.code_curr_size <= 2) { @@ -638,14 +646,6 @@ _PyJit_translate_single_bytecode_to_trace( assert(!OPCODE_HAS_DEOPT(opcode)); } - // Strange control-flow - bool has_dynamic_jump_taken = OPCODE_HAS_UNPREDICTABLE_JUMP(opcode) && - (next_instr != this_instr + 1 + _PyOpcode_Caches[_PyOpcode_Deopt[opcode]]); - if (has_dynamic_jump_taken) { - DPRINTF(2, "Unsupported: dynamic jump taken\n"); - goto unsupported; - } - // This happens when a recursive call happens that we can't trace. Such as Python -> C -> Python calls // If we haven't guarded the IP, then it's untraceable. if (frame != tstate->interp->jit_state.prev_instr_frame && !needs_guard_ip) {