Author: Armin Rigo <ar...@tunes.org>
Branch: 
Changeset: r77165:078cf2a4aa22
Date: 2015-05-06 19:41 +0200
http://bitbucket.org/pypy/pypy/changeset/078cf2a4aa22/

Log:    Failing test

diff --git a/rpython/jit/metainterp/test/test_virtualizable.py 
b/rpython/jit/metainterp/test/test_virtualizable.py
--- a/rpython/jit/metainterp/test/test_virtualizable.py
+++ b/rpython/jit/metainterp/test/test_virtualizable.py
@@ -1737,6 +1737,42 @@
         res = self.meta_interp(main, [], listops=True)
         assert res == 42
 
+    def test_blackhole_should_also_force_virtualizables(self):
+        class A:
+            _virtualizable_ = ['x']
+            def __init__(self, x):
+                self.x = x
+
+        driver1 = JitDriver(greens=[], reds=['a'], virtualizables=['a'])
+        driver2 = JitDriver(greens=[], reds=['i'])
+
+        def f(a):
+            while a.x > 0:
+                driver1.jit_merge_point(a=a)
+                a.x -= 1
+
+        def main():
+            i = 10
+            while i > 0:
+                driver2.jit_merge_point(i=i)
+                a = A(10)
+                f(a)
+                # The interesting case is i==2.  We're running the rest of
+                # this function in the blackhole interp, because of this:
+                if i == 2:
+                    pass
+                # Here, 'a' has got a non-null vtable_token because f()
+                # is already completely JITted.  But the blackhole interp
+                # ignores it and reads the bogus value currently physically
+                # stored in a.x...
+                if a.x != 0:
+                    raise ValueError
+                i -= 1
+            return 42
+
+        res = self.meta_interp(main, [], listops=True, repeat=7)
+        assert res == 42
+
 
 class TestLLtype(ExplicitVirtualizableTests,
                  ImplicitVirtualizableTests,
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to