codegen: pin call-target CodeInstances that are not cache-reachable #62468
All Vouch review confidence checks passed
Residual risk 0.03 = Change Risk (0.23) × (1 − Review Confidence (0.87)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.23 · 8 lines diff across 1 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.89 · 3 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.131
Real PR Conversation Timeline
4 items
This is that discussion we had a while back where these CIs are never put into caches but codegen expects them too @xal-0. Not sure if this is the best way
The jl_is_globally_rooted call is redundant.
I would like a better explanation of why we produce these invokes now (since #61915?). We know the target of invokes need to be rooted before being added to the JIT, but why are we getting these in the first place?
xal-0
gbaraldi
The linking metadata of an emitted module holds raw pointers to its
call-target CodeInstances, and JuliaOJIT::linkCallTarget dereferences
them when the module is materialized. Compiler.add_codeinsts_to_jit!
maintains the rooting invariant by cache-inserting the CIs it compiles,
but callees with invalid ABI sparams are skipped without rooting while
the caller still records them as call targets. Upstream the pending
window is a few statements (materialization happens within the same
jl_compile_method_internal call); under tiered batching, materialization
is deferred to the compiled code's first call, so the collected CI is
dereferenced on a JIT dispatcher thread arbitrarily later. Observed at
test/core.jl's issue-#47476 tests (exactly the invalid-sparams shape) on
both macOS architectures:
https://buildkite.com/julialang/julia-pr/builds/316#019f4d6f-5f10-406d-9aff-2bdb6bc7717f
Pin such CIs as global roots at emission. TODO: scope the root to the
pending materialization instead.
This commit was written with the assistance of generative AI (Claude).