diff --git a/base/compiler/abstractinterpretation.jl b/base/compiler/abstractinterpretation.jl index 2a80316be6a99..51bb7a166f019 100644 --- a/base/compiler/abstractinterpretation.jl +++ b/base/compiler/abstractinterpretation.jl @@ -1257,8 +1257,15 @@ function abstract_eval_ssavalue(s::SSAValue, src::CodeInfo) return typ end +const __collect_inference_callees__ = fill(false) # Singleton Unary Array since Ref isn't available yet +#const __inference_callees__ = Vector{MethodInstance}() + # make as much progress on `frame` as possible (without handling cycles) function typeinf_local(interp::AbstractInterpreter, frame::InferenceState) + #if __collect_inference_callees__[] + # push!(__inference_callees__, frame.linfo) + #end + @assert !frame.inferred frame.dont_work_on_me = true # mark that this function is currently on the stack W = frame.ip diff --git a/base/compiler/typeinfer.jl b/base/compiler/typeinfer.jl index 01d1311a80b5c..a0abd97276188 100644 --- a/base/compiler/typeinfer.jl +++ b/base/compiler/typeinfer.jl @@ -497,6 +497,8 @@ function resolve_call_cycle!(interp::AbstractInterpreter, linfo::MethodInstance, return false end +const __inference_callee_edges4__ = Vector{Tuple{MethodInstance, Vector{Tuple{MethodInstance,MethodInstance}}}}() + # compute (and cache) an inferred AST and return the current best estimate of the result type function typeinf_edge(interp::AbstractInterpreter, method::Method, @nospecialize(atypes), sparams::SimpleVector, caller::InferenceState) mi = specialize_method(method, atypes, sparams)::MethodInstance @@ -533,6 +535,11 @@ function typeinf_edge(interp::AbstractInterpreter, method::Method, @nospecialize if caller.cached || caller.limited # don't involve uncached functions in cycle resolution frame.parent = caller end + if __collect_inference_callees__[] + #Core.println("edge!") + #Core.println(__inference_callee_edges4__) + push!(__inference_callee_edges4__[end][2], (caller.linfo, frame.linfo)) + end typeinf(interp, frame) update_valid_age!(frame, caller) return widenconst_bestguess(frame.bestguess), frame.inferred ? mi : nothing