@@ -221,7 +221,7 @@ function abstract_call_gf_by_type(interp::AbstractInterpreter, @nospecialize(f),
221221 elseif isa (matches, MethodMatches) ? (! matches. fullmatch || any_ambig (matches)) :
222222 (! all (matches. fullmatches) || any_ambig (matches))
223223 # Account for the fact that we may encounter a MethodError with a non-covered or ambiguous signature.
224- all_effects = Effects (all_effects; nothrow= TRISTATE_UNKNOWN )
224+ all_effects = Effects (all_effects; nothrow= ALWAYS_FALSE )
225225 end
226226
227227 rettype = from_interprocedural! (rettype, sv, arginfo, conditionals)
@@ -619,7 +619,7 @@ function abstract_call_method(interp::AbstractInterpreter, method::Method, @nosp
619619 elseif edgecycle
620620 # Some sort of recursion was detected. Even if we did not limit types,
621621 # we cannot guarantee that the call will terminate
622- effects = Effects (effects; terminates= TRISTATE_UNKNOWN )
622+ effects = Effects (effects; terminates= ALWAYS_FALSE )
623623 end
624624
625625 return MethodCallResult (rt, edgecycle, edgelimited, edge, effects)
@@ -1769,7 +1769,7 @@ function abstract_call_opaque_closure(interp::AbstractInterpreter,
17691769 (aty, rty) = (unwrap_unionall (ftt):: DataType ). parameters
17701770 rty = rewrap_unionall (rty isa TypeVar ? rty. lb : rty, ftt)
17711771 if ! (rt ⊑ rty && tuple_tfunc (arginfo. argtypes[2 : end ]) ⊑ rewrap_unionall (aty, ftt))
1772- effects = Effects (effects; nothrow= TRISTATE_UNKNOWN )
1772+ effects = Effects (effects; nothrow= ALWAYS_FALSE )
17731773 end
17741774 end
17751775 rt = from_interprocedural! (rt, sv, arginfo, match. spec_types)
@@ -1953,9 +1953,7 @@ function abstract_eval_statement(interp::AbstractInterpreter, @nospecialize(e),
19531953 at = tmeet (at, ft)
19541954 if at === Bottom
19551955 t = Bottom
1956- tristate_merge! (sv, Effects (EFFECTS_TOTAL;
1957- # consistent = ALWAYS_TRUE, # N.B depends on !ismutabletype(t) above
1958- nothrow = TRISTATE_UNKNOWN))
1956+ tristate_merge! (sv, EFFECTS_THROWS)
19591957 @goto t_computed
19601958 elseif ! isa (at, Const)
19611959 allconst = false
@@ -1985,7 +1983,7 @@ function abstract_eval_statement(interp::AbstractInterpreter, @nospecialize(e),
19851983 end
19861984 tristate_merge! (sv, Effects (EFFECTS_TOTAL;
19871985 consistent = ! ismutabletype (t) ? ALWAYS_TRUE : TRISTATE_UNKNOWN,
1988- nothrow = is_nothrow ? ALWAYS_TRUE : TRISTATE_UNKNOWN ))
1986+ nothrow = is_nothrow ? ALWAYS_TRUE : ALWAYS_FALSE ))
19891987 elseif ehead === :splatnew
19901988 t, isexact = instanceof_tfunc (abstract_eval_value (interp, e. args[1 ], vtypes, sv))
19911989 is_nothrow = false # TODO : More precision
@@ -2003,8 +2001,8 @@ function abstract_eval_statement(interp::AbstractInterpreter, @nospecialize(e),
20032001 end
20042002 end
20052003 tristate_merge! (sv, Effects (EFFECTS_TOTAL;
2006- consistent = ismutabletype (t) ? TRISTATE_UNKNOWN : ALWAYS_TRUE ,
2007- nothrow = is_nothrow ? ALWAYS_TRUE : TRISTATE_UNKNOWN ))
2004+ consistent = ! ismutabletype (t) ? ALWAYS_TRUE : TRISTATE_UNKNOWN ,
2005+ nothrow = is_nothrow ? ALWAYS_TRUE : ALWAYS_FALSE ))
20082006 elseif ehead === :new_opaque_closure
20092007 tristate_merge! (sv, Effects ()) # TODO
20102008 t = Union{}
@@ -2040,12 +2038,12 @@ function abstract_eval_statement(interp::AbstractInterpreter, @nospecialize(e),
20402038 effects = v[2 ]
20412039 effects = decode_effects_override (effects)
20422040 tristate_merge! (sv, Effects (
2043- effects. consistent ? ALWAYS_TRUE : TRISTATE_UNKNOWN ,
2044- effects. effect_free ? ALWAYS_TRUE : TRISTATE_UNKNOWN ,
2045- effects. nothrow ? ALWAYS_TRUE : TRISTATE_UNKNOWN ,
2046- effects. terminates_globally ? ALWAYS_TRUE : TRISTATE_UNKNOWN ,
2041+ effects. consistent ? ALWAYS_TRUE : ALWAYS_FALSE ,
2042+ effects. effect_free ? ALWAYS_TRUE : ALWAYS_FALSE ,
2043+ effects. nothrow ? ALWAYS_TRUE : ALWAYS_FALSE ,
2044+ effects. terminates_globally ? ALWAYS_TRUE : ALWAYS_FALSE ,
20472045 #= nonoverlayed=# true ,
2048- effects. notaskstate ? ALWAYS_TRUE : TRISTATE_UNKNOWN
2046+ effects. notaskstate ? ALWAYS_TRUE : ALWAYS_FALSE
20492047 ))
20502048 else
20512049 tristate_merge! (sv, EFFECTS_UNKNOWN)
@@ -2127,20 +2125,20 @@ function abstract_eval_global(M::Module, s::Symbol, frame::InferenceState)
21272125 ty = abstract_eval_global (M, s)
21282126 isa (ty, Const) && return ty
21292127 if isdefined (M,s)
2130- tristate_merge! (frame, Effects (EFFECTS_TOTAL; consistent= TRISTATE_UNKNOWN ))
2128+ tristate_merge! (frame, Effects (EFFECTS_TOTAL; consistent= ALWAYS_FALSE ))
21312129 else
21322130 tristate_merge! (frame, Effects (EFFECTS_TOTAL;
2133- consistent= TRISTATE_UNKNOWN ,
2134- nothrow= TRISTATE_UNKNOWN ))
2131+ consistent= ALWAYS_FALSE ,
2132+ nothrow= ALWAYS_FALSE ))
21352133 end
21362134 return ty
21372135end
21382136
21392137function handle_global_assignment! (interp:: AbstractInterpreter , frame:: InferenceState , lhs:: GlobalRef , @nospecialize (newty))
2140- nothrow = global_assignment_nothrow (lhs . mod, lhs . name, newty)
2141- tristate_merge! (frame, Effects (EFFECTS_TOTAL,
2142- effect_free = TRISTATE_UNKNOWN,
2143- nothrow= nothrow ? ALWAYS_TRUE : TRISTATE_UNKNOWN ))
2138+ effect_free = ALWAYS_FALSE
2139+ nothrow = global_assignment_nothrow (lhs . mod, lhs . name, newty) ?
2140+ ALWAYS_TRUE : ALWAYS_FALSE
2141+ tristate_merge! (frame, Effects (EFFECTS_TOTAL; effect_free, nothrow))
21442142end
21452143
21462144abstract_eval_ssavalue (s:: SSAValue , sv:: InferenceState ) = abstract_eval_ssavalue (s, sv. ssavaluetypes)
@@ -2230,12 +2228,10 @@ end
22302228
22312229function handle_control_backedge! (frame:: InferenceState , from:: Int , to:: Int )
22322230 if from > to
2233- if is_effect_overridden (frame, :terminates_globally )
2234- # this frame is known to terminate
2235- elseif is_effect_overridden (frame, :terminates_locally )
2231+ if is_effect_overridden (frame, :terminates_locally )
22362232 # this backedge is known to terminate
22372233 else
2238- tristate_merge! (frame, Effects (EFFECTS_TOTAL; terminates= TRISTATE_UNKNOWN ))
2234+ tristate_merge! (frame, Effects (EFFECTS_TOTAL; terminates= ALWAYS_FALSE ))
22392235 end
22402236 end
22412237 return nothing
0 commit comments