Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-115802: Use the GHC calling convention in JIT code #118287

Merged
merged 11 commits into from
May 1, 2024
Prev Previous commit
Clarify a few comments
  • Loading branch information
brandtbucher committed May 1, 2024
commit d03f22741981e4c1ffc054490a2a98a522164236
7 changes: 5 additions & 2 deletions Python/jit.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,11 @@ _PyJIT_Compile(_PyExecutorObject *executor, const _PyUOpInstruction *trace, size
unsigned char *code = memory;
unsigned char *data = memory + code_size;
{
// Compile the trampoline, which handles changing the calling convention
// (on platforms where it's not necessary, the trampoline is empty):
// Compile the trampoline, 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:
const StencilGroup *group = &trampoline;
// Think of patches as a dictionary mapping HoleValue to uintptr_t:
uintptr_t patches[] = GET_PATCHES();
savannahostrowski marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
1 change: 1 addition & 0 deletions Tools/jit/_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ def _handle_relocation(

def get_target(host: str) -> _COFF | _ELF | _MachO:
"""Build a _Target for the given host "triple" and options."""
# ghccc currently crashes Clang when combined with musttail on aarch64. :(
if re.fullmatch(r"aarch64-apple-darwin.*", host):
return _MachO(host, alignment=8, prefix="_")
if re.fullmatch(r"aarch64-pc-windows-msvc", host):
Expand Down
Loading