[pypy-svn] r56043 - pypy/branch/oo-jit/pypy/jit/rainbow/test

fijal at codespeak.net fijal at codespeak.net
Mon Jun 23 22:23:20 CEST 2008


Author: fijal
Date: Mon Jun 23 22:23:18 2008
New Revision: 56043

Modified:
   pypy/branch/oo-jit/pypy/jit/rainbow/test/test_vdict.py
Log:
A test for dict escapes. Fail on lltypesystem for some obscure reason


Modified: pypy/branch/oo-jit/pypy/jit/rainbow/test/test_vdict.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/rainbow/test/test_vdict.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/rainbow/test/test_vdict.py	Mon Jun 23 22:23:18 2008
@@ -76,6 +76,39 @@
         self.check_insns({})
 
 
+
+    def test_dict_escape(self):
+        d1 = {1: 123, 2: 54, 3:84}
+        d2 = {1: 831, 2: 32, 3:81}
+
+        def getdict(n):
+            if n:
+                return d1
+            else:
+                return d2
+
+        class A:
+            pass
+
+        def f(n):
+            d = getdict(n)
+            x = A()
+            x.d = d
+            return x
+
+        a = []
+
+        def ll_function(n, i):
+            x = f(n)
+            a.append(x)
+            d = hint(x.d, deepfreeze=True)
+            res = d[i]
+            res = hint(res, variable=True)
+            return res
+
+        res = self.interpret(ll_function, [3, 2], [0, 1], policy=P_OOPSPEC)
+        assert res == 54
+
 class TestOOType(OOTypeMixin, VDictTest):
     type_system = "ootype"
 



More information about the Pypy-commit mailing list