Skip to content

Commit 822632d

Browse files
authored
Update builtins, allow stepping into invokelatest (#670)
JuliaInterpreter had special handling for `Core._call_latest` to allow stepping into callees invoked in the latest world. In Julia 1.12, `Core._call_latest` is now an alias for `Core.invokelatest`, but because `generate_builtins` requires exact name matching, we had written the implementation for `invokelatest` without the special handling applied to `_call_latest`. This should enable the `test/debug.jl` test for `f_inv_latest` to pass on Julia 1.12.
1 parent 22f186b commit 822632d

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

bin/generate_builtins.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,9 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
266266
id = findfirst(isequal(f), Core.Compiler.T_FFUNC_KEY)
267267
fcall = generate_fcall(f, Core.Compiler.T_FFUNC_VAL, id)
268268
if f in RECENTLY_ADDED
269+
if f === Core.invokelatest
270+
fcall = replace(CALL_LATEST, "_call_latest" => "invokelatest")
271+
end
269272
print(io,
270273
"""
271274
$head @static isdefined($(ft.name.module), $(repr(nameof(f)))) && f === $fname

src/builtins.jl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,6 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
152152
end
153153
elseif @static isdefined(Core, :invoke_in_world) && f === Core.invoke_in_world
154154
return Some{Any}(Core.invoke_in_world(getargs(args, frame)...))
155-
elseif @static isdefined(Core, :invokelatest) && f === Core.invokelatest
156-
return Some{Any}(Core.invokelatest(getargs(args, frame)...))
157155
elseif @static isdefined(Core, :memorynew) && f === Core.memorynew
158156
if nargs == 2
159157
return Some{Any}(Core.memorynew(@lookup(frame, args[2]), @lookup(frame, args[3])))
@@ -268,6 +266,18 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
268266
# This uses the original arguments to avoid looking them up twice
269267
# See #442
270268
return Expr(:call, invoke, args[2:end]...)
269+
elseif @static isdefined(Core, :invokelatest) && f === Core.invokelatest
270+
args = getargs(args, frame)
271+
if !expand
272+
return Some{Any}(Core.invokelatest(args...))
273+
end
274+
new_expr = Expr(:call, args[1])
275+
popfirst!(args)
276+
for x in args
277+
push!(new_expr.args, QuoteNode(x))
278+
end
279+
return maybe_recurse_expanded_builtin(frame, new_expr)
280+
271281
elseif f === isa
272282
if nargs == 2
273283
return Some{Any}(isa(@lookup(frame, args[2]), @lookup(frame, args[3])))

0 commit comments

Comments
 (0)