JIT: Rename trampoline.c to shim.c (#142974)

This commit is contained in:
Diego Russo 2025-12-19 14:39:41 +00:00 committed by GitHub
parent 4aef138325
commit 685272eb8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 17 additions and 17 deletions

View file

@ -1601,7 +1601,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
}
#ifdef _Py_TIER2
#ifdef _Py_JIT
_PyJitEntryFuncPtr _Py_jit_entry = _Py_LazyJitTrampoline;
_PyJitEntryFuncPtr _Py_jit_entry = _Py_LazyJitShim;
#else
_PyJitEntryFuncPtr _Py_jit_entry = _PyTier2Interpreter;
#endif
@ -1617,7 +1617,7 @@ _PyTier2Interpreter(
const _PyUOpInstruction *next_uop;
int oparg;
/* Set up "jit" state after entry from tier 1.
* This mimics what the jit trampoline function does. */
* This mimics what the jit shim function does. */
tstate->jit_exit = NULL;
_PyStackRef _tos_cache0 = PyStackRef_ZERO_BITS;
_PyStackRef _tos_cache1 = PyStackRef_ZERO_BITS;

View file

@ -672,20 +672,20 @@ _PyJIT_Compile(_PyExecutorObject *executor, const _PyUOpInstruction trace[], siz
return 0;
}
/* One-off compilation of the jit entry trampoline
/* One-off compilation of the jit entry shim
* We compile this once only as it effectively a normal
* function, but we need to use the JIT because it needs
* to understand the jit-specific calling convention.
*/
static _PyJitEntryFuncPtr
compile_trampoline(void)
compile_shim(void)
{
_PyExecutorObject dummy;
const StencilGroup *group;
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);
@ -707,7 +707,7 @@ compile_trampoline(void)
// 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).
group = &trampoline;
group = &shim;
group->emit(code, data, &dummy, NULL, &state);
code += group->code_size;
data += group->data_size;
@ -723,17 +723,17 @@ compile_trampoline(void)
static PyMutex lazy_jit_mutex = { 0 };
_Py_CODEUNIT *
_Py_LazyJitTrampoline(
_Py_LazyJitShim(
_PyExecutorObject *executor, _PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate
) {
PyMutex_Lock(&lazy_jit_mutex);
if (_Py_jit_entry == _Py_LazyJitTrampoline) {
_PyJitEntryFuncPtr trampoline = compile_trampoline();
if (trampoline == NULL) {
if (_Py_jit_entry == _Py_LazyJitShim) {
_PyJitEntryFuncPtr shim = compile_shim();
if (shim == NULL) {
PyMutex_Unlock(&lazy_jit_mutex);
Py_FatalError("Cannot allocate core JIT code");
}
_Py_jit_entry = trampoline;
_Py_jit_entry = shim;
}
PyMutex_Unlock(&lazy_jit_mutex);
return _Py_jit_entry(executor, frame, stack_pointer, tstate);

View file

@ -490,7 +490,7 @@ static inline int check_interpreter_whence(long);
#endif
extern _Py_CODEUNIT *
_Py_LazyJitTrampoline(
_Py_LazyJitShim(
struct _PyExecutorObject *exec, _PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate
);