[pypy-commit] pypy default: Test and fix (this should fix test_pypy_c.test_generators)

arigo noreply at buildbot.pypy.org
Sun Sep 27 09:49:24 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r79859:afce8682985f
Date: 2015-09-27 09:49 +0200
http://bitbucket.org/pypy/pypy/changeset/afce8682985f/

Log:	Test and fix (this should fix test_pypy_c.test_generators)

diff --git a/rpython/jit/metainterp/optimizeopt/heap.py b/rpython/jit/metainterp/optimizeopt/heap.py
--- a/rpython/jit/metainterp/optimizeopt/heap.py
+++ b/rpython/jit/metainterp/optimizeopt/heap.py
@@ -72,7 +72,7 @@
     def do_setfield(self, optheap, op):
         # Update the state with the SETFIELD_GC/SETARRAYITEM_GC operation 'op'.
         structinfo = optheap.ensure_ptr_info_arg0(op)
-        arg1 = optheap.get_box_replacement(op.getarg(1))
+        arg1 = optheap.get_box_replacement(self._getvalue(op))
         if self.possible_aliasing(optheap, structinfo):
             self.force_lazy_setfield(optheap, op.getdescr())
             assert not self.possible_aliasing(optheap, structinfo)
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
@@ -5993,5 +5993,22 @@
         """
         self.optimize_loop(ops, expected)
 
+    def test_remove_multiple_setarrayitems(self):
+        ops = """
+        [p0, i1]
+        setarrayitem_gc(p0, 2, NULL, descr=gcarraydescr)
+        guard_value(i1, 42) []
+        setarrayitem_gc(p0, 2, NULL, descr=gcarraydescr)   # remove this
+        finish()
+        """
+        expected = """
+        [p0, i1]
+        setarrayitem_gc(p0, 2, NULL, descr=gcarraydescr)
+        guard_value(i1, 42) []
+        finish()
+        """
+        self.optimize_loop(ops, expected)
+
+
 class TestLLtype(BaseTestOptimizeBasic, LLtypeMixin):
     pass


More information about the pypy-commit mailing list