Author: Maciej Fijalkowski <fij...@gmail.com>
Branch: 
Changeset: r63918:c5635f5e10d6
Date: 2013-05-08 18:02 +0200
http://bitbucket.org/pypy/pypy/changeset/c5635f5e10d6/

Log:    merge

diff --git a/rpython/translator/backendopt/graphanalyze.py 
b/rpython/translator/backendopt/graphanalyze.py
--- a/rpython/translator/backendopt/graphanalyze.py
+++ b/rpython/translator/backendopt/graphanalyze.py
@@ -207,26 +207,29 @@
         self.graph_results = analyzer._analyzed_calls
         # the current stack of graphs being analyzed
         self.current_stack = []
-        self.current_stack_set = set()
+        #self.current_stack_set = set()
 
     def enter(self, graph):
         if graph not in self.graph_results:
             self.current_stack.append(graph)
-            self.current_stack_set.add(graph)
+            #self.current_stack_set.add(graph)
             self.graph_results.find(graph)
             return True
         else:
-            if graph in self.current_stack_set:
-                # found a cycle; merge all graphs in that cycle
-                i = len(self.current_stack) - 1
-                while self.current_stack[i] is not graph:
-                    self.graph_results.union(self.current_stack[i], graph)
-                    i -= 1
+            graph = self.graph_results.find_rep(graph)
+            for j in range(len(self.current_stack)):
+                othergraph = self.graph_results.find_rep(self.current_stack[j])
+                if graph is othergraph:
+                    # found a cycle; merge all graphs in that cycle
+                    for i in range(j, len(self.current_stack)):
+                        self.graph_results.union(self.current_stack[i], graph)
+                    # done
+                    break
             return False
 
     def leave_with(self, result):
         graph = self.current_stack.pop()
-        self.current_stack_set.remove(graph)
+        #self.current_stack_set.remove(graph)
         dep = self.graph_results[graph]
         dep.merge_with_result(result)
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to