Skip to content

Commit

Permalink
Handle :latestworld expr
Browse files Browse the repository at this point in the history
These were added in JuliaLang/julia#56523.
This simply adds tracking for the world age to the interpreter, but
does not use it for anything. JuliaInterpreter's current model
of world age does not match Base anyway. We should fix that eventually,
but it's probably easier to do that once JuliaLang/julia#56509
and binding partitions are merged.
  • Loading branch information
Keno committed Nov 14, 2024
1 parent 5de78c7 commit 25fcd56
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/interpret.jl
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,8 @@ function step_expr!(@nospecialize(recurse), frame::Frame, @nospecialize(node), i
error("unexpected error statement ", node)
elseif node.head === :incomplete
error("incomplete statement ", node)
elseif node.head === :latestworld
frame.world = Base.get_world_counter()
else
rhs = eval_rhs(recurse, frame, node)
end
Expand Down
7 changes: 5 additions & 2 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,10 @@ mutable struct Frame
caller::Union{Frame,Nothing}
callee::Union{Frame,Nothing}
last_codeloc::Int
# TODO: This is incompletely implemented
world::UInt
end
function Frame(framecode::FrameCode, framedata::FrameData, pc=1, caller=nothing)
function Frame(framecode::FrameCode, framedata::FrameData, pc=1, caller=nothing, world=Base.tls_world_age())
if length(junk_frames) > 0
frame = pop!(junk_frames)
frame.framecode = framecode
Expand All @@ -264,9 +266,10 @@ function Frame(framecode::FrameCode, framedata::FrameData, pc=1, caller=nothing)
frame.caller = caller
frame.callee = nothing
frame.last_codeloc = 0
frame.world = world
return frame
else
return Frame(framecode, framedata, pc, 1, caller, nothing, 0)
return Frame(framecode, framedata, pc, 1, caller, nothing, 0, world)
end
end
"""
Expand Down

0 comments on commit 25fcd56

Please sign in to comment.