[main] codegen: propagate caller GC stack argument to JIT ABI converter#62348
Open
wsmoses wants to merge 1 commit into
Open
[main] codegen: propagate caller GC stack argument to JIT ABI converter#62348wsmoses wants to merge 1 commit into
wsmoses wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
gcstack_argfield tojl_abi_tto hold the caller's GC stack expectations.jl_get_abi_converterinruntime_ccall.cto extractgcstack_argfromcfuncdata->flagsand populate it injl_abi_t.jl_jit_abi_converter_implinjitlayers.cppto use the passedfrom_abi.gcstack_argto configureout.params->gcstack_arg.target_gcstack_argtoemit_abi_converterand 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