Skip to content

Commit 885d4f4

Browse files
authored
Always set result.src to the result of transform_result_for_cache (#58083)
Inlining can look at `result.src` for things that are put in the global cache via the `VolatileInferenceResult` mechanism. As a result, we need to appropriately update the reference here or inlining will see un-transformed (and thus potentially garbage) objects. The dataflow here is quite confusing and should undergo a larger refactor, but this fixes the immediate issue.
1 parent 1aeb1b0 commit 885d4f4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Compiler/src/typeinfer.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,11 @@ function finish!(interp::AbstractInterpreter, caller::InferenceState, validation
127127
if inferred_result !== nothing
128128
uncompressed = inferred_result
129129
debuginfo = get_debuginfo(inferred_result)
130+
# Inlining may fast-path the global cache via `VolatileInferenceResult`, so store it back here
131+
result.src = inferred_result
130132
end
131133
# TODO: do we want to augment edges here with any :invoke targets that we got from inlining (such that we didn't have a direct edge to it already)?
132134
if inferred_result isa CodeInfo
133-
result.src = inferred_result
134135
if may_compress(interp)
135136
nslots = length(inferred_result.slotflags)
136137
resize!(inferred_result.slottypes::Vector{Any}, nslots)

0 commit comments

Comments
 (0)