@@ -247,7 +247,7 @@ mutable struct InferenceState
247247 # TODO : Could keep this sparsely by doing structural liveness analysis ahead of time.
248248 bb_vartables:: Vector{Union{Nothing,VarTable}} # nothing if not analyzed yet
249249 ssavaluetypes:: Vector{Any}
250- stmt_edges :: Vector{Vector{ Any} }
250+ edges :: Vector{Any}
251251 stmt_info:: Vector{CallInfo}
252252
253253 #= intermediate states for interprocedural abstract interpretation =#
@@ -301,7 +301,7 @@ mutable struct InferenceState
301301 nssavalues = src. ssavaluetypes:: Int
302302 ssavalue_uses = find_ssavalue_uses (code, nssavalues)
303303 nstmts = length (code)
304- stmt_edges = Vector {Vector{Any}} (undef, nstmts)
304+ edges = []
305305 stmt_info = CallInfo[ NoCallInfo () for i = 1 : nstmts ]
306306
307307 nslots = length (src. slotflags)
@@ -350,7 +350,7 @@ mutable struct InferenceState
350350
351351 this = new (
352352 mi, world, mod, sptypes, slottypes, src, cfg, method_info,
353- currbb, currpc, ip, handler_info, ssavalue_uses, bb_vartables, ssavaluetypes, stmt_edges , stmt_info,
353+ currbb, currpc, ip, handler_info, ssavalue_uses, bb_vartables, ssavaluetypes, edges , stmt_info,
354354 pclimitations, limitations, cycle_backedges, callstack, 0 , 0 , 0 ,
355355 result, unreachable, valid_worlds, bestguess, exc_bestguess, ipo_effects,
356356 restrict_abstract_call_sites, cache_mode, insert_coverage,
@@ -756,26 +756,9 @@ function add_cycle_backedge!(caller::InferenceState, frame::InferenceState)
756756 update_valid_age! (caller, frame. valid_worlds)
757757 backedge = (caller, caller. currpc)
758758 contains_is (frame. cycle_backedges, backedge) || push! (frame. cycle_backedges, backedge)
759- add_backedge! (caller, frame. linfo)
760759 return frame
761760end
762761
763- function get_stmt_edges! (caller:: InferenceState , currpc:: Int = caller. currpc)
764- stmt_edges = caller. stmt_edges
765- if ! isassigned (stmt_edges, currpc)
766- return stmt_edges[currpc] = Any[]
767- else
768- return stmt_edges[currpc]
769- end
770- end
771-
772- function empty_backedges! (frame:: InferenceState , currpc:: Int = frame. currpc)
773- if isassigned (frame. stmt_edges, currpc)
774- empty! (frame. stmt_edges[currpc])
775- end
776- return nothing
777- end
778-
779762function narguments (sv:: InferenceState , include_va:: Bool = true )
780763 nargs = Int (sv. src. nargs)
781764 if ! include_va
@@ -1001,32 +984,6 @@ function callers_in_cycle(sv::InferenceState)
1001984end
1002985callers_in_cycle (sv:: IRInterpretationState ) = AbsIntCycle (sv. callstack:: Vector{AbsIntState} , 0 , 0 )
1003986
1004- # temporarily accumulate our edges to later add as backedges in the callee
1005- function add_backedge! (caller:: InferenceState , mi:: MethodInstance )
1006- isa (caller. linfo. def, Method) || return nothing # don't add backedges to toplevel method instance
1007- return push! (get_stmt_edges! (caller), mi)
1008- end
1009- function add_backedge! (irsv:: IRInterpretationState , mi:: MethodInstance )
1010- return push! (irsv. edges, mi)
1011- end
1012-
1013- function add_invoke_backedge! (caller:: InferenceState , @nospecialize (invokesig:: Type ), mi:: MethodInstance )
1014- isa (caller. linfo. def, Method) || return nothing # don't add backedges to toplevel method instance
1015- return push! (get_stmt_edges! (caller), invokesig, mi)
1016- end
1017- function add_invoke_backedge! (irsv:: IRInterpretationState , @nospecialize (invokesig:: Type ), mi:: MethodInstance )
1018- return push! (irsv. edges, invokesig, mi)
1019- end
1020-
1021- # used to temporarily accumulate our no method errors to later add as backedges in the callee method table
1022- function add_mt_backedge! (caller:: InferenceState , mt:: MethodTable , @nospecialize (typ))
1023- isa (caller. linfo. def, Method) || return nothing # don't add backedges to toplevel method instance
1024- return push! (get_stmt_edges! (caller), mt, typ)
1025- end
1026- function add_mt_backedge! (irsv:: IRInterpretationState , mt:: MethodTable , @nospecialize (typ))
1027- return push! (irsv. edges, mt, typ)
1028- end
1029-
1030987get_curr_ssaflag (sv:: InferenceState ) = sv. src. ssaflags[sv. currpc]
1031988get_curr_ssaflag (sv:: IRInterpretationState ) = sv. ir. stmts[sv. curridx][:flag ]
1032989
0 commit comments