Skip to content

Commit

Permalink
adjust to the :enter IR changes made in JuliaLang/julia#52300
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aviatesk committed Nov 28, 2023
1 parent 68fa8be commit a6f2c4c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/interpret.jl
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ function maybe_assign!(frame, @nospecialize(stmt), @nospecialize(val))
end
maybe_assign!(frame, @nospecialize(val)) = maybe_assign!(frame, pc_expr(frame), val)


function eval_rhs(@nospecialize(recurse), frame, node::Expr)
head = node.head
if head === :new
Expand Down Expand Up @@ -399,6 +398,7 @@ function eval_rhs(@nospecialize(recurse), frame, node::Expr)
val = (node.args[1]::QuoteNode).value
return isa(val, Expr) ? copy(val) : val
elseif head === :enter
# XXX This seems to be dead code
return length(frame.framedata.exception_frames)
elseif head === :boundscheck
return true
Expand Down Expand Up @@ -565,6 +565,9 @@ function step_expr!(@nospecialize(recurse), frame, @nospecialize(node), istoplev
elseif istoplevel && isa(node, LineNumberNode)
elseif istoplevel && isa(node, Symbol)
rhs = getfield(moduleof(frame), node)
elseif @static (isdefined(Core.IR, :EnterNode) && true) && isa(node, Core.IR.EnterNode)
rhs = node.catch_dest
push!(data.exception_frames, rhs)
else
rhs = @lookup(frame, node)
end
Expand Down
10 changes: 5 additions & 5 deletions src/optimize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,10 @@ function renumber_ssa!(stmts::Vector{Any}, ssalookup)
stmts[i] = SSAValue(ssalookup[stmt.id])
elseif isa(stmt, NewSSAValue)
stmts[i] = SSAValue(stmt.id)
elseif isexpr(stmt, :enter)
stmt.args[end] = jumplookup(ssalookup, stmt.args[1]::Int)
elseif isa(stmt, Expr)
stmt = replace_ssa(stmt, ssalookup)
if stmt.head === :enter
stmt.args[end] = jumplookup(ssalookup, stmt.args[1]::Int)
end
stmts[i] = stmt
stmts[i] = replace_ssa(stmt, ssalookup)
elseif isa(stmt, GotoIfNot)
cond = stmt.cond
if isa(cond, SSAValue)
Expand All @@ -71,6 +69,8 @@ function renumber_ssa!(stmts::Vector{Any}, ssalookup)
if isa(val, SSAValue)
stmts[i] = ReturnNode(SSAValue(ssalookup[val.id]))
end
elseif @static (isdefined(Core.IR, :EnterNode) && true) && isa(stmt, Core.IR.EnterNode)
stmts[i] = Core.IR.EnterNode(jumplookup(ssalookup, stmt.catch_dest))
end
end
return stmts
Expand Down

0 comments on commit a6f2c4c

Please sign in to comment.