Skip to content

Commit f894db5

Browse files
authored
1 parent 6a651c5 commit f894db5

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/stage2/interpreter.jl

+11-2
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,14 @@ end
276276
# TODO: `get_remarks` should get a cursor?
277277
#Cthulhu.get_remarks(interp::ADInterpreter, key::Union{MethodInstance,InferenceResult}) = get(interp.remarks[interp.current_level], key, nothing)
278278

279-
@static if VERSION v"1.13.0-DEV.126"
279+
@static if VERSION v"1.13-"
280+
function diffractor_finish(@specialize(finishfunc), state::InferenceState, interp::ADInterpreter, cycleid::Int, opt_cache::IdDict{MethodInstance, CodeInstance})
281+
res = @invoke finishfunc(state::InferenceState, interp::AbstractInterpreter, cycleid::Int, opt_cache::IdDict{MethodInstance, CodeInstance})
282+
key = CC.is_constproped(state) ? state.result : state.linfo
283+
interp.unopt[interp.current_level][key] = Cthulhu.InferredSource(state)
284+
return res
285+
end
286+
elseif VERSION v"1.12-"
280287
function diffractor_finish(@specialize(finishfunc), state::InferenceState, interp::ADInterpreter, cycleid::Int)
281288
res = @invoke finishfunc(state::InferenceState, interp::AbstractInterpreter, cycleid::Int)
282289
key = CC.is_constproped(state) ? state.result : state.linfo
@@ -292,7 +299,9 @@ function diffractor_finish(@specialize(finishfunc), state::InferenceState, inter
292299
end
293300
end
294301

295-
@static if VERSION v"1.12-"
302+
@static if VERSION v"1.13-"
303+
CC.finishinfer!(state::InferenceState, interp::ADInterpreter, cycleid::Int, opt_cache::IdDict{MethodInstance, CodeInstance}) = diffractor_finish(CC.finishinfer!, state, interp, cycleid, opt_cache)
304+
elseif VERSION v"1.12-"
296305
CC.finishinfer!(state::InferenceState, interp::ADInterpreter, cycleid::Int) = diffractor_finish(CC.finishinfer!, state, interp, cycleid)
297306
function CC.finish!(interp::ADInterpreter, caller::InferenceState, validation_world::UInt, time_before::UInt64)
298307
Cthulhu.set_cthulhu_source!(caller.result)

0 commit comments

Comments
 (0)