Description
openedon Dec 30, 2022
It appears that something around backedge tracking broke somewhat recently (I'm assuming with pkgimages, but haven't bisected yet). In particular, changing Core.Compiler no longer gets picked up by Cthulhu. To reproduce, apply a patch to base/compiler, e.g.
diff --git a/base/compiler/abstractinterpretation.jl b/base/compiler/abstractinterpretation.jl
index b3e18a6ee7..fc8e2d1aee 100644
--- a/base/compiler/abstractinterpretation.jl
+++ b/base/compiler/abstractinterpretation.jl
@@ -547,6 +547,8 @@ function abstract_call_method(interp::AbstractInterpreter, method::Method, @nosp
return MethodCallResult(Any, false, false, nothing, Effects())
end
+ @show sig
+
# Limit argument type tuple growth of functions:
# look through the parents list to see if there's a call to the same method
# and from the same method.
This will not show up in Cthulhu:
julia> using Revise
julia> Revise.track(Core.Compiler)
julia> using Cthulhu
julia> @descend optimize=false sin(1.0)
[snip]
sin(x::T) where T<:Union{Float32, Float64} @ Base.Math special/trig.jl:29
However, if I force-reevaluate do_typeinf!
, it does show up:
julia> Core.eval(Cthulhu, quote
function do_typeinf!(interp::AbstractInterpreter, mi::MethodInstance)
result = InferenceResult(mi)
# we may want to handle the case when `InferenceState(...)` returns `nothing`,
# which indicates code generation of a `@generated` has been failed,
# and show it in the UI in some way ?
# branch on https://github.com/JuliaLang/julia/pull/42082
frame = @static hasmethod(InferenceState, (InferenceResult,Symbol,AbstractInterpreter)) ?
InferenceState(result, #=cache=# :global, interp)::InferenceState :
InferenceState(result, #=cached=# true, interp)::InferenceState
CC.typeinf(interp, frame)
return nothing
end
end)
julia> @descend optimize=false sin(1.);
:sig = Tuple{typeof(Base.abs), Float64}
:sig = Tuple{Type{Float64}, Base.Irrational{:π}}
:sig = Tuple{typeof(Base.:(/)), Float64, Int64}
:sig = Tuple{typeof(Base.promote), Float64, Int64}
:sig = Tuple{typeof(Base._promote), Float64, Int64}
This suggests that there is some cached version of do_typeinf!
that fails to notice the revision of the Core.Compiler method. @timholy any ideas - is this known?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment