Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Cthulhu"
uuid = "f68482b8-f384-11e8-15f7-abe071a5a75f"
version = "2.16.3"
version = "2.16.4"
authors = ["Valentin Churavy <[email protected]> and contributors"]

[deps]
Expand Down
14 changes: 14 additions & 0 deletions src/interpreter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,22 @@ function InferredSource(state::InferenceState)
exct)
end

@static if VERSION ≥ v"1.12.0-alpha1"
function cthulhu_finish(@specialize(finishfunc), state::InferenceState, interp::CthulhuInterpreter, cycleid::Int)
res = @invoke finishfunc(state::InferenceState, interp::AbstractInterpreter, cycleid::Int)
key = CC.is_constproped(state) ? state.result : state.linfo
interp.unopt[key] = InferredSource(state)
return res
end

else
function cthulhu_finish(@specialize(finishfunc), state::InferenceState, interp::CthulhuInterpreter)
res = @invoke finishfunc(state::InferenceState, interp::AbstractInterpreter)
key = (@static VERSION ≥ v"1.12.0-DEV.317" ? CC.is_constproped(state) : CC.any(state.result.overridden_by_const)) ? state.result : state.linfo
interp.unopt[key] = InferredSource(state)
return res
end
end

function create_cthulhu_source(@nospecialize(opt), effects::Effects)
isa(opt, OptimizationState) || return opt
Expand All @@ -129,7 +139,11 @@ function set_cthulhu_source!(result::InferenceResult)
end

@static if VERSION ≥ v"1.12.0-DEV.1823"
@static if VERSION ≥ v"1.12.0-alpha1"
CC.finishinfer!(state::InferenceState, interp::CthulhuInterpreter, cycleid::Int) = cthulhu_finish(CC.finishinfer!, state, interp, cycleid)
else
CC.finishinfer!(state::InferenceState, interp::CthulhuInterpreter) = cthulhu_finish(CC.finishinfer!, state, interp)
end
@static if VERSION ≥ v"1.12.0-DEV.1988"
function CC.finish!(interp::CthulhuInterpreter, caller::InferenceState, validation_world::UInt)
set_cthulhu_source!(caller.result)
Expand Down
Loading