Skip to content

Commit ac31b22

Browse files
committed
adjust to the :enter IR changes made in JuliaLang/julia#52300
I don't expect this commit to fix the CI on 🔥, but since these changes are straightforward, we should be able to go ahead and merge this as is.
1 parent 9d50726 commit ac31b22

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/interpret.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,6 @@ function maybe_assign!(frame, @nospecialize(stmt), @nospecialize(val))
370370
end
371371
maybe_assign!(frame, @nospecialize(val)) = maybe_assign!(frame, pc_expr(frame), val)
372372

373-
374373
function eval_rhs(@nospecialize(recurse), frame, node::Expr)
375374
head = node.head
376375
if head === :new
@@ -399,6 +398,7 @@ function eval_rhs(@nospecialize(recurse), frame, node::Expr)
399398
val = (node.args[1]::QuoteNode).value
400399
return isa(val, Expr) ? copy(val) : val
401400
elseif head === :enter
401+
# XXX This seems to be dead code
402402
return length(frame.framedata.exception_frames)
403403
elseif head === :boundscheck
404404
return true
@@ -565,6 +565,9 @@ function step_expr!(@nospecialize(recurse), frame, @nospecialize(node), istoplev
565565
elseif istoplevel && isa(node, LineNumberNode)
566566
elseif istoplevel && isa(node, Symbol)
567567
rhs = getfield(moduleof(frame), node)
568+
elseif @static (isdefined(Core.IR, :EnterNode) && true) && isa(node, Core.IR.EnterNode)
569+
rhs = node.catch_dest
570+
push!(data.exception_frames, rhs)
568571
else
569572
rhs = @lookup(frame, node)
570573
end

src/optimize.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,10 @@ function renumber_ssa!(stmts::Vector{Any}, ssalookup)
5454
stmts[i] = SSAValue(ssalookup[stmt.id])
5555
elseif isa(stmt, NewSSAValue)
5656
stmts[i] = SSAValue(stmt.id)
57+
elseif isexpr(stmt, :enter)
58+
stmt.args[end] = jumplookup(ssalookup, stmt.args[1]::Int)
5759
elseif isa(stmt, Expr)
58-
stmt = replace_ssa(stmt, ssalookup)
59-
if stmt.head === :enter
60-
stmt.args[end] = jumplookup(ssalookup, stmt.args[1]::Int)
61-
end
62-
stmts[i] = stmt
60+
stmts[i] = replace_ssa(stmt, ssalookup)
6361
elseif isa(stmt, GotoIfNot)
6462
cond = stmt.cond
6563
if isa(cond, SSAValue)
@@ -71,6 +69,8 @@ function renumber_ssa!(stmts::Vector{Any}, ssalookup)
7169
if isa(val, SSAValue)
7270
stmts[i] = ReturnNode(SSAValue(ssalookup[val.id]))
7371
end
72+
elseif @static (isdefined(Core.IR, :EnterNode) && true) && isa(stmt, Core.IR.EnterNode)
73+
stmts[i] = Core.IR.EnterNode(jumplookup(ssalookup, stmt.catch_dest))
7474
end
7575
end
7676
return stmts

0 commit comments

Comments
 (0)