[pypy-commit] pypy store-sink-array: Bah. Add a test and fix a stupid bug.

arigo noreply at buildbot.pypy.org
Tue Jun 21 18:24:33 CEST 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: store-sink-array
Changeset: r45035:d5db3945650b
Date: 2011-06-21 16:48 +0200
http://bitbucket.org/pypy/pypy/changeset/d5db3945650b/

Log:	Bah. Add a test and fix a stupid bug.

diff --git a/pypy/jit/metainterp/optimizeopt/heap.py b/pypy/jit/metainterp/optimizeopt/heap.py
--- a/pypy/jit/metainterp/optimizeopt/heap.py
+++ b/pypy/jit/metainterp/optimizeopt/heap.py
@@ -319,7 +319,7 @@
                 else:
                     assert 0
                 pendingfields.append((op.getdescr(), value.box,
-                                      fieldvalue.get_key_box(), -1))
+                                      fieldvalue.get_key_box(), itemindex))
             else:
                 cf.force_lazy_setfield(self)
                 self.fixup_guard_situation()
diff --git a/pypy/jit/metainterp/test/test_ajit.py b/pypy/jit/metainterp/test/test_ajit.py
--- a/pypy/jit/metainterp/test/test_ajit.py
+++ b/pypy/jit/metainterp/test/test_ajit.py
@@ -2298,6 +2298,21 @@
         res = self.meta_interp(f, [1])
         assert res == f(1)
 
+    def test_remove_array_operations(self):
+        myjitdriver = JitDriver(greens = [], reds = ['a'])
+        class W_Int:
+            def __init__(self, intvalue):
+                self.intvalue = intvalue
+        def f(x):
+            a = [W_Int(x)]
+            while a[0].intvalue > 0:
+                myjitdriver.jit_merge_point(a=a)
+                a[0] = W_Int(a[0].intvalue - 3)
+            return a[0].intvalue
+        res = self.meta_interp(f, [100])
+        assert res == -2
+        #self.check_loops(getarrayitem_gc=0, setarrayitem_gc=0) -- xxx?
+
 class TestOOtype(BasicTests, OOJitMixin):
 
     def test_oohash(self):


More information about the pypy-commit mailing list