@@ -28,7 +28,7 @@ function abstract_call_gf_by_type(interp::AbstractInterpreter, @nospecialize(f),
28
28
return CallMeta (Any, Effects (), NoCallInfo ())
29
29
end
30
30
31
- (; valid_worlds, applicable, info) = matches
31
+ (; valid_worlds, applicable, info, nonoverlayed ) = matches
32
32
update_valid_age! (sv, valid_worlds)
33
33
napplicable = length (applicable)
34
34
rettype = Bottom
@@ -39,13 +39,7 @@ function abstract_call_gf_by_type(interp::AbstractInterpreter, @nospecialize(f),
39
39
const_results = Union{Nothing,ConstResult}[]
40
40
multiple_matches = napplicable > 1
41
41
fargs = arginfo. fargs
42
- all_effects = EFFECTS_TOTAL
43
- if ! matches. nonoverlayed
44
- # currently we don't have a good way to execute the overlayed method definition,
45
- # so we should give up concrete eval when any of the matched methods is overlayed
46
- f = nothing
47
- all_effects = Effects (all_effects; nonoverlayed= false )
48
- end
42
+ all_effects = Effects (EFFECTS_TOTAL; nonoverlayed)
49
43
50
44
𝕃ₚ = ipo_lattice (interp)
51
45
for i in 1 : napplicable
@@ -792,7 +786,7 @@ function abstract_call_method_with_const_args(interp::AbstractInterpreter,
792
786
end
793
787
eligibility = concrete_eval_eligible (interp, f, result, arginfo, sv)
794
788
if eligibility === :concrete_eval
795
- return concrete_eval_call (interp, f, result, arginfo, sv, invokecall)
789
+ return concrete_eval_call (interp, f, result, arginfo, sv; invokecall)
796
790
end
797
791
mi = maybe_get_const_prop_profitable (interp, result, f, arginfo, si, match, sv)
798
792
mi === nothing && return nothing
@@ -848,16 +842,17 @@ function concrete_eval_eligible(interp::AbstractInterpreter,
848
842
add_remark! (interp, sv, " [constprop] Concrete evel disabled for inbounds" )
849
843
return :none
850
844
end
851
- if isoverlayed (method_table (interp)) && ! is_nonoverlayed (effects)
852
- # disable concrete-evaluation if this function call is tainted by some overlayed
853
- # method since currently there is no direct way to execute overlayed methods
854
- add_remark! (interp, sv, " [constprop] Concrete evel disabled for overlayed methods" )
855
- return :none
856
- end
857
- if result. edge != = nothing && is_foldable (effects)
845
+ mi = result. edge
846
+ if mi != = nothing && is_foldable (effects)
858
847
if f != = nothing && is_all_const_arg (arginfo, #= start=# 2 )
859
- return :concrete_eval
860
- elseif ! any_conditional (arginfo)
848
+ if is_nonoverlayed (mi. def:: Method ) && (! isoverlayed (method_table (interp)) || is_nonoverlayed (effects))
849
+ return :concrete_eval
850
+ end
851
+ # disable concrete-evaluation if this function call is tainted by some overlayed
852
+ # method since currently there is no easy way to execute overlayed methods
853
+ add_remark! (interp, sv, " [constprop] Concrete evel disabled for overlayed methods" )
854
+ end
855
+ if ! any_conditional (arginfo)
861
856
return :semi_concrete_eval
862
857
end
863
858
end
@@ -886,8 +881,8 @@ function collect_const_args(argtypes::Vector{Any}, start::Int)
886
881
end
887
882
888
883
function concrete_eval_call (interp:: AbstractInterpreter ,
889
- @nospecialize (f), result:: MethodCallResult , arginfo:: ArgInfo ,
890
- sv :: AbsIntState , invokecall:: Union{InvokeCall,Nothing} )
884
+ @nospecialize (f), result:: MethodCallResult , arginfo:: ArgInfo , sv :: AbsIntState ;
885
+ invokecall:: Union{InvokeCall,Nothing} = nothing )
891
886
args = collect_const_args (arginfo, #= start=# 2 )
892
887
if invokecall != = nothing
893
888
# this call should be `invoke`d, rewrite `args` back now
@@ -1923,7 +1918,7 @@ function abstract_invoke(interp::AbstractInterpreter, (; fargs, argtypes)::ArgIn
1923
1918
# argtypes′[i] = t ⊑ a ? t : a
1924
1919
# end
1925
1920
𝕃ₚ = ipo_lattice (interp)
1926
- f = overlayed ? nothing : singleton_type (ft′)
1921
+ f = singleton_type (ft′)
1927
1922
invokecall = InvokeCall (types, lookupsig)
1928
1923
const_call_result = abstract_call_method_with_const_args (interp,
1929
1924
result, f, arginfo, si, match, sv, invokecall)
@@ -1934,7 +1929,7 @@ function abstract_invoke(interp::AbstractInterpreter, (; fargs, argtypes)::ArgIn
1934
1929
end
1935
1930
end
1936
1931
rt = from_interprocedural! (interp, rt, sv, arginfo, sig)
1937
- effects = Effects (effects; nonoverlayed= ! overlayed)
1932
+ effects = Effects (effects; nonoverlayed = ! overlayed)
1938
1933
info = InvokeCallInfo (match, const_result)
1939
1934
edge != = nothing && add_invoke_backedge! (sv, lookupsig, edge)
1940
1935
return CallMeta (rt, effects, info)
0 commit comments