[pypy-svn] r30471 - pypy/dist/pypy/annotation

arigo at codespeak.net arigo at codespeak.net
Mon Jul 24 19:19:26 CEST 2006


Author: arigo
Date: Mon Jul 24 19:19:24 2006
New Revision: 30471

Modified:
   pypy/dist/pypy/annotation/annrpython.py
Log:
Found and fixed another quadratic behavior.  Profiling says it is an
up-to-5-minutes speed-up on translate_pypy.



Modified: pypy/dist/pypy/annotation/annrpython.py
==============================================================================
--- pypy/dist/pypy/annotation/annrpython.py	(original)
+++ pypy/dist/pypy/annotation/annrpython.py	Mon Jul 24 19:19:24 2006
@@ -190,7 +190,15 @@
             self.policy.no_more_blocks_to_annotate(self)
             if not self.pendingblocks:
                 break   # finished
-        if False in self.annotated.values():
+        # make sure that the return variables of all graphs is annotated
+        if self.added_blocks is not None:
+            newgraphs = [self.annotated[block] for block in self.added_blocks]
+            newgraphs = dict.fromkeys(newgraphs)
+            got_blocked_blocks = False in newgraphs
+        else:
+            newgraphs = self.translator.graphs  #all of them
+            got_blocked_blocks = False in self.annotated.values()
+        if got_blocked_blocks:
             if annmodel.DEBUG:
                 for block in self.annotated:
                     if self.annotated[block] is False:
@@ -219,12 +227,6 @@
             text = format_blocked_annotation_error(self, blocked_blocks, graph)
             #raise SystemExit()
             raise AnnotatorError(text)
-        # make sure that the return variables of all graphs is annotated
-        if self.added_blocks is not None:
-            newgraphs = [self.annotated[block] for block in self.added_blocks]
-            newgraphs = dict.fromkeys(newgraphs)
-        else:
-            newgraphs = self.translator.graphs  #all of them
         for graph in newgraphs:
             v = graph.getreturnvar()
             if v not in self.bindings:



More information about the Pypy-commit mailing list