[pypy-svn] r43526 - in pypy/branch/prolog-jit-experiments/pypy/jit/timeshifter: . test

arigo at codespeak.net arigo at codespeak.net
Mon May 21 13:53:15 CEST 2007


Author: arigo
Date: Mon May 21 13:53:13 2007
New Revision: 43526

Modified:
   pypy/branch/prolog-jit-experiments/pypy/jit/timeshifter/hrtyper.py
   pypy/branch/prolog-jit-experiments/pypy/jit/timeshifter/test/test_timeshift.py
Log:
Check with an assert that global merge points only occur in the portal.


Modified: pypy/branch/prolog-jit-experiments/pypy/jit/timeshifter/hrtyper.py
==============================================================================
--- pypy/branch/prolog-jit-experiments/pypy/jit/timeshifter/hrtyper.py	(original)
+++ pypy/branch/prolog-jit-experiments/pypy/jit/timeshifter/hrtyper.py	Mon May 21 13:53:13 2007
@@ -414,9 +414,12 @@
         transformer.transform()
         flowmodel.checkgraph(graph)    # for now
         self.contains_promotion |= transformer.contains_promotion
+        global_mp = transformer.mergepointfamily.has_global_mergepoints()
         if is_portal:
-            self.portal_contains_global_mp = (
-                transformer.mergepointfamily.has_global_mergepoints())
+            self.portal_contains_global_mp = global_mp
+        else:
+            assert not global_mp, ("global_merge_point only allowed in portal"
+                                   " - found one in %s" % (graph,))
         return transformer.tsgraphs_seen
 
     def timeshift_ops(self, graph):

Modified: pypy/branch/prolog-jit-experiments/pypy/jit/timeshifter/test/test_timeshift.py
==============================================================================
--- pypy/branch/prolog-jit-experiments/pypy/jit/timeshifter/test/test_timeshift.py	(original)
+++ pypy/branch/prolog-jit-experiments/pypy/jit/timeshifter/test/test_timeshift.py	Mon May 21 13:53:13 2007
@@ -1749,4 +1749,11 @@
         self.check_insns({'int_eq': 2})
         assert res == f(0)
 
-
+    def test_misplaced_global_merge_point(self):
+        def g(n):
+            hint(None, global_merge_point=True)
+            return n+1
+        def f(n):
+            hint(None, global_merge_point=True)
+            return g(n)
+        py.test.raises(AssertionError, self.timeshift, f, [7], [])


More information about the pypy-svn mailing list