[pypy-commit] pypy invalidate-virtualrefs: a failing test

antocuni noreply at buildbot.pypy.org
Wed May 25 20:27:26 CEST 2011


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: invalidate-virtualrefs
Changeset: r44484:0caf8c042b5e
Date: 2011-05-25 17:31 +0200
http://bitbucket.org/pypy/pypy/changeset/0caf8c042b5e/

Log:	a failing test

diff --git a/pypy/jit/metainterp/test/test_virtualref.py b/pypy/jit/metainterp/test/test_virtualref.py
--- a/pypy/jit/metainterp/test/test_virtualref.py
+++ b/pypy/jit/metainterp/test/test_virtualref.py
@@ -1,7 +1,7 @@
 import py
 from pypy.rpython.lltypesystem import lltype, llmemory, lloperation
 from pypy.rlib.jit import JitDriver, dont_look_inside, vref_None
-from pypy.rlib.jit import virtual_ref, virtual_ref_finish
+from pypy.rlib.jit import virtual_ref, virtual_ref_finish, InvalidVirtualRef
 from pypy.rlib.objectmodel import compute_unique_id
 from pypy.jit.metainterp.test.support import LLJitMixin, OOJitMixin
 from pypy.jit.metainterp.resoperation import rop
@@ -549,6 +549,34 @@
         assert res == 1
         self.check_loops(new_with_vtable=2)     # vref, xy
 
+    def test_cannot_use_invalid_virtualref(self):
+        py.test.skip('fixme')
+        myjitdriver = JitDriver(greens = [], reds = ['n'])
+        #
+        class XY:
+            n = 0
+        #
+        def fn(n):
+            res = False
+            while n > 0:
+                myjitdriver.can_enter_jit(n=n)
+                myjitdriver.jit_merge_point(n=n)
+                xy = XY()
+                xy.n = n
+                vref = virtual_ref(xy)
+                virtual_ref_finish(vref, xy)
+                try:
+                    vref()
+                    res = False
+                except InvalidVirtualRef:
+                    res = True
+                n -= 1
+            return res
+        #
+        assert fn(10)
+        res = self.meta_interp(fn, [10])
+        assert res
+
 
 class TestLLtype(VRefTests, LLJitMixin):
     pass


More information about the pypy-commit mailing list