[pypy-commit] pypy heap-caching-during-tracing: setarrayitem does not influence the heap cache

cfbolz noreply at buildbot.pypy.org
Sat Jul 16 20:11:51 CEST 2011


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: heap-caching-during-tracing
Changeset: r45679:afd433b6fc94
Date: 2011-07-16 18:37 +0200
http://bitbucket.org/pypy/pypy/changeset/afd433b6fc94/

Log:	setarrayitem does not influence the heap cache

diff --git a/pypy/jit/metainterp/pyjitpl.py b/pypy/jit/metainterp/pyjitpl.py
--- a/pypy/jit/metainterp/pyjitpl.py
+++ b/pypy/jit/metainterp/pyjitpl.py
@@ -1648,7 +1648,8 @@
         # record the operation
         profiler = self.staticdata.profiler
         profiler.count_ops(opnum, RECORDED_OPS)
-        if opnum != rop.SETFIELD_GC and self.heap_cache:
+        if (self.heap_cache and opnum != rop.SETFIELD_GC and
+                opnum != rop.SETARRAYITEM_GC):
             if not (rop._NOSIDEEFFECT_FIRST <= opnum <= rop._NOSIDEEFFECT_LAST):
                 self.heap_cache = {}
         op = self.history.record(opnum, argboxes, resbox, descr)
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
@@ -113,6 +113,7 @@
         @jit.dont_look_inside
         def f(a):
             a.x = 5
+        l = [1]
         def fn(n):
             if n > 0:
                 a = a1
@@ -121,9 +122,11 @@
             a.x = n
             x1 = a.x
             f(a)
-            return a.x + x1
+            x2 = a.x
+            l[0] = x2
+            return a.x + x1 + x2
         res = self.interp_operations(fn, [7])
-        assert res == 5 + 7
+        assert res == 5 * 2 + 7
         self.check_operations_history(getfield_gc=1)
 
     def test_heap_caching_dont_store_same(self):


More information about the pypy-commit mailing list