[pypy-svn] r37902 - pypy/branch/jit-virtual-world/pypy/jit/timeshifter

arigo at codespeak.net arigo at codespeak.net
Sun Feb 4 14:11:52 CET 2007


Author: arigo
Date: Sun Feb  4 14:11:49 2007
New Revision: 37902

Modified:
   pypy/branch/jit-virtual-world/pypy/jit/timeshifter/hrtyper.py
   pypy/branch/jit-virtual-world/pypy/jit/timeshifter/transform.py
Log:
(pedronis, arigo)

Add an explicit AssertionError when using promotion but forgetting the
global merge point.



Modified: pypy/branch/jit-virtual-world/pypy/jit/timeshifter/hrtyper.py
==============================================================================
--- pypy/branch/jit-virtual-world/pypy/jit/timeshifter/hrtyper.py	(original)
+++ pypy/branch/jit-virtual-world/pypy/jit/timeshifter/hrtyper.py	Sun Feb  4 14:11:49 2007
@@ -183,6 +183,8 @@
             # returns
             leaveportalgraph = entrygraph
             
+        self.contains_promotion = False
+        self.portal_contains_global_mp = False
         pending = [entrygraph]
         seen = {entrygraph: True}
         while pending:
@@ -192,6 +194,10 @@
                 if nextgraph not in seen:
                     pending.append(nextgraph)
                     seen[nextgraph] = True
+        if self.contains_promotion:
+            assert self.portal_contains_global_mp, (
+                "No global merge point found.  "
+                "Forgot 'hint(None, global_merge_point=True)'?")
         # only keep the hint-annotated graphs that are really useful
         self.annotator.translator.graphs = [graph
             for graph in self.annotator.translator.graphs
@@ -443,6 +449,10 @@
                                            is_portal=is_portal)
         transformer.transform()
         flowmodel.checkgraph(graph)    # for now
+        self.contains_promotion |= transformer.contains_promotion
+        if is_portal:
+            self.portal_contains_global_mp = (
+                transformer.mergepointfamily.has_global_mergepoints())
         return transformer.tsgraphs_seen
 
     def timeshift_graph(self, graph):

Modified: pypy/branch/jit-virtual-world/pypy/jit/timeshifter/transform.py
==============================================================================
--- pypy/branch/jit-virtual-world/pypy/jit/timeshifter/transform.py	(original)
+++ pypy/branch/jit-virtual-world/pypy/jit/timeshifter/transform.py	Sun Feb  4 14:11:49 2007
@@ -35,6 +35,8 @@
 class HintGraphTransformer(object):
     c_dummy = inputconst(lltype.Void, None)
 
+    contains_promotion = False
+
     def __init__(self, hannotator, graph, is_portal=False):
         self.hannotator = hannotator
         self.graph = graph
@@ -819,6 +821,7 @@
         block.operations[i] = newop
 
     def handle_promote_hint(self, block, i):
+        self.contains_promotion = True
         op = block.operations[i]
         v_promote = op.args[0]
         newop = SpaceOperation('revealconst', [v_promote], op.result)



More information about the Pypy-commit mailing list