@@ -431,7 +431,7 @@ function cycle_fix_limited(@nospecialize(typ), sv::InferenceState)
431431end
432432
433433function adjust_effects (sv:: InferenceState )
434- ipo_effects = Effects (sv)
434+ ipo_effects = sv . ipo_effects
435435
436436 # refine :consistent-cy effect using the return type information
437437 # TODO this adjustment tries to compromise imprecise :consistent-cy information,
@@ -577,7 +577,7 @@ function store_backedges(frame::MethodInstance, edges::Vector{Any})
577577 if isa (caller, MethodInstance)
578578 ccall (:jl_method_instance_add_backedge , Cvoid, (Any, Any, Any), caller, sig, frame)
579579 else
580- typeassert (caller, Core . MethodTable)
580+ typeassert (caller, MethodTable)
581581 ccall (:jl_method_table_add_backedge , Cvoid, (Any, Any, Any), caller, sig, frame)
582582 end
583583 end
@@ -792,28 +792,28 @@ function merge_call_chain!(interp::AbstractInterpreter, parent::InferenceState,
792792 end
793793end
794794
795- function is_same_frame (interp:: AbstractInterpreter , linfo :: MethodInstance , frame:: InferenceState )
796- return linfo === frame. linfo
795+ function is_same_frame (interp:: AbstractInterpreter , mi :: MethodInstance , frame:: InferenceState )
796+ return mi === frame. linfo
797797end
798798
799799function poison_callstack (infstate:: InferenceState , topmost:: InferenceState )
800800 push! (infstate. pclimitations, topmost)
801801 nothing
802802end
803803
804- # Walk through `linfo `'s upstream call chain, starting at `parent`. If a parent
805- # frame matching `linfo ` is encountered, then there is a cycle in the call graph
806- # (i.e. `linfo ` is a descendant callee of itself). Upon encountering this cycle,
804+ # Walk through `mi `'s upstream call chain, starting at `parent`. If a parent
805+ # frame matching `mi ` is encountered, then there is a cycle in the call graph
806+ # (i.e. `mi ` is a descendant callee of itself). Upon encountering this cycle,
807807# we "resolve" it by merging the call chain, which entails unioning each intermediary
808808# frame's `callers_in_cycle` field and adding the appropriate backedges. Finally,
809- # we return `linfo `'s pre-existing frame. If no cycles are found, `nothing` is
809+ # we return `mi `'s pre-existing frame. If no cycles are found, `nothing` is
810810# returned instead.
811- function resolve_call_cycle! (interp:: AbstractInterpreter , linfo :: MethodInstance , parent:: InferenceState )
811+ function resolve_call_cycle! (interp:: AbstractInterpreter , mi :: MethodInstance , parent:: InferenceState )
812812 frame = parent
813813 uncached = false
814814 while isa (frame, InferenceState)
815815 uncached |= ! frame. cached # ensure we never add an uncached frame to a cycle
816- if is_same_frame (interp, linfo , frame)
816+ if is_same_frame (interp, mi , frame)
817817 if uncached
818818 # our attempt to speculate into a constant call lead to an undesired self-cycle
819819 # that cannot be converged: poison our call-stack (up to the discovered duplicate frame)
@@ -825,7 +825,7 @@ function resolve_call_cycle!(interp::AbstractInterpreter, linfo::MethodInstance,
825825 return frame
826826 end
827827 for caller in frame. callers_in_cycle
828- if is_same_frame (interp, linfo , caller)
828+ if is_same_frame (interp, mi , caller)
829829 if uncached
830830 poison_callstack (parent, frame)
831831 return true
@@ -916,16 +916,16 @@ function typeinf_edge(interp::AbstractInterpreter, method::Method, @nospecialize
916916 frame. parent = caller
917917 end
918918 typeinf (interp, frame)
919- update_valid_age! (frame, caller )
919+ update_valid_age! (caller, frame . valid_worlds )
920920 edge = is_inferred (frame) ? mi : nothing
921- return EdgeCallResult (frame. bestguess, edge, Effects ( frame) ) # effects are adjusted already within `finish`
921+ return EdgeCallResult (frame. bestguess, edge, frame. ipo_effects ) # effects are adjusted already within `finish`
922922 elseif frame === true
923923 # unresolvable cycle
924924 return EdgeCallResult (Any, nothing , Effects ())
925925 end
926926 # return the current knowledge about this cycle
927927 frame = frame:: InferenceState
928- update_valid_age! (frame, caller )
928+ update_valid_age! (caller, frame . valid_worlds )
929929 return EdgeCallResult (frame. bestguess, nothing , adjust_effects (frame))
930930end
931931
0 commit comments