Skip to content

Commit 685272e

Browse files
authored
JIT: Rename trampoline.c to shim.c (#142974)
1 parent 4aef138 commit 685272e

File tree

7 files changed

+17
-17
lines changed

7 files changed

+17
-17
lines changed

Include/internal/pycore_ceval.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ _PyEval_EvalFrame(PyThreadState *tstate, _PyInterpreterFrame *frame, int throwfl
123123

124124
#ifdef _Py_TIER2
125125
#ifdef _Py_JIT
126-
_Py_CODEUNIT *_Py_LazyJitTrampoline(
126+
_Py_CODEUNIT *_Py_LazyJitShim(
127127
struct _PyExecutorObject *current_executor, _PyInterpreterFrame *frame,
128128
_PyStackRef *stack_pointer, PyThreadState *tstate
129129
);

Python/ceval.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,7 +1601,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
16011601
}
16021602
#ifdef _Py_TIER2
16031603
#ifdef _Py_JIT
1604-
_PyJitEntryFuncPtr _Py_jit_entry = _Py_LazyJitTrampoline;
1604+
_PyJitEntryFuncPtr _Py_jit_entry = _Py_LazyJitShim;
16051605
#else
16061606
_PyJitEntryFuncPtr _Py_jit_entry = _PyTier2Interpreter;
16071607
#endif
@@ -1617,7 +1617,7 @@ _PyTier2Interpreter(
16171617
const _PyUOpInstruction *next_uop;
16181618
int oparg;
16191619
/* Set up "jit" state after entry from tier 1.
1620-
* This mimics what the jit trampoline function does. */
1620+
* This mimics what the jit shim function does. */
16211621
tstate->jit_exit = NULL;
16221622
_PyStackRef _tos_cache0 = PyStackRef_ZERO_BITS;
16231623
_PyStackRef _tos_cache1 = PyStackRef_ZERO_BITS;

Python/jit.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -672,20 +672,20 @@ _PyJIT_Compile(_PyExecutorObject *executor, const _PyUOpInstruction trace[], siz
672672
return 0;
673673
}
674674

675-
/* One-off compilation of the jit entry trampoline
675+
/* One-off compilation of the jit entry shim
676676
* We compile this once only as it effectively a normal
677677
* function, but we need to use the JIT because it needs
678678
* to understand the jit-specific calling convention.
679679
*/
680680
static _PyJitEntryFuncPtr
681-
compile_trampoline(void)
681+
compile_shim(void)
682682
{
683683
_PyExecutorObject dummy;
684684
const StencilGroup *group;
685685
size_t code_size = 0;
686686
size_t data_size = 0;
687687
jit_state state = {0};
688-
group = &trampoline;
688+
group = &shim;
689689
code_size += group->code_size;
690690
data_size += group->data_size;
691691
combine_symbol_mask(group->trampoline_mask, state.trampolines.mask);
@@ -707,7 +707,7 @@ compile_trampoline(void)
707707
// Compile the shim, which handles converting between the native
708708
// calling convention and the calling convention used by jitted code
709709
// (which may be different for efficiency reasons).
710-
group = &trampoline;
710+
group = &shim;
711711
group->emit(code, data, &dummy, NULL, &state);
712712
code += group->code_size;
713713
data += group->data_size;
@@ -723,17 +723,17 @@ compile_trampoline(void)
723723
static PyMutex lazy_jit_mutex = { 0 };
724724

725725
_Py_CODEUNIT *
726-
_Py_LazyJitTrampoline(
726+
_Py_LazyJitShim(
727727
_PyExecutorObject *executor, _PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate
728728
) {
729729
PyMutex_Lock(&lazy_jit_mutex);
730-
if (_Py_jit_entry == _Py_LazyJitTrampoline) {
731-
_PyJitEntryFuncPtr trampoline = compile_trampoline();
732-
if (trampoline == NULL) {
730+
if (_Py_jit_entry == _Py_LazyJitShim) {
731+
_PyJitEntryFuncPtr shim = compile_shim();
732+
if (shim == NULL) {
733733
PyMutex_Unlock(&lazy_jit_mutex);
734734
Py_FatalError("Cannot allocate core JIT code");
735735
}
736-
_Py_jit_entry = trampoline;
736+
_Py_jit_entry = shim;
737737
}
738738
PyMutex_Unlock(&lazy_jit_mutex);
739739
return _Py_jit_entry(executor, frame, stack_pointer, tstate);

Python/pystate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ static inline int check_interpreter_whence(long);
490490
#endif
491491

492492
extern _Py_CODEUNIT *
493-
_Py_LazyJitTrampoline(
493+
_Py_LazyJitShim(
494494
struct _PyExecutorObject *exec, _PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate
495495
);
496496

Tools/jit/_targets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ async def _build_stencils(self) -> dict[str, _stencils.StencilGroup]:
204204
with tempfile.TemporaryDirectory() as tempdir:
205205
work = pathlib.Path(tempdir).resolve()
206206
async with asyncio.TaskGroup() as group:
207-
coro = self._compile("trampoline", TOOLS_JIT / "trampoline.c", work)
208-
tasks.append(group.create_task(coro, name="trampoline"))
207+
coro = self._compile("shim", TOOLS_JIT / "shim.c", work)
208+
tasks.append(group.create_task(coro, name="shim"))
209209
template = TOOLS_JIT_TEMPLATE_C.read_text()
210210
for case, opname in cases_and_opnames:
211211
# Write out a copy of the template with *only* this case

Tools/jit/_writer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ def _dump_footer(
2323
yield " symbol_mask got_mask;"
2424
yield "} StencilGroup;"
2525
yield ""
26-
yield f"static const StencilGroup trampoline = {groups['trampoline'].as_c('trampoline')};"
26+
yield f"static const StencilGroup shim = {groups['shim'].as_c('shim')};"
2727
yield ""
2828
yield "static const StencilGroup stencil_groups[MAX_UOP_REGS_ID + 1] = {"
2929
for opname, group in sorted(groups.items()):
30-
if opname == "trampoline":
30+
if opname == "shim":
3131
continue
3232
yield f" [{opname}] = {group.as_c(opname)},"
3333
yield "};"
File renamed without changes.

0 commit comments

Comments
 (0)