Skip to content

Commit

Permalink
Add back exception frames to stack frame
Browse files Browse the repository at this point in the history
Part of #2
  • Loading branch information
Keno committed Oct 21, 2017
1 parent 6ec323f commit 982a669
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/ASTInterpreter2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ struct JuliaStackFrame
locals::Vector{Nullable{Any}}
ssavalues::Vector{Any}
sparams::Vector{Any}
exception_frames::Vector{Int}
pc::JuliaProgramCounter
# A vector from names to the slotnumber of that name
# for which a reference was last encountered.
Expand Down
12 changes: 2 additions & 10 deletions src/interpret.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ end

function _step_expr(frame, pc)
node = pc_expr(frame, pc)
local ret
try
if isa(node, Expr)
if node.head == :(=)
Expand All @@ -89,11 +88,8 @@ function _step_expr(frame, pc)
do_assignment!(frame, lhs, rhs)
# Special case hack for readability.
# ret = rhs
ret = node
elseif node.head == :&
ret = node
elseif node.head == :gotoifnot
ret = node
arg = node.args[1]
arg = isa(arg, Bool) ? arg : lookup_var(frame, arg)
if !isa(arg, Bool)
Expand All @@ -105,18 +101,14 @@ function _step_expr(frame, pc)
elseif node.head == :call || node.head == :foreigncall
evaluate_call(frame, node)
elseif node.head == :static_typeof
ret = Any
elseif node.head == :type_goto || node.head == :inbounds
elseif node.head == :enter
push!(interp.exception_frames, node.args[1])
ret = node
push!(frame.exception_frames, node.args[1])
elseif node.head == :leave
for _ = 1:node.args[1]
pop!(interp.exception_frames)
pop!(frame.exception_frames)
end
ret = node
elseif node.head == :static_parameter
ret = interp.env.sparams[node.args[1]]
elseif node.head == :return
return nothing
else
Expand Down

0 comments on commit 982a669

Please sign in to comment.