[pypy-commit] pypy stmgc-c7: call_all_setup() must run iteratively until there is no more setup to call.

arigo noreply at buildbot.pypy.org
Mon Feb 9 16:58:05 CET 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c7
Changeset: r75782:4c668d843284
Date: 2015-02-09 16:57 +0100
http://bitbucket.org/pypy/pypy/changeset/4c668d843284/

Log:	call_all_setup() must run iteratively until there is no more setup
	to call.

diff --git a/rpython/rtyper/rtyper.py b/rpython/rtyper/rtyper.py
--- a/rpython/rtyper/rtyper.py
+++ b/rpython/rtyper/rtyper.py
@@ -303,21 +303,30 @@
 
     def call_all_setups(self, all_threads=False):
         # make sure all reprs so far have had their setup() called
-        must_setup_more = []
-        if all_threads:
-            lsts = self._all_lists_must_call_setup
-        else:
-            lsts = [self._list_must_call_setup()]
-        for lst in lsts:
-            while lst:
-                r = lst.pop()
-                if r.is_setup_delayed():
-                    pass    # will be re-added in set_setup_delayed(False)
+        while True:
+            if all_threads:
+                lsts = self._all_lists_must_call_setup
+                for lst in lsts:
+                    if lst:
+                        break
                 else:
-                    r.setup()
-                    must_setup_more.append(r)
-        for r in must_setup_more:
-            r.setup_final()
+                    return      # nothing to do
+            else:
+                lst = self._list_must_call_setup()
+                if not lst:
+                    return      # nothing to do
+                lsts = [lst]
+            must_setup_more = []
+            for lst in lsts:
+                while lst:
+                    r = lst.pop()
+                    if r.is_setup_delayed():
+                        pass    # will be re-added in set_setup_delayed(False)
+                    else:
+                        r.setup()
+                        must_setup_more.append(r)
+            for r in must_setup_more:
+                r.setup_final()
 
     def setconcretetype(self, v):
         assert isinstance(v, Variable)
@@ -352,8 +361,7 @@
         # Better empty it now during the same transaction.  Otherwise in rare
         # cases some reprs stay non-setup()ed for a non-deterministic while
         # and then other reprs' setup crash
-        while lst:
-            self.call_all_setups()
+        self.call_all_setups()
 
     def _specialize_block(self, block):
         graph = self.annotator.annotated[block]


More information about the pypy-commit mailing list