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

Commit

Permalink
Fix a corner case of throw.
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed Aug 19, 2012
1 parent aebfc78 commit a7d5133
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/furnace-avm2/transform/liveness_analysis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@ def transform(cfg)
dead_ends = Set[ cfg.exit ]

# Search from the entry node, mark live variables
worklist = Set[ cfg.entry ]
worklist = Set[ cfg.entry, cfg.exit ]
while worklist.any?
block = worklist.first
worklist.delete block

if block.cti && block.cti.type == :throw
dead_ends.add block
elsif loops.include? block
if loops.include? block
back_edged, sources = block.sources.partition do |source|
dom[source].include? block
end
dead_ends.merge back_edged
else
if block.cti && block.cti.type == :throw
dead_ends.add block
end

sources = block.sources
end

Expand Down

0 comments on commit a7d5133

Please sign in to comment.