Permalink
Browse files

Make repeated calls to Tree::Optimizer.run work in the presence of de…

…pendencies.
  • Loading branch information...
1 parent f0b2807 commit 542b6b14126dc1d61a26f800117af7c6aa3f3ce7 tcurtis committed Jul 31, 2010
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/Tree/Optimizer.nqp
View
@@ -111,6 +111,8 @@ method pass-order () {
@no-preds.push($_.key) unless
pir::exists__IQs(%!predecessors, $_.key);
}
+ my %old-preds := pir::clone__PP(%!predecessors);
+ my %old-succs := pir::clone__PP(%!successors);
while +@no-preds != 0 {
my $name := @no-preds.pop;
@result.push(self.find-pass($name));
@@ -122,6 +124,12 @@ method pass-order () {
}
}
}
- pir::die('Cyclical dependency graph.') if +%!successors || +%!predecessors;
+ if +%!successors || +%!predecessors {
+ %!predecessors := %old-preds;
+ %!successors := %old-succs;
+ pir::die('Cyclical dependency graph.')
+ }
+ %!predecessors := %old-preds;
+ %!successors := %old-succs;
@result;
}

0 comments on commit 542b6b1

Please sign in to comment.