Skip to content

Commit c3a12ae

Browse files
GH-125911: Rename big trampoline to "shim" (GH-126339)
1 parent 478a1c0 commit c3a12ae

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

Python/jit.c

+5-7
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ _PyJIT_Compile(_PyExecutorObject *executor, const _PyUOpInstruction trace[], siz
470470
size_t code_size = 0;
471471
size_t data_size = 0;
472472
jit_state state = {0};
473-
group = &trampoline;
473+
group = &shim;
474474
code_size += group->code_size;
475475
data_size += group->data_size;
476476
combine_symbol_mask(group->trampoline_mask, state.trampolines.mask);
@@ -507,12 +507,10 @@ _PyJIT_Compile(_PyExecutorObject *executor, const _PyUOpInstruction trace[], siz
507507
unsigned char *code = memory;
508508
unsigned char *data = memory + code_size;
509509
state.trampolines.mem = memory + code_size + data_size;
510-
// Compile the trampoline, which handles converting between the native
510+
// Compile the shim, which handles converting between the native
511511
// calling convention and the calling convention used by jitted code
512-
// (which may be different for efficiency reasons). On platforms where
513-
// we don't change calling conventions, the trampoline is empty and
514-
// nothing is emitted here:
515-
group = &trampoline;
512+
// (which may be different for efficiency reasons).
513+
group = &shim;
516514
group->emit(code, data, executor, NULL, &state);
517515
code += group->code_size;
518516
data += group->data_size;
@@ -536,7 +534,7 @@ _PyJIT_Compile(_PyExecutorObject *executor, const _PyUOpInstruction trace[], siz
536534
return -1;
537535
}
538536
executor->jit_code = memory;
539-
executor->jit_side_entry = memory + trampoline.code_size;
537+
executor->jit_side_entry = memory + shim.code_size;
540538
executor->jit_size = total_size;
541539
return 0;
542540
}

Tools/jit/_targets.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ async def _build_stencils(self) -> dict[str, _stencils.StencilGroup]:
154154
with tempfile.TemporaryDirectory() as tempdir:
155155
work = pathlib.Path(tempdir).resolve()
156156
async with asyncio.TaskGroup() as group:
157-
coro = self._compile("trampoline", TOOLS_JIT / "trampoline.c", work)
158-
tasks.append(group.create_task(coro, name="trampoline"))
157+
coro = self._compile("shim", TOOLS_JIT / "shim.c", work)
158+
tasks.append(group.create_task(coro, name="shim"))
159159
template = TOOLS_JIT_TEMPLATE_C.read_text()
160160
for case, opname in cases_and_opnames:
161161
# Write out a copy of the template with *only* this case

Tools/jit/_writer.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ def _dump_footer(
2222
yield " symbol_mask trampoline_mask;"
2323
yield "} StencilGroup;"
2424
yield ""
25-
yield f"static const StencilGroup trampoline = {groups['trampoline'].as_c('trampoline')};"
25+
yield f"static const StencilGroup shim = {groups['shim'].as_c('shim')};"
2626
yield ""
2727
yield "static const StencilGroup stencil_groups[MAX_UOP_ID + 1] = {"
2828
for opname, group in sorted(groups.items()):
29-
if opname == "trampoline":
29+
if opname == "shim":
3030
continue
3131
yield f" [{opname}] = {group.as_c(opname)},"
3232
yield "};"
File renamed without changes.

0 commit comments

Comments
 (0)