Author: Antonio Cuni <[email protected]>
Branch: autoreds
Changeset: r58848:545559ca5f6a
Date: 2012-11-13 09:51 +0100
http://bitbucket.org/pypy/pypy/changeset/545559ca5f6a/

Log:    forbid autoreds when using can_enter_jit, and explain why

diff --git a/pypy/jit/metainterp/test/test_ajit.py 
b/pypy/jit/metainterp/test/test_ajit.py
--- a/pypy/jit/metainterp/test/test_ajit.py
+++ b/pypy/jit/metainterp/test/test_ajit.py
@@ -104,7 +104,6 @@
             # by chance
             a = b = c = d = n
             while n > 0:
-                myjitdriver.can_enter_jit(m=m)
                 myjitdriver.jit_merge_point(m=m)
                 n -= 1
                 a += 1 # dummy unused red
@@ -132,7 +131,6 @@
             f1 = f2 = f3 = f4 = float(n)
             r1 = r2 = r3 = r4 = MyObj(n)
             while n > 0:
-                myjitdriver.can_enter_jit(m=m)
                 myjitdriver.jit_merge_point(m=m)
                 n -= 1
                 i1 += 1 # dummy unused red
@@ -160,7 +158,6 @@
             res = 0
             while n > 0:
                 n -= 1
-                myjitdriver.can_enter_jit(m=m)
                 myjitdriver.jit_merge_point(m=m)
                 res += m*2
             return res
diff --git a/pypy/jit/metainterp/warmspot.py b/pypy/jit/metainterp/warmspot.py
--- a/pypy/jit/metainterp/warmspot.py
+++ b/pypy/jit/metainterp/warmspot.py
@@ -256,6 +256,16 @@
         # add all the variables across the links to the reds.
         for block, op in graph.iterblockops():
             if op.opname == 'jit_marker':
+                # if we want to support also can_enter_jit, we should find a
+                # way to detect a consistent set of red vars to pass *both* to
+                # jit_merge_point and can_enter_jit. The current simple
+                # solution doesn't work because can_enter_jit might be in
+                # another block, so the set of alive_v will be different.
+                methname = op.args[0].value
+                assert methname == 'jit_merge_point', (
+                    "reds='auto' is supported only for jit drivers which " 
+                    "calls only jit_merge_point. Found a call to %s" % 
methname)
+                #
                 jitdriver = op.args[1].value
                 if not jitdriver.autoreds:
                     continue
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to