8000 GH-117062: Make _JUMP_TO_TOP a general absolute jump (GH-120854) · python/cpython@a47abdb · GitHub
[go: up one dir, main page]

Skip to content

Commit a47abdb

Browse files
authored
GH-117062: Make _JUMP_TO_TOP a general absolute jump (GH-120854)
1 parent ce1064e commit a47abdb

File tree

5 files changed

+7
-12
lines changed

5 files changed

+7
-12
lines changed

Python/bytecodes.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4149,9 +4149,7 @@ dummy_func(
41494149
}
41504150

41514151
op(_JUMP_TO_TOP, (--)) {
4152-
#ifndef _Py_JIT
4153-
next_uop = &current_executor->trace[1];
4154-
#endif
4152+
JUMP_TO_JUMP_TARGET();
41554153
}
41564154

41574155
tier2 op(_SET_IP, (instr_ptr/4 --)) {

Python/executor_cases.c.h

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/optimizer.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,11 @@ prepare_for_execution(_PyUOpInstruction *buffer, int length)
10591059
buffer[i].jump_target = 0;
10601060
}
10611061
}
1062+
if (opcode == _JUMP_TO_TOP) {
1063+
assert(buffer[0].opcode == _START_EXECUTOR);
1064+
buffer[i].format = UOP_FORMAT_JUMP;
1065+
buffer[i].jump_target = 1;
1066+
}
10621067
}
10631068
return next_spare;
10641069
}

Tools/jit/_stencils.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ class HoleValue(enum.Enum):
4242
ERROR_TARGET = enum.auto()
4343
# The index of the exit to be jumped through (exposed as _JIT_EXIT_INDEX):
4444
EXIT_INDEX = enum.auto()
45-
# The base address of the machine code for the first uop (exposed as _JIT_TOP):
46-
TOP = enum.auto()
4745
# A hardcoded value of zero (used for symbol lookups):
4846
ZERO = enum.auto()
4947

@@ -110,7 +108,6 @@ class HoleValue(enum.Enum):
110108
HoleValue.JUMP_TARGET: "instruction_starts[instruction->jump_target]",
111109
HoleValue.ERROR_TARGET: "instruction_starts[instruction->error_target]",
112110
HoleValue.EXIT_INDEX: "instruction->exit_index",
113-
HoleValue.TOP: "instruction_starts[1]",
114111
HoleValue.ZERO: "",
115112
}
116113

Tools/jit/template.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,6 @@ _JIT_ENTRY(_PyInterpreterFrame *frame, PyObject **stack_pointer, PyThreadState *
105105
UOP_STAT_INC(uopcode, execution_count);
106106

107107
// The actual instruction definitions (only one will be used):
108-
if (uopcode == _JUMP_TO_TOP) {
109-
PATCH_JUMP(_JIT_TOP);
110-
}
111108
switch (uopcode) {
112109
#include "executor_cases.c.h"
113110
default:

0 commit comments

Comments
 (0)
0