]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-125911: Rename big trampoline to "shim" (GH-126339)
authorSavannah Ostrowski <savannahostrowski@gmail.com>
Tue, 5 Nov 2024 23:26:46 +0000 (15:26 -0800)
committerGitHub <noreply@github.com>
Tue, 5 Nov 2024 23:26:46 +0000 (15:26 -0800)
Python/jit.c
Tools/jit/_targets.py
Tools/jit/_writer.py
Tools/jit/shim.c [moved from Tools/jit/trampoline.c with 100% similarity]

index 135daeb1b1da80851d0bd07d860bddb26a3a614d..90f693dfb7c41b91d6d36d41c65daccd5e31c3f0 100644 (file)
@@ -470,7 +470,7 @@ _PyJIT_Compile(_PyExecutorObject *executor, const _PyUOpInstruction trace[], siz
     size_t code_size = 0;
     size_t data_size = 0;
     jit_state state = {0};
-    group = &trampoline;
+    group = &shim;
     code_size += group->code_size;
     data_size += group->data_size;
     combine_symbol_mask(group->trampoline_mask, state.trampolines.mask);
@@ -507,12 +507,10 @@ _PyJIT_Compile(_PyExecutorObject *executor, const _PyUOpInstruction trace[], siz
     unsigned char *code = memory;
     unsigned char *data = memory + code_size;
     state.trampolines.mem = memory + code_size + data_size;
-    // Compile the trampoline, which handles converting between the native
+    // Compile the shim, which handles converting between the native
     // calling convention and the calling convention used by jitted code
-    // (which may be different for efficiency reasons). On platforms where
-    // we don't change calling conventions, the trampoline is empty and
-    // nothing is emitted here:
-    group = &trampoline;
+    // (which may be different for efficiency reasons).
+    group = &shim;
     group->emit(code, data, executor, NULL, &state);
     code += group->code_size;
     data += group->data_size;
@@ -536,7 +534,7 @@ _PyJIT_Compile(_PyExecutorObject *executor, const _PyUOpInstruction trace[], siz
         return -1;
     }
     executor->jit_code = memory;
-    executor->jit_side_entry = memory + trampoline.code_size;
+    executor->jit_side_entry = memory + shim.code_size;
     executor->jit_size = total_size;
     return 0;
 }
index 634208da3c8157a57aee92c84bdd038fc9c9e806..d8dce0a905c0f8501f6bed8be2f2db19da3fc47b 100644 (file)
@@ -154,8 +154,8 @@ class _Target(typing.Generic[_S, _R]):
         with tempfile.TemporaryDirectory() as tempdir:
             work = pathlib.Path(tempdir).resolve()
             async with asyncio.TaskGroup() as group:
-                coro = self._compile("trampoline", TOOLS_JIT / "trampoline.c", work)
-                tasks.append(group.create_task(coro, name="trampoline"))
+                coro = self._compile("shim", TOOLS_JIT / "shim.c", work)
+                tasks.append(group.create_task(coro, name="shim"))
                 template = TOOLS_JIT_TEMPLATE_C.read_text()
                 for case, opname in cases_and_opnames:
                     # Write out a copy of the template with *only* this case
index f33d8ef322f0736f914ceeaee6a36a353ecd251f..81a9f08db31703a3262f45b7c1ecba6bd9f964dc 100644 (file)
@@ -22,11 +22,11 @@ def _dump_footer(
     yield "    symbol_mask trampoline_mask;"
     yield "} StencilGroup;"
     yield ""
-    yield f"static const StencilGroup trampoline = {groups['trampoline'].as_c('trampoline')};"
+    yield f"static const StencilGroup shim = {groups['shim'].as_c('shim')};"
     yield ""
     yield "static const StencilGroup stencil_groups[MAX_UOP_ID + 1] = {"
     for opname, group in sorted(groups.items()):
-        if opname == "trampoline":
+        if opname == "shim":
             continue
         yield f"    [{opname}] = {group.as_c(opname)},"
     yield "};"
similarity index 100%
rename from Tools/jit/trampoline.c
rename to Tools/jit/shim.c