Skip to content

Commit 62303c1

Browse files
committed
bpo-46724: Use JUMP_ABSOLUTE for all backward jumps. (GH-31326)
(cherry picked from commit 3be1a44)
1 parent b271953 commit 62303c1

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Make sure that all backwards jumps use the ``JUMP_ABSOLUTE`` instruction, rather
2+
than ``JUMP_FORWARD`` with an argument of ``(2**32)+offset``.

Python/compile.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6702,6 +6702,11 @@ assemble_emit(struct assembler *a, struct instr *i)
67026702
}
67036703

67046704
static void
6705+
if (last->i_opcode == JUMP_FORWARD) {
6706+
if (last->i_target->b_visited == 1) {
6707+
last->i_opcode = JUMP_ABSOLUTE;
6708+
}
6709+
}
67056710
assemble_jump_offsets(struct assembler *a, struct compiler *c)
67066711
{
67076712
basicblock *b;

0 commit comments

Comments
 (0)