[pypy-commit] pypy heap-caching-during-tracing: a passing test

cfbolz noreply at buildbot.pypy.org
Sat Jul 16 22:00:05 CEST 2011


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: heap-caching-during-tracing
Changeset: r45687:ca2a85b7eef9
Date: 2011-07-16 21:50 +0200
http://bitbucket.org/pypy/pypy/changeset/ca2a85b7eef9/

Log:	a passing test

diff --git a/pypy/jit/metainterp/test/test_tracingopts.py b/pypy/jit/metainterp/test/test_tracingopts.py
--- a/pypy/jit/metainterp/test/test_tracingopts.py
+++ b/pypy/jit/metainterp/test/test_tracingopts.py
@@ -208,3 +208,27 @@
         assert res == 5 * 2 + 7
         self.check_operations_history(getarrayitem_gc=1)
 
+    def test_array_and_getfield_interaction(self):
+        class A: pass
+        a1 = A()
+        a2 = A()
+        a1.l = a2.l = [0, 0]
+        def fn(n):
+            if n > 0:
+                a = a1
+            else:
+                a = a2
+                a.l = [0, 0]
+            a.x = 0
+            a.l[a.x] = n
+            a.x += 1
+            a.l[a.x] = n + 1
+            x1 = a.l[a.x]
+            a.x -= 1
+            x2 = a.l[a.x]
+            return x1 + x2
+        res = self.interp_operations(fn, [7])
+        assert res == 7 * 2 + 1
+        self.check_operations_history(setarrayitem_gc=2, setfield_gc=3,
+                                      getarrayitem_gc=0, getfield_gc=1)
+


More information about the pypy-commit mailing list