Skip to content

Commit a7aae3c

Browse files
committed
adjustments
1 parent 0e0350b commit a7aae3c

File tree

4 files changed

+20
-30
lines changed

4 files changed

+20
-30
lines changed

base/compiler/abstractinterpretation.jl

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -275,12 +275,6 @@ any_ambig(info::MethodMatchInfo) = any_ambig(info.results)
275275
any_ambig(m::MethodMatches) = any_ambig(m.info)
276276
fully_covering(info::MethodMatchInfo) = info.fullmatch
277277
fully_covering(m::MethodMatches) = fully_covering(m.info)
278-
function add_uncovered_edges!(sv::AbsIntState, info::MethodMatchInfo, @nospecialize(atype))
279-
fully_covering(info) || add_mt_backedge!(sv, info.mt, atype)
280-
nothing
281-
end
282-
add_uncovered_edges!(sv::AbsIntState, matches::MethodMatches, @nospecialize(atype)) =
283-
add_uncovered_edges!(sv, matches.info, atype)
284278

285279
struct UnionSplitMethodMatches
286280
applicable::Vector{Any}
@@ -292,24 +286,6 @@ any_ambig(info::UnionSplitInfo) = any(any_ambig, info.split)
292286
any_ambig(m::UnionSplitMethodMatches) = any_ambig(m.info)
293287
fully_covering(info::UnionSplitInfo) = all(fully_covering, info.split)
294288
fully_covering(m::UnionSplitMethodMatches) = fully_covering(m.info)
295-
function add_uncovered_edges!(sv::AbsIntState, info::UnionSplitInfo, @nospecialize(atype))
296-
all(fully_covering, info.split) && return nothing
297-
# add mt backedges with removing duplications
298-
for mt in uncovered_method_tables(info)
299-
add_mt_backedge!(sv, mt, atype)
300-
end
301-
end
302-
add_uncovered_edges!(sv::AbsIntState, matches::UnionSplitMethodMatches, @nospecialize(atype)) =
303-
add_uncovered_edges!(sv, matches.info, atype)
304-
function uncovered_method_tables(info::UnionSplitInfo)
305-
mts = MethodTable[]
306-
for mminfo in info.split
307-
fully_covering(mminfo) && continue
308-
any(mt′::MethodTable->mt′===mminfo.mt, mts) && continue
309-
push!(mts, mminfo.mt)
310-
end
311-
return mts
312-
end
313289

314290
function find_method_matches(interp::AbstractInterpreter, argtypes::Vector{Any}, @nospecialize(atype);
315291
max_union_splitting::Int = InferenceParams(interp).max_union_splitting,

base/compiler/stmtinfo.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@ function add_uncovered_edges_impl(edges::Vector{Any}, info::UnionSplitInfo, @nos
7676
push!(edges, mt, atype)
7777
end
7878
end
79+
function uncovered_method_tables(info::UnionSplitInfo)
80+
mts = MethodTable[]
81+
for mminfo in info.split
82+
fully_covering(mminfo) && continue
83+
any(mt′::MethodTable->mt′===mminfo.mt, mts) && continue
84+
push!(mts, mminfo.mt)
85+
end
86+
return mts
87+
end
7988

8089
abstract type ConstResult end
8190

base/compiler/tfuncs.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3024,7 +3024,10 @@ function _hasmethod_tfunc(interp::AbstractInterpreter, argtypes::Vector{Any}, sv
30243024
update_valid_age!(sv, valid_worlds)
30253025
if match === nothing
30263026
rt = Const(false)
3027-
add_edges!(sv.edges, MethodMatchInfo(MethodLookupResult(Any[], valid_worlds, true), types, mt)) # XXX: this should actually be an invoke-type backedge
3027+
let vresults = MethodLookupResult(Any[], valid_worlds, true)
3028+
vinfo = MethodMatchInfo(vresults, mt, types, false)
3029+
add_edges!(sv.edges, vinfo) # XXX: this should actually be an invoke-type backedge
3030+
end
30283031
else
30293032
rt = Const(true)
30303033
add_edges!(sv.edges, InvokeCallInfo(match, nothing, types))

base/compiler/typeinfer.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -662,13 +662,15 @@ function add_edges!(edges::Vector{Any}, info::ApplyCallInfo)
662662
end
663663
end
664664
add_edges!(edges::Vector{Any}, info::ModifyOpInfo) = add_edges!(edges, info.info)
665-
add_edges!(edges::Vector{Any}, info::UnionSplitInfo) = for split in info.matches; add_edges!(edges, split); end
666-
add_edges!(edges::Vector{Any}, info::UnionSplitApplyCallInfo) = for split in info.infos; add_edges!(edges, split); end
665+
add_edges!(edges::Vector{Any}, info::UnionSplitInfo) =
666+
for split in info.split; add_edges!(edges, split); end
667+
add_edges!(edges::Vector{Any}, info::UnionSplitApplyCallInfo) =
668+
for split in info.infos; add_edges!(edges, split); end
667669
add_edges!(edges::Vector{Any}, info::FinalizerInfo) = nothing # merely allocating a finalizer does not imply edges (unless it gets inlined later)
668670
add_edges!(edges::Vector{Any}, info::NoCallInfo) = nothing
669671
function add_edges!(edges::Vector{Any}, info::MethodMatchInfo)
670672
matches = info.results.matches
671-
if isempty(matches) || !(matches[end]::Core.MethodMatch).fully_covers
673+
if !fully_covering(info)
672674
# add legacy-style missing backedge info also
673675
exists = false
674676
for i in 1:length(edges)
@@ -690,13 +692,13 @@ function add_edges!(edges::Vector{Any}, info::MethodMatchInfo)
690692
mi = specialize_method(m)
691693
if mi.specTypes === m.spec_types
692694
add_one_edge!(edges, mi)
693-
return
695+
return nothing
694696
end
695697
end
696698
# add check for whether this lookup already existed in the edges list
697699
for i in 1:length(edges)
698700
if edges[i] === length(matches) && edges[i + 1] == info.atype
699-
return
701+
return nothing
700702
end
701703
end
702704
push!(edges, length(matches))

0 commit comments

Comments
 (0)