Skip to content
Browse files

Fix a corner case of throw.

  • Loading branch information...
1 parent aebfc78 commit a7d51331eea956cd2cf9d327de54fcbb18e0cb96 @whitequark committed
Showing with 6 additions and 4 deletions.
  1. +6 −4 lib/furnace-avm2/transform/liveness_analysis.rb
View
10 lib/furnace-avm2/transform/liveness_analysis.rb
@@ -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

0 comments on commit a7d5133

Please sign in to comment.
Something went wrong with that request. Please try again.