Skip to content

Commit b7b3c23

Browse files
move code to correcdt places
1 parent c5de275 commit b7b3c23

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

Python/optimizer.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,24 @@ _PyJit_translate_single_bytecode_to_trace(
605605

606606
int old_stack_level = tstate->interp->jit_state.prev_instr_stacklevel;
607607

608+
// Strange control-flow
609+
bool has_dynamic_jump_taken = OPCODE_HAS_UNPREDICTABLE_JUMP(opcode) &&
610+
(next_instr != this_instr + 1 + _PyOpcode_Caches[_PyOpcode_Deopt[opcode]]);
611+
if (has_dynamic_jump_taken) {
612+
DPRINTF(2, "Unsupported: dynamic jump taken\n");
613+
goto unsupported;
614+
}
615+
616+
/* Special case the first instruction,
617+
* so that we can guarantee forward progress */
618+
if (progress_needed && tstate->interp->jit_state.code_curr_size <= 3) {
619+
if (OPCODE_HAS_EXIT(opcode) || OPCODE_HAS_DEOPT(opcode)) {
620+
opcode = _PyOpcode_Deopt[opcode];
621+
}
622+
assert(!OPCODE_HAS_EXIT(opcode));
623+
assert(!OPCODE_HAS_DEOPT(opcode));
624+
}
625+
608626
bool needs_guard_ip = _PyOpcode_NeedsGuardIp[opcode];
609627
DPRINTF(2, "%p %d: %s(%d) %d %d\n", old_code, target, _PyOpcode_OpName[opcode], oparg, needs_guard_ip, old_stack_level);
610628

@@ -628,24 +646,6 @@ _PyJit_translate_single_bytecode_to_trace(
628646
goto done;
629647
}
630648

631-
// Strange control-flow
632-
bool has_dynamic_jump_taken = OPCODE_HAS_UNPREDICTABLE_JUMP(opcode) &&
633-
(next_instr != this_instr + 1 + _PyOpcode_Caches[_PyOpcode_Deopt[opcode]]);
634-
if (has_dynamic_jump_taken) {
635-
DPRINTF(2, "Unsupported: dynamic jump taken\n");
636-
goto unsupported;
637-
}
638-
639-
/* Special case the first instruction,
640-
* so that we can guarantee forward progress */
641-
if (progress_needed && tstate->interp->jit_state.code_curr_size <= 2) {
642-
if (OPCODE_HAS_EXIT(opcode) || OPCODE_HAS_DEOPT(opcode)) {
643-
opcode = _PyOpcode_Deopt[opcode];
644-
}
645-
assert(!OPCODE_HAS_EXIT(opcode));
646-
assert(!OPCODE_HAS_DEOPT(opcode));
647-
}
648-
649649
// This happens when a recursive call happens that we can't trace. Such as Python -> C -> Python calls
650650
// If we haven't guarded the IP, then it's untraceable.
651651
if (frame != tstate->interp->jit_state.prev_instr_frame && !needs_guard_ip) {

0 commit comments

Comments
 (0)