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

fijal at codespeak.net fijal at codespeak.net
Sat Feb 14 10:22:42 CET 2009


Author: fijal
Date: Sat Feb 14 10:22:42 2009
New Revision: 61866

Modified:
   pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_dlist.py
Log:
A test and a fix


Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_dlist.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_dlist.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_dlist.py	Sat Feb 14 10:22:42 2009
@@ -17,10 +17,26 @@
             return l[0]
 
         res = self.meta_interp(f, [10])
-        assert res == f(10)
-        
+        assert res == f(10)        
         self.check_loops(getitem=0, setitem=1, guard_exception=0,
-                         guard_no_exception=0)                
+                         guard_no_exception=0)
+
+    def test_list_escapes(self):
+        myjitdriver = JitDriver(greens = [], reds = ['n', 'l'])
+        def f(n):
+            l = [0] * (n + 1)
+            while n > 0:
+                myjitdriver.can_enter_jit(n=n, l=l)
+                myjitdriver.jit_merge_point(n=n, l=l)
+                x = l[0]
+                l[0] = x + 1
+                l[n] = n
+                n -= 1
+            return l[3]
+
+        res = self.meta_interp(f, [10])
+        assert res == f(10)
+        self.check_loops(setitem=2)
 
 class TestLLtype(ListTests, LLJitMixin):
     pass



More information about the Pypy-commit mailing list