Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/printing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,14 @@ end

function expression_for_display(frame::Frame)
expr = pc_expr(frame)
if expr isa GlobalRef && frame.pc < nstatements(frame.framecode)
if expr isa Union{GlobalRef, QuoteNode} && frame.pc < nstatements(frame.framecode)
# Julia 1.12 may pause on a global lookup followed by separate argument
# loads and then a call. Preview that call so the status still shows the
# call rather than just `Main.:+` — both when the global is the callee
# and when it is an argument (e.g. pausing on `Base.Math.:*` inside
# a call like `map(*, x, y)`).
# a call like `map(*, x, y)`). JuliaInterpreter's `optimize!` may fold
# a const `GlobalRef` statement into a `QuoteNode` of its value, so
# accept both forms.
for next_pc in (frame.pc + 1):nstatements(frame.framecode)
stmt = pc_expr(frame, next_pc)
call = isexpr(stmt, :(=)) ? stmt.args[2] : stmt
Expand Down
4 changes: 3 additions & 1 deletion test/misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ frame.pc = 1
f_preview_arg(x, y) = map(*, x, y)
let frame = JuliaInterpreter.enter_call(f_preview_arg, [1, 2], [3, 4])
nst = JuliaInterpreter.nstatements(frame.framecode)
pcstar = findfirst(i -> (e = pc_expr(frame, i); e isa GlobalRef && e.name == :*), 1:nst)
# the load is a `GlobalRef`, or a `QuoteNode` when JuliaInterpreter folded the const
pcstar = findfirst(i -> (e = pc_expr(frame, i);
(e isa GlobalRef && e.name == :*) || (e isa QuoteNode && e.value === *)), 1:nst)
# globals load as separate statements only in newer lowering (Julia 1.12+)
if pcstar !== nothing
while frame.pc < pcstar
Expand Down