[pypy-svn] r69871 - in pypy/branch/virtual-forcing/pypy: jit/metainterp/test rlib

arigo at codespeak.net arigo at codespeak.net
Thu Dec 3 18:01:47 CET 2009


Author: arigo
Date: Thu Dec  3 18:01:46 2009
New Revision: 69871

Added:
   pypy/branch/virtual-forcing/pypy/jit/metainterp/test/test_vref.py   (contents, props changed)
Modified:
   pypy/branch/virtual-forcing/pypy/rlib/jit.py
Log:
Adding the first test.


Added: pypy/branch/virtual-forcing/pypy/jit/metainterp/test/test_vref.py
==============================================================================
--- (empty file)
+++ pypy/branch/virtual-forcing/pypy/jit/metainterp/test/test_vref.py	Thu Dec  3 18:01:46 2009
@@ -0,0 +1,34 @@
+from pypy.rlib.jit import JitDriver, dont_look_inside, virtual_ref
+from pypy.jit.metainterp.test.test_basic import LLJitMixin, OOJitMixin
+
+
+class VRefTests:
+
+    def test_simple_no_access(self):
+        myjitdriver = JitDriver(greens = [], reds = ['n'])
+        #
+        class XY:
+            pass
+        class ExCtx:
+            pass
+        exctx = ExCtx()
+        #
+        @dont_look_inside
+        def externalfn():
+            return 1
+        #
+        def f(n):
+            while n > 0:
+                myjitdriver.can_enter_jit(n=n)
+                myjitdriver.jit_merge_point(n=n)
+                xy = XY()
+                exctx.topframeref = virtual_ref(xy)
+                n -= externalfn()
+                exctx.topframeref = None
+        #
+        self.meta_interp(f, [15])
+        self.check_loops(new_with_vtable=0)
+
+
+class TestLLtype(VRefTests, LLJitMixin):
+    pass

Modified: pypy/branch/virtual-forcing/pypy/rlib/jit.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/rlib/jit.py	(original)
+++ pypy/branch/virtual-forcing/pypy/rlib/jit.py	Thu Dec  3 18:01:46 2009
@@ -98,6 +98,9 @@
         hop.exception_cannot_occur()
         return hop.inputconst(lltype.Signed, _we_are_jitted)
 
+def virtual_ref(x):
+    return None        # XXX!
+
 # ____________________________________________________________
 # User interface for the hotpath JIT policy
 



More information about the Pypy-commit mailing list