@@ -2426,11 +2426,15 @@ function abstract_eval_getglobal(interp::AbstractInterpreter, sv::AbsIntState, s
24262426end 
24272427
24282428function  abstract_eval_getglobal (interp:: AbstractInterpreter , sv:: AbsIntState , saw_latestworld:: Bool , argtypes:: Vector{Any} )
2429-     if  length (argtypes) ==  3 
2430-         return  abstract_eval_getglobal (interp, sv, saw_latestworld, argtypes[2 ], argtypes[3 ])
2431-     elseif  length (argtypes) ==  4 
2432-         return  abstract_eval_getglobal (interp, sv, saw_latestworld, argtypes[2 ], argtypes[3 ], argtypes[4 ])
2433-     elseif  ! isvarargtype (argtypes[end ]) ||  length (argtypes) >  5 
2429+     if  ! isvarargtype (argtypes[end ])
2430+         if  length (argtypes) ==  3 
2431+             return  abstract_eval_getglobal (interp, sv, saw_latestworld, argtypes[2 ], argtypes[3 ])
2432+         elseif  length (argtypes) ==  4 
2433+             return  abstract_eval_getglobal (interp, sv, saw_latestworld, argtypes[2 ], argtypes[3 ], argtypes[4 ])
2434+         else 
2435+             return  CallMeta (Union{}, ArgumentError, EFFECTS_THROWS, NoCallInfo ())
2436+         end 
2437+     elseif  length (argtypes) >  5 
24342438        return  CallMeta (Union{}, ArgumentError, EFFECTS_THROWS, NoCallInfo ())
24352439    else 
24362440        return  CallMeta (Any, generic_getglobal_exct, generic_getglobal_effects, NoCallInfo ())
@@ -2471,10 +2475,12 @@ end
24712475end 
24722476
24732477function  abstract_eval_get_binding_type (interp:: AbstractInterpreter , sv:: AbsIntState , argtypes:: Vector{Any} )
2474-     if  length (argtypes) ==  3 
2475-         return  abstract_eval_get_binding_type (interp, sv, argtypes[2 ], argtypes[3 ])
2476-     elseif  ! isvarargtype (argtypes[end ]) ||  length (argtypes) >  4 
2477-         return  CallMeta (Union{}, ArgumentError, EFFECTS_THROWS, NoCallInfo ())
2478+     if  ! isvarargtype (argtypes[end ])
2479+         if  length (argtypes) ==  3 
2480+             return  abstract_eval_get_binding_type (interp, sv, argtypes[2 ], argtypes[3 ])
2481+         else 
2482+             return  CallMeta (Union{}, ArgumentError, EFFECTS_THROWS, NoCallInfo ())
2483+         end 
24782484    end 
24792485    return  CallMeta (Type, Union{TypeError, ArgumentError}, EFFECTS_THROWS, NoCallInfo ())
24802486end 
@@ -2509,11 +2515,15 @@ end
25092515const  generic_setglobal!_exct =  Union{ArgumentError, TypeError, ErrorException, ConcurrencyViolationError}
25102516
25112517function  abstract_eval_setglobal! (interp:: AbstractInterpreter , sv:: AbsIntState , saw_latestworld:: Bool , argtypes:: Vector{Any} )
2512-     if  length (argtypes) ==  4 
2513-         return  abstract_eval_setglobal! (interp, sv, saw_latestworld, argtypes[2 ], argtypes[3 ], argtypes[4 ])
2514-     elseif  length (argtypes) ==  5 
2515-         return  abstract_eval_setglobal! (interp, sv, saw_latestworld, argtypes[2 ], argtypes[3 ], argtypes[4 ], argtypes[5 ])
2516-     elseif  ! isvarargtype (argtypes[end ]) ||  length (argtypes) >  6 
2518+     if  ! isvarargtype (argtypes[end ])
2519+         if  length (argtypes) ==  4 
2520+             return  abstract_eval_setglobal! (interp, sv, saw_latestworld, argtypes[2 ], argtypes[3 ], argtypes[4 ])
2521+         elseif  length (argtypes) ==  5 
2522+             return  abstract_eval_setglobal! (interp, sv, saw_latestworld, argtypes[2 ], argtypes[3 ], argtypes[4 ], argtypes[5 ])
2523+         else 
2524+             return  CallMeta (Union{}, ArgumentError, EFFECTS_THROWS, NoCallInfo ())
2525+         end 
2526+     elseif  length (argtypes) >  6 
25172527        return  CallMeta (Union{}, ArgumentError, EFFECTS_THROWS, NoCallInfo ())
25182528    else 
25192529        return  CallMeta (Any, generic_setglobal!_exct, setglobal!_effects, NoCallInfo ())
@@ -2537,74 +2547,86 @@ function abstract_eval_swapglobal!(interp::AbstractInterpreter, sv::AbsIntState,
25372547end 
25382548
25392549function  abstract_eval_swapglobal! (interp:: AbstractInterpreter , sv:: AbsIntState , saw_latestworld:: Bool , argtypes:: Vector{Any} )
2540-     if  length (argtypes) ==  4 
2541-         return  abstract_eval_swapglobal! (interp, sv, saw_latestworld, argtypes[2 ], argtypes[3 ], argtypes[4 ])
2542-     elseif  length (argtypes) ==  5 
2543-         return  abstract_eval_swapglobal! (interp, sv, saw_latestworld, argtypes[2 ], argtypes[3 ], argtypes[4 ], argtypes[5 ])
2544-     elseif  ! isvarargtype (argtypes[end ]) ||  length (argtypes) >  6 
2550+     if  ! isvarargtype (argtypes[end ])
2551+         if  length (argtypes) ==  4 
2552+             return  abstract_eval_swapglobal! (interp, sv, saw_latestworld, argtypes[2 ], argtypes[3 ], argtypes[4 ])
2553+         elseif  length (argtypes) ==  5 
2554+             return  abstract_eval_swapglobal! (interp, sv, saw_latestworld, argtypes[2 ], argtypes[3 ], argtypes[4 ], argtypes[5 ])
2555+         else 
2556+             return  CallMeta (Union{}, ArgumentError, EFFECTS_THROWS, NoCallInfo ())
2557+         end 
2558+     elseif  length (argtypes) >  6 
25452559        return  CallMeta (Union{}, ArgumentError, EFFECTS_THROWS, NoCallInfo ())
25462560    else 
25472561        return  CallMeta (Any, Union{generic_getglobal_exct,generic_setglobal!_exct}, setglobal!_effects, NoCallInfo ())
25482562    end 
25492563end 
25502564
25512565function  abstract_eval_setglobalonce! (interp:: AbstractInterpreter , sv:: AbsIntState , saw_latestworld:: Bool , argtypes:: Vector{Any} )
2552-     if  length (argtypes) in  (4 , 5 , 6 )
2553-         cm =  abstract_eval_setglobal! (interp, sv, saw_latestworld, argtypes[2 ], argtypes[3 ], argtypes[4 ])
2554-         if  length (argtypes) >=  5 
2555-             goe =  global_order_exct (argtypes[5 ], #= loading=# true , #= storing=# true )
2556-             cm =  merge_exct (cm, goe)
2557-         end 
2558-         if  length (argtypes) ==  6 
2559-             goe =  global_order_exct (argtypes[6 ], #= loading=# true , #= storing=# false )
2560-             cm =  merge_exct (cm, goe)
2561-         end 
2562-         return  CallMeta (Bool, cm. exct, cm. effects, cm. info)
2563-     elseif  ! isvarargtype (argtypes[end ]) ||  length (argtypes) >  6 
2566+     if  ! isvarargtype (argtypes[end ])
2567+         if  length (argtypes) in  (4 , 5 , 6 )
2568+             cm =  abstract_eval_setglobal! (interp, sv, saw_latestworld, argtypes[2 ], argtypes[3 ], argtypes[4 ])
2569+             if  length (argtypes) >=  5 
2570+                 goe =  global_order_exct (argtypes[5 ], #= loading=# true , #= storing=# true )
2571+                 cm =  merge_exct (cm, goe)
2572+             end 
2573+             if  length (argtypes) ==  6 
2574+                 goe =  global_order_exct (argtypes[6 ], #= loading=# true , #= storing=# false )
2575+                 cm =  merge_exct (cm, goe)
2576+             end 
2577+             return  CallMeta (Bool, cm. exct, cm. effects, cm. info)
2578+         else 
2579+             return  CallMeta (Union{}, ArgumentError, EFFECTS_THROWS, NoCallInfo ())
2580+         end 
2581+     elseif  length (argtypes) >  7 
25642582        return  CallMeta (Union{}, ArgumentError, EFFECTS_THROWS, NoCallInfo ())
25652583    else 
25662584        return  CallMeta (Bool, generic_setglobal!_exct, setglobal!_effects, NoCallInfo ())
25672585    end 
25682586end 
25692587
25702588function  abstract_eval_replaceglobal! (interp:: AbstractInterpreter , sv:: AbsIntState , saw_latestworld:: Bool , argtypes:: Vector{Any} )
2571-     if  length (argtypes) in  (5 , 6 , 7 )
2572-         (M, s, x, v) =  argtypes[2 ], argtypes[3 ], argtypes[4 ], argtypes[5 ]
2573-         T =  nothing 
2574-         if  isa (M, Const) &&  isa (s, Const)
2575-             M, s =  M. val, s. val
2576-             M isa  Module ||  return  CallMeta (Union{}, TypeError, EFFECTS_THROWS, NoCallInfo ())
2577-             s isa  Symbol ||  return  CallMeta (Union{}, TypeError, EFFECTS_THROWS, NoCallInfo ())
2578-             gr =  GlobalRef (M, s)
2579-             v′ =  RefValue {Any} (v)
2580-             (valid_worlds, (rte, T)) =  scan_leaf_partitions (interp, gr, sv. world) do  interp:: AbstractInterpreter , binding:: Core.Binding , partition:: Core.BindingPartition 
2581-                 partition_T =  nothing 
2582-                 partition_rte =  abstract_eval_partition_load (interp, binding, partition)
2583-                 if  binding_kind (partition) ==  PARTITION_KIND_GLOBAL
2584-                     partition_T =  partition_restriction (partition)
2589+     if  ! isvarargtype (argtypes[end ])
2590+         if  length (argtypes) in  (5 , 6 , 7 )
2591+             (M, s, x, v) =  argtypes[2 ], argtypes[3 ], argtypes[4 ], argtypes[5 ]
2592+             T =  nothing 
2593+             if  isa (M, Const) &&  isa (s, Const)
2594+                 M, s =  M. val, s. val
2595+                 M isa  Module ||  return  CallMeta (Union{}, TypeError, EFFECTS_THROWS, NoCallInfo ())
2596+                 s isa  Symbol ||  return  CallMeta (Union{}, TypeError, EFFECTS_THROWS, NoCallInfo ())
2597+                 gr =  GlobalRef (M, s)
2598+                 v′ =  RefValue {Any} (v)
2599+                 (valid_worlds, (rte, T)) =  scan_leaf_partitions (interp, gr, sv. world) do  interp:: AbstractInterpreter , binding:: Core.Binding , partition:: Core.BindingPartition 
2600+                     partition_T =  nothing 
2601+                     partition_rte =  abstract_eval_partition_load (interp, binding, partition)
2602+                     if  binding_kind (partition) ==  PARTITION_KIND_GLOBAL
2603+                         partition_T =  partition_restriction (partition)
2604+                     end 
2605+                     partition_exct =  Union{partition_rte. exct, global_assignment_binding_rt_exct (interp, partition, v′[])[2 ]}
2606+                     partition_rte =  RTEffects (partition_rte. rt, partition_exct, partition_rte. effects)
2607+                     Pair {RTEffects, Any} (partition_rte, partition_T)
25852608                end 
2586-                 partition_exct =  Union{partition_rte. exct, global_assignment_binding_rt_exct (interp, partition, v′[])[2 ]}
2587-                 partition_rte =  RTEffects (partition_rte. rt, partition_exct, partition_rte. effects)
2588-                 Pair {RTEffects, Any} (partition_rte, partition_T)
2609+                 update_valid_age! (sv, valid_worlds)
2610+                 effects =  merge_effects (rte. effects, Effects (setglobal!_effects, nothrow= rte. exct=== Bottom))
2611+                 sg =  CallMeta (Any, rte. exct, effects, GlobalAccessInfo (convert (Core. Binding, gr)))
2612+             else 
2613+                 sg =  abstract_eval_setglobal! (interp, sv, saw_latestworld, M, s, v)
2614+             end 
2615+             if  length (argtypes) >=  6 
2616+                 goe =  global_order_exct (argtypes[6 ], #= loading=# true , #= storing=# true )
2617+                 sg =  merge_exct (sg, goe)
2618+             end 
2619+             if  length (argtypes) ==  7 
2620+                 goe =  global_order_exct (argtypes[7 ], #= loading=# true , #= storing=# false )
2621+                 sg =  merge_exct (sg, goe)
25892622            end 
2590-             update_valid_age! (sv, valid_worlds)
2591-             effects =  merge_effects (rte. effects, Effects (setglobal!_effects, nothrow= rte. exct=== Bottom))
2592-             sg =  CallMeta (Any, rte. exct, effects, GlobalAccessInfo (convert (Core. Binding, gr)))
2623+             rt =  T ===  nothing  ? 
2624+                 ccall (:jl_apply_cmpswap_type , Any, (Any,), S) where  S : 
2625+                 ccall (:jl_apply_cmpswap_type , Any, (Any,), T)
2626+             return  CallMeta (rt, sg. exct, sg. effects, sg. info)
25932627        else 
2594-             sg =  abstract_eval_setglobal! (interp, sv, saw_latestworld, M, s, v)
2595-         end 
2596-         if  length (argtypes) >=  6 
2597-             goe =  global_order_exct (argtypes[6 ], #= loading=# true , #= storing=# true )
2598-             sg =  merge_exct (sg, goe)
2599-         end 
2600-         if  length (argtypes) ==  7 
2601-             goe =  global_order_exct (argtypes[7 ], #= loading=# true , #= storing=# false )
2602-             sg =  merge_exct (sg, goe)
2628+             return  CallMeta (Union{}, ArgumentError, EFFECTS_THROWS, NoCallInfo ())
26032629        end 
2604-         rt =  T ===  nothing  ? 
2605-             ccall (:jl_apply_cmpswap_type , Any, (Any,), S) where  S : 
2606-             ccall (:jl_apply_cmpswap_type , Any, (Any,), T)
2607-         return  CallMeta (rt, sg. exct, sg. effects, sg. info)
26082630    elseif  ! isvarargtype (argtypes[end ]) ||  length (argtypes) >  8 
26092631        return  CallMeta (Union{}, ArgumentError, EFFECTS_THROWS, NoCallInfo ())
26102632    else 
@@ -2662,11 +2684,8 @@ function abstract_call_known(interp::AbstractInterpreter, @nospecialize(f),
26622684            return  Future (abstract_eval_isdefinedglobal (interp, argtypes[2 ], argtypes[3 ], Const (true ),
26632685                length (argtypes) ==  4  ?  argtypes[4 ] :  Const (:unordered ),
26642686                si. saw_latestworld, sv))
2665-         elseif  f ===  Core. isdefinedglobal &&  3  <=  length (argtypes) <=  5 
2666-             return  Future (abstract_eval_isdefinedglobal (interp, argtypes[2 ], argtypes[3 ],
2667-                 length (argtypes) >=  4  ?  argtypes[4 ] :  Const (true ),
2668-                 length (argtypes) >=  5  ?  argtypes[5 ] :  Const (:unordered ),
2669-                 si. saw_latestworld, sv))
2687+         elseif  f ===  Core. isdefinedglobal
2688+             return  Future (abstract_eval_isdefinedglobal (interp, sv, si. saw_latestworld, argtypes))
26702689        elseif  f ===  Core. get_binding_type
26712690            return  Future (abstract_eval_get_binding_type (interp, sv, argtypes))
26722691        end 
@@ -3347,6 +3366,23 @@ function abstract_eval_isdefinedglobal(interp::AbstractInterpreter, @nospecializ
33473366    return  CallMeta (Bool, Union{exct, TypeError, UndefVarError}, generic_isdefinedglobal_effects, NoCallInfo ())
33483367end 
33493368
3369+ function  abstract_eval_isdefinedglobal (interp:: AbstractInterpreter , sv:: AbsIntState , saw_latestworld:: Bool , argtypes:: Vector{Any} )
3370+     if  ! isvarargtype (argtypes[end ])
3371+         if  3  <=  length (argtypes) <=  5 
3372+             return  abstract_eval_isdefinedglobal (interp, argtypes[2 ], argtypes[3 ],
3373+                 length (argtypes) >=  4  ?  argtypes[4 ] :  Const (true ),
3374+                 length (argtypes) >=  5  ?  argtypes[5 ] :  Const (:unordered ),
3375+                 saw_latestworld, sv)
3376+         else 
3377+             return  CallMeta (Union{}, ArgumentError, EFFECTS_THROWS, NoCallInfo ())
3378+         end 
3379+     elseif  length (argtypes) >  6 
3380+         return  CallMeta (Union{}, ArgumentError, EFFECTS_THROWS, NoCallInfo ())
3381+     else 
3382+         return  CallMeta (Bool, Union{ConcurrencyViolationError, TypeError, UndefVarError}, generic_isdefinedglobal_effects, NoCallInfo ())
3383+     end 
3384+ end 
3385+ 
33503386function  abstract_eval_throw_undef_if_not (interp:: AbstractInterpreter , e:: Expr , sstate:: StatementState , sv:: AbsIntState )
33513387    condt =  abstract_eval_value (interp, e. args[2 ], sstate, sv)
33523388    condval =  maybe_extract_const_bool (condt)
0 commit comments