[pypy-commit] pypy default: (alex, arigato) ahhh, fix a bug with unrolling copystrcontent where the dst is not virtual

alex_gaynor noreply at buildbot.pypy.org
Wed Nov 6 18:24:57 CET 2013


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: 
Changeset: r67865:03c7f7be80bb
Date: 2013-11-06 09:24 -0800
http://bitbucket.org/pypy/pypy/changeset/03c7f7be80bb/

Log:	(alex, arigato) ahhh, fix a bug with unrolling copystrcontent where
	the dst is not virtual

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
@@ -5125,14 +5125,16 @@
     def test_str_copy_virtual_src_concrete_dst(self):
         ops = """
         [p0]
-        p1 = newstr(1)
+        p1 = newstr(2)
         strsetitem(p1, 0, 101)
-        copystrcontent(p1, p0, 0, 0, 1)
+        strsetitem(p1, 1, 102)
+        copystrcontent(p1, p0, 0, 0, 2)
         finish(p0)
         """
         expected = """
         [p0]
         strsetitem(p0, 0, 101)
+        strsetitem(p0, 1, 102)
         finish(p0)
         """
         self.optimize_strunicode_loop(ops, expected)
diff --git a/rpython/jit/metainterp/optimizeopt/vstring.py b/rpython/jit/metainterp/optimizeopt/vstring.py
--- a/rpython/jit/metainterp/optimizeopt/vstring.py
+++ b/rpython/jit/metainterp/optimizeopt/vstring.py
@@ -529,12 +529,12 @@
                 if dst_virtual:
                     dst.setitem(index + dst_start, vresult)
                 else:
-                    op = ResOperation(mode.STRSETITEM, [
+                    new_op = ResOperation(mode.STRSETITEM, [
                         op.getarg(1),
                         ConstInt(index + dst_start),
                         vresult.force_box(self),
                     ], None)
-                    self.emit_operation(op)
+                    self.emit_operation(new_op)
         else:
             copy_str_content(self,
                 src.force_box(self),


More information about the pypy-commit mailing list