Skip to content

[main] codegen: propagate caller GC stack argument to JIT ABI converter#62348

Open
wsmoses wants to merge 1 commit into
masterfrom
wm/ccm-master
Open

[main] codegen: propagate caller GC stack argument to JIT ABI converter#62348
wsmoses wants to merge 1 commit into
masterfrom
wm/ccm-master

Conversation

@wsmoses

@wsmoses wsmoses commented Jul 12, 2026

Copy link
Copy Markdown
Member

When calling specializations using the JIT ABI converter on master, the caller's GC stack expectations were not fully propagated to the JIT converter, causing calling convention mismatches and segfaults.

This change updates the JIT ABI converter to correctly track and configure the GC stack argument:

  • Add gcstack_arg field to jl_abi_t to hold the caller's GC stack expectations.
  • Update jl_get_abi_converter in runtime_ccall.c to extract gcstack_arg from cfuncdata->flags and populate it in jl_abi_t.
  • Update jl_jit_abi_converter_impl in jitlayers.cpp to use the passed from_abi.gcstack_arg to configure out.params->gcstack_arg.
  • Ensure we do not bypass wrapper generation if the compiled method's GC stack expectations do not match the caller's.
  • Propagate target_gcstack_arg to emit_abi_converter and configure codegen parameters accordingly.

main version of https://github.com/JuliaLang/julia/pull/62346/changes (1.12) / #62347 (1.13)

Julia 1.10 & 1.11: The JIT ABI converter architecture (jl_jit_abi_converter and associated logic) was not yet introduced in these versions. Therefore, Julia 1.10 and 1.11 are not affected by this bug and do not require this JIT fix.

Written with gemini

cc @ChrisRackauckas @vchuravy @gbaraldi @oscardssmith

When calling specializations using the JIT ABI converter on master, the caller's GC stack expectations were not fully propagated to the JIT converter, causing calling convention mismatches and segfaults.

This change updates the JIT ABI converter to correctly track and configure the GC stack argument:
- Add `gcstack_arg` field to `jl_abi_t` to hold the caller's GC stack expectations.
- Update `jl_get_abi_converter` in `runtime_ccall.c` to extract `gcstack_arg` from `cfuncdata->flags` and populate it in `jl_abi_t`.
- Update `jl_jit_abi_converter_impl` in `jitlayers.cpp` to use the passed `from_abi.gcstack_arg` to configure `out.params->gcstack_arg`.
- Ensure we do not bypass wrapper generation if the compiled method's GC stack expectations do not match the caller's.
- Propagate `target_gcstack_arg` to `emit_abi_converter` and configure codegen parameters accordingly.
@wsmoses wsmoses changed the title codegen: propagate caller GC stack argument to JIT ABI converter [main] codegen: propagate caller GC stack argument to JIT ABI converter Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant