Skip to content

Commit 66d7b56

Browse files
committed
Remove asymmetry in JUMP_BACKWARD specialization
1 parent cb3d982 commit 66d7b56

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

Python/bytecodes.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2805,20 +2805,18 @@ dummy_func(
28052805
tier1 op(_SPECIALIZE_JUMP_BACKWARD, (--)) {
28062806
#if ENABLE_SPECIALIZATION
28072807
if (this_instr->op.code == JUMP_BACKWARD) {
2808-
if (tstate->interp->jit) {
2809-
this_instr->op.code = JUMP_BACKWARD_JIT;
2810-
next_instr = this_instr;
2811-
DISPATCH_SAME_OPARG();
2812-
}
2813-
this_instr->op.code = JUMP_BACKWARD_NO_JIT;
2808+
this_instr->op.code = tstate->interp->jit ? JUMP_BACKWARD_JIT : JUMP_BACKWARD_NO_JIT;
2809+
// Need to re-dispatch so the warmup counter isn't off by one:
2810+
next_instr = this_instr;
2811+
DISPATCH_SAME_OPARG();
28142812
}
28152813
#endif
28162814
}
28172815

28182816
tier1 op(_JIT, (--)) {
28192817
#ifdef _Py_TIER2
28202818
_Py_BackoffCounter counter = this_instr[1].counter;
2821-
if (backoff_counter_triggers(counter)) {
2819+
if (backoff_counter_triggers(counter) && this_instr->op.code == JUMP_BACKWARD_JIT) {
28222820
_Py_CODEUNIT *start = this_instr;
28232821
/* Back up over EXTENDED_ARGs so optimizer sees the whole instruction */
28242822
while (oparg > 255) {

Python/generated_cases.c.h

Lines changed: 5 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)