Author: Armin Rigo <ar...@tunes.org>
Branch: 
Changeset: r56663:f2805b6d8651
Date: 2012-08-09 00:21 +0200
http://bitbucket.org/pypy/pypy/changeset/f2805b6d8651/

Log:    Add more skipped tests and clarify the error message. Hard to fix:
        there was already a skipped test. (follows pypy-dev discussion with
        L. de Haro)

diff --git a/pypy/jit/metainterp/test/test_warmspot.py 
b/pypy/jit/metainterp/test/test_warmspot.py
--- a/pypy/jit/metainterp/test/test_warmspot.py
+++ b/pypy/jit/metainterp/test/test_warmspot.py
@@ -260,6 +260,33 @@
                     pass   # other case
         self.meta_interp(f1, [18])
 
+    def test_bug_constant_int(self):
+        py.test.skip("crashes because a is a constant")
+        from pypy.rpython.lltypesystem import lltype, rffi
+        mydriver = JitDriver(greens=['a'], reds=['m'])
+        def f1(m, a):
+            while m > 0:
+                mydriver.jit_merge_point(a=a, m=m)
+                m = m - 1
+        def entry(m):
+            f1(m, 42)
+        self.meta_interp(entry, [18])
+
+    def test_bug_constant_instance(self):
+        py.test.skip("crashes because a is a constant")
+        from pypy.rpython.lltypesystem import lltype, rffi
+        mydriver = JitDriver(greens=['a'], reds=['m'])
+        class A(object):
+            pass
+        a1 = A()
+        def f1(m, a):
+            while m > 0:
+                mydriver.jit_merge_point(a=a, m=m)
+                m = m - 1
+        def entry(m):
+            f1(m, a1)
+        self.meta_interp(entry, [18])
+
     def test_bug_constant_rawptrs(self):
         py.test.skip("crashes because a is a constant")
         from pypy.rpython.lltypesystem import lltype, rffi
diff --git a/pypy/translator/unsimplify.py b/pypy/translator/unsimplify.py
--- a/pypy/translator/unsimplify.py
+++ b/pypy/translator/unsimplify.py
@@ -102,7 +102,14 @@
                 # then it's ok to recreate its value in the target block.
                 # If not, then we have a problem :-)
                 from pypy.rpython.lltypesystem import lltype
-                assert v.concretetype is lltype.Void
+                if v.concretetype is not lltype.Void:
+                    raise Exception(
+                        "The variable %r of type %r was not explicitly listed"
+                        " in _forcelink.  This issue can be caused by a"
+                        " jitdriver.jit_merge_point() where some variable"
+                        " containing an int or str or instance is actually"
+                        " known to be constant, e.g. always 42." % (
+                        v, v.concretetype))
                 c = Constant(None, lltype.Void)
                 w = varmap[v]
                 newop = SpaceOperation('same_as', [c], w)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to