Author: Alex Gaynor <[email protected]>
Branch: inline-virtualref
Changeset: r60219:6d12a7821174
Date: 2013-01-19 13:27 -0800
http://bitbucket.org/pypy/pypy/changeset/6d12a7821174/

Log:    finally write a 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
@@ -656,6 +656,31 @@
         res = self.meta_interp(f, [10])
         assert res == 0
 
+    def test_force_virtual_vref(self):
+        myjitdriver = JitDriver(greens=[], reds=['n', 'ec'])
+
+        class ExecutionContext(object):
+            pass
+
+        class Frame(object):
+            pass
+
+        def f(n):
+            ec = ExecutionContext()
+            while n > 0:
+                myjitdriver.jit_merge_point(n=n, ec=ec)
+                frame = Frame()
+                ec.topframeref = virtual_ref(frame)
+                ec.topframeref()
+                frame_vref = ec.topframeref
+                ec.topframeref = vref_None
+                virtual_ref_finish(frame_vref, frame)
+                n -= 1
+            return n
+        res = self.meta_interp(f, [10])
+        assert res == 0
+        self.check_resops({'int_sub': 1, 'int_gt': 1, 'jump': 1})
+
 
 class TestLLtype(VRefTests, LLJitMixin):
     pass
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to