Skip to content
This repository has been archived by the owner on Nov 2, 2019. It is now read-only.

Commit

Permalink
Don't fail when exception handler neighbors exit node.
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed Jun 18, 2012
1 parent 028f7d9 commit 999bd6e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/furnace-avm2/transform/cfg_reduce.rb
Expand Up @@ -122,6 +122,9 @@ def extended_block(block, stopgap=nil, loop_stack=[], nesting=0, upper_exc=nil)
# We have just arrived to a merge point of `if'
# contidional. Exit.
break
elsif block == @cfg.exit
# We have just arrived to exit node.
break
end

if block.exception != current_exception
Expand All @@ -132,14 +135,13 @@ def extended_block(block, stopgap=nil, loop_stack=[], nesting=0, upper_exc=nil)
exception_changed = true
end

prev_block = block

if @visited.include? block
raise "failsafe: block #{block.label} already visited"
elsif block != @cfg.exit
@visited.add block
end

prev_block = block
@visited.add block

if block.cti
if block.cti.type == :lookup_switch
log nesting, "is a switch"
Expand Down Expand Up @@ -389,8 +391,6 @@ def extended_block(block, stopgap=nil, loop_stack=[], nesting=0, upper_exc=nil)
append_instructions(block, current_nodes)

block = block.targets.first
elsif block == @cfg.exit
break
else
raise "invalid target count (#{block.targets.count})"
end
Expand Down

0 comments on commit 999bd6e

Please sign in to comment.