diff --git a/Project.toml b/Project.toml index 2f60d40a..f7bac45f 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "Cthulhu" uuid = "f68482b8-f384-11e8-15f7-abe071a5a75f" -version = "2.16.3" +version = "2.16.4" authors = ["Valentin Churavy and contributors"] [deps] diff --git a/src/interpreter.jl b/src/interpreter.jl index 6b3aaf31..f8075571 100644 --- a/src/interpreter.jl +++ b/src/interpreter.jl @@ -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 @@ -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)