[pypy-svn] r62847 - pypy/branch/pyjitpl5/pypy/jit/metainterp/test

fijal at codespeak.net fijal at codespeak.net
Wed Mar 11 11:57:59 CET 2009


Author: fijal
Date: Wed Mar 11 11:57:59 2009
New Revision: 62847

Modified:
   pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_virtualizable.py
Log:
this is the original test, works


Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_virtualizable.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_virtualizable.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_virtualizable.py	Wed Mar 11 11:57:59 2009
@@ -394,7 +394,33 @@
 
         res = self.meta_interp(f, [30])
         assert res == f(10)
-        
+    
+    def test_read_after_loop_2(self):
+        jitdriver = JitDriver(greens = [], reds = ['frame', 'n'],
+                              virtualizables = ['frame'])
+
+        class Frame(object):
+            _virtualizable2_ = True
+
+            def __init__(self, x):
+                self.x = x
+
+        def f(n):
+            frame = Frame(10)
+            while n > 0:
+                jitdriver.can_enter_jit(frame=frame, n=n)
+                jitdriver.jit_merge_point(frame=frame, n=n)
+                frame.x = hint(frame.x, promote=True)
+                frame.x += 1
+                if n == 2:
+                    break
+                frame.x -= 1
+                n -= 1
+            return frame.x
+
+        res = self.meta_interp(f, [30])
+        assert res == 11
+
 
     def test_external_read(self):
         py.test.skip("Fails")



More information about the Pypy-commit mailing list