[pypy-commit] pypy improve-heap-caching-tracing: next test that should pass

cfbolz noreply at buildbot.pypy.org
Fri Sep 2 15:13:30 CEST 2011


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: improve-heap-caching-tracing
Changeset: r47020:f3f43660f5e9
Date: 2011-09-02 11:46 +0200
http://bitbucket.org/pypy/pypy/changeset/f3f43660f5e9/

Log:	next test that should pass

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
@@ -357,7 +357,7 @@
         assert res == f(10, 1, 1)
         self.check_history(getarrayitem_gc=0, getfield_gc=0)
 
-    def test_heap_caching_pure(self):
+    def test_heap_caching_array_pure(self):
         class A(object):
             pass
         p1 = A()
@@ -405,3 +405,26 @@
         assert res == -7 + 7
         self.check_operations_history(getfield_gc=0)
         return
+
+
+    def test_heap_caching_multiple_objects(self):
+        class Gbl(object):
+            pass
+        g = Gbl()
+        class A(object):
+            pass
+        def fn(n):
+            a1 = A()
+            g.a = a1
+            a1.x = n - 2
+            a2 = A()
+            g.a = a2
+            a2.x = n - 3
+            return a1.x + a2.x
+        res = self.interp_operations(fn, [7])
+        assert res == 2 * 7 - 5
+        self.check_operations_history(getfield_gc=0)
+        res = self.interp_operations(fn, [-7])
+        assert res == 2 * -7 - 5
+        self.check_operations_history(getfield_gc=0)
+


More information about the pypy-commit mailing list