Skip to content

Commit b02ea23

Browse files
authored
Handle :latestworld expr (#653)
* Handle `:latestworld` expr 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. * 1.6 compat
1 parent 5de78c7 commit b02ea23

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/interpret.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,8 @@ function step_expr!(@nospecialize(recurse), frame::Frame, @nospecialize(node), i
550550
error("unexpected error statement ", node)
551551
elseif node.head === :incomplete
552552
error("incomplete statement ", node)
553+
elseif node.head === :latestworld
554+
frame.world = Base.get_world_counter()
553555
else
554556
rhs = eval_rhs(recurse, frame, node)
555557
end

src/types.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,11 @@ mutable struct Frame
253253
caller::Union{Frame,Nothing}
254254
callee::Union{Frame,Nothing}
255255
last_codeloc::Int
256+
# TODO: This is incompletely implemented
257+
world::UInt
256258
end
257-
function Frame(framecode::FrameCode, framedata::FrameData, pc=1, caller=nothing)
259+
function Frame(framecode::FrameCode, framedata::FrameData, pc=1, caller=nothing,
260+
world=isdefined(Base, :tls_world_age) ? Base.tls_world_age() : Base.get_world_counter())
258261
if length(junk_frames) > 0
259262
frame = pop!(junk_frames)
260263
frame.framecode = framecode
@@ -264,9 +267,10 @@ function Frame(framecode::FrameCode, framedata::FrameData, pc=1, caller=nothing)
264267
frame.caller = caller
265268
frame.callee = nothing
266269
frame.last_codeloc = 0
270+
frame.world = world
267271
return frame
268272
else
269-
return Frame(framecode, framedata, pc, 1, caller, nothing, 0)
273+
return Frame(framecode, framedata, pc, 1, caller, nothing, 0, world)
270274
end
271275
end
272276
"""

0 commit comments

Comments
 (0)