diff --git a/base/compiler/abstractinterpretation.jl b/base/compiler/abstractinterpretation.jl index 45f4dea1e46e1..00bd8a9310de7 100644 --- a/base/compiler/abstractinterpretation.jl +++ b/base/compiler/abstractinterpretation.jl @@ -689,6 +689,10 @@ function edge_matches_sv(interp::AbstractInterpreter, frame::AbsIntState, if callee_method2 !== inf_method2 return false end + if isa(frame, InferenceState) && cache_owner(frame.interp) !== cache_owner(interp) + # Don't assume that frames in different interpreters are the same + return false + end if !hardlimit || InferenceParams(interp).ignore_recursion_hardlimit # if this is a soft limit, # also inspect the parent of this edge, diff --git a/base/compiler/inferencestate.jl b/base/compiler/inferencestate.jl index 60e55b8ad2cf0..d4c4d94b6db31 100644 --- a/base/compiler/inferencestate.jl +++ b/base/compiler/inferencestate.jl @@ -731,7 +731,16 @@ function empty_backedges!(frame::InferenceState, currpc::Int=frame.currpc) end function print_callstack(sv::InferenceState) + print("=================== Callstack: ==================\n") + idx = 0 while sv !== nothing + print("[") + print(idx) + if !isa(sv.interp, NativeInterpreter) + print(", ") + print(typeof(sv.interp)) + end + print("] ") print(sv.linfo) is_cached(sv) || print(" [uncached]") println() @@ -740,7 +749,9 @@ function print_callstack(sv::InferenceState) println() end sv = sv.parent + idx += 1 end + print("================= End callstack ==================\n") end function narguments(sv::InferenceState, include_va::Bool=true) diff --git a/base/compiler/typeinfer.jl b/base/compiler/typeinfer.jl index b659fc2a88e6c..3ec9c1a3811ed 100644 --- a/base/compiler/typeinfer.jl +++ b/base/compiler/typeinfer.jl @@ -746,7 +746,7 @@ function merge_call_chain!(interp::AbstractInterpreter, parent::InferenceState, end function is_same_frame(interp::AbstractInterpreter, mi::MethodInstance, frame::InferenceState) - return mi === frame_instance(frame) + return mi === frame_instance(frame) && cache_owner(interp) === cache_owner(frame.interp) end function poison_callstack!(infstate::InferenceState, topmost::InferenceState) diff --git a/base/show.jl b/base/show.jl index df429830b16fd..33832f898d240 100644 --- a/base/show.jl +++ b/base/show.jl @@ -2888,6 +2888,12 @@ show(io::IO, ::Core.Compiler.NativeInterpreter) = show(io::IO, cache::Core.Compiler.CachedMethodTable) = print(io, typeof(cache), "(", Core.Compiler.length(cache.cache), " entries)") +function show(io::IO, limited::Core.Compiler.LimitedAccuracy) + print(io, "Core.Compiler.LimitedAccuracy(") + show(io, limited.typ) + print(io, ", #= ", Core.Compiler.length(limited.causes), " cause(s) =#)") +end + function dump(io::IOContext, x::SimpleVector, n::Int, indent) if isempty(x) print(io, "empty SimpleVector")