Skip to content

Commit e05fc00

Browse files
committed
REPLCompletions: remove builtin_tfunction(::REPLInterpreter) overload (#58585)
This overload was necessary in the past, but in the current compiler implementation, all `getglobal` calls that were aggressively concretized by this overload are already concretized by `concrete_eval_call`. So this overload is no longer necessary. - closes #58537
1 parent e90c949 commit e05fc00

File tree

1 file changed

+4
-26
lines changed

1 file changed

+4
-26
lines changed

stdlib/REPL/src/REPLCompletions.jl

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -563,18 +563,18 @@ CC.bail_out_toplevel_call(::REPLInterpreter, ::CC.InferenceLoopState, ::CC.Infer
563563
# be employed, for instance, by `typeinf_ext_toplevel`.
564564
is_repl_frame(sv::CC.InferenceState) = sv.linfo.def isa Module && sv.cache_mode === CC.CACHE_MODE_NULL
565565

566-
function is_call_graph_uncached(sv::CC.InferenceState)
566+
function is_call_stack_uncached(sv::CC.InferenceState)
567567
CC.is_cached(sv) && return false
568568
parent = CC.frame_parent(sv)
569569
parent === nothing && return true
570-
return is_call_graph_uncached(parent::CC.InferenceState)
570+
return is_call_stack_uncached(parent::CC.InferenceState)
571571
end
572572

573573
# aggressive global binding resolution within `repl_frame`
574574
function CC.abstract_eval_globalref(interp::REPLInterpreter, g::GlobalRef, bailed::Bool,
575575
sv::CC.InferenceState)
576576
# Ignore saw_latestworld
577-
if (interp.limit_aggressive_inference ? is_repl_frame(sv) : is_call_graph_uncached(sv))
577+
if (interp.limit_aggressive_inference ? is_repl_frame(sv) : is_call_stack_uncached(sv))
578578
partition = CC.abstract_eval_binding_partition!(interp, g, sv)
579579
if CC.is_defined_const_binding(CC.binding_kind(partition))
580580
return CC.RTEffects(Const(CC.partition_restriction(partition)), Union{}, CC.EFFECTS_TOTAL)
@@ -598,33 +598,11 @@ function is_repl_frame_getproperty(sv::CC.InferenceState)
598598
return is_repl_frame(CC.frame_parent(sv))
599599
end
600600

601-
# aggressive global binding resolution for `getproperty(::Module, ::Symbol)` calls within `repl_frame`
602-
function CC.builtin_tfunction(interp::REPLInterpreter, @nospecialize(f),
603-
argtypes::Vector{Any}, sv::CC.InferenceState)
604-
if f === Core.getglobal && (interp.limit_aggressive_inference ? is_repl_frame_getproperty(sv) : is_call_graph_uncached(sv))
605-
if length(argtypes) == 2
606-
a1, a2 = argtypes
607-
if isa(a1, Const) && isa(a2, Const)
608-
a1val, a2val = a1.val, a2.val
609-
if isa(a1val, Module) && isa(a2val, Symbol)
610-
g = GlobalRef(a1val, a2val)
611-
if isdefined_globalref(g)
612-
return Const(ccall(:jl_get_globalref_value, Any, (Any,), g))
613-
end
614-
return Union{}
615-
end
616-
end
617-
end
618-
end
619-
return @invoke CC.builtin_tfunction(interp::CC.AbstractInterpreter, f::Any,
620-
argtypes::Vector{Any}, sv::CC.InferenceState)
621-
end
622-
623601
# aggressive concrete evaluation for `:inconsistent` frames within `repl_frame`
624602
function CC.concrete_eval_eligible(interp::REPLInterpreter, @nospecialize(f),
625603
result::CC.MethodCallResult, arginfo::CC.ArgInfo,
626604
sv::CC.InferenceState)
627-
if (interp.limit_aggressive_inference ? is_repl_frame(sv) : is_call_graph_uncached(sv))
605+
if (interp.limit_aggressive_inference ? is_repl_frame(sv) : is_call_stack_uncached(sv))
628606
neweffects = CC.Effects(result.effects; consistent=CC.ALWAYS_TRUE)
629607
result = CC.MethodCallResult(result.rt, result.exct, neweffects, result.edge,
630608
result.edgecycle, result.edgelimited, result.volatile_inf_result)

0 commit comments

Comments
 (0)