[pypy-commit] pypy result-in-resops: finish vstring

fijal noreply at buildbot.pypy.org
Wed Sep 26 14:37:06 CEST 2012


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: result-in-resops
Changeset: r57610:ae58c48dc8db
Date: 2012-09-26 14:36 +0200
http://bitbucket.org/pypy/pypy/changeset/ae58c48dc8db/

Log:	finish vstring

diff --git a/pypy/jit/metainterp/optimizeopt/test/test_optimizebasic.py b/pypy/jit/metainterp/optimizeopt/test/test_optimizebasic.py
--- a/pypy/jit/metainterp/optimizeopt/test/test_optimizebasic.py
+++ b/pypy/jit/metainterp/optimizeopt/test/test_optimizebasic.py
@@ -4069,7 +4069,7 @@
         p1 = newstr(2)
         strsetitem(p1, 0, i0)
         strsetitem(p1, 1, i1)
-        p3 = call(0, p2, p1, descr=strconcatdescr)
+        p3 = call_r(0, p2, p1, descr=strconcatdescr)
         jump(i1, i0, p3)
         """
         expected = """
@@ -4089,8 +4089,8 @@
     def test_str_concat_str_str_str(self):
         ops = """
         [p1, p2, p3]
-        p4 = call(0, p1, p2, descr=strconcatdescr)
-        p5 = call(0, p4, p3, descr=strconcatdescr)
+        p4 = call_r(0, p1, p2, descr=strconcatdescr)
+        p5 = call_r(0, p4, p3, descr=strconcatdescr)
         jump(p2, p3, p5)
         """
         expected = """
@@ -4111,7 +4111,7 @@
     def test_str_concat_str_cstr1(self):
         ops = """
         [p2]
-        p3 = call(0, p2, s"x", descr=strconcatdescr)
+        p3 = call_r(0, p2, s"x", descr=strconcatdescr)
         jump(p3)
         """
         expected = """
@@ -4128,9 +4128,9 @@
     def test_str_concat_consts(self):
         ops = """
         []
-        p1 = same_as(s"ab")
-        p2 = same_as(s"cde")
-        p3 = call(0, p1, p2, descr=strconcatdescr)
+        p1 = same_as_r(s"ab")
+        p2 = same_as_r(s"cde")
+        p3 = call_r(0, p1, p2, descr=strconcatdescr)
         escape(p3)
         jump()
         """
@@ -4147,8 +4147,8 @@
         p0 = newstr(1)
         strsetitem(p0, 0, i0)
         p1 = newstr(0)
-        p2 = call(0, p0, p1, descr=strconcatdescr)
-        i1 = call(0, p2, p0, descr=strequaldescr)
+        p2 = call_r(0, p0, p1, descr=strconcatdescr)
+        i1 = call_i(0, p2, p0, descr=strequaldescr)
         finish(i1)
         """
         expected = """
@@ -4163,8 +4163,8 @@
         p0 = newstr(0)
         p1 = newstr(1)
         strsetitem(p1, 0, i0)
-        p2 = call(0, p0, p1, descr=strconcatdescr)
-        i1 = call(0, p2, p1, descr=strequaldescr)
+        p2 = call_r(0, p0, p1, descr=strconcatdescr)
+        i1 = call_i(0, p2, p1, descr=strequaldescr)
         finish(i1)
         """
         expected = """
@@ -4176,7 +4176,7 @@
     def test_str_slice_1(self):
         ops = """
         [p1, i1, i2]
-        p2 = call(0, p1, i1, i2, descr=strslicedescr)
+        p2 = call_r(0, p1, i1, i2, descr=strslicedescr)
         jump(p2, i1, i2)
         """
         expected = """
@@ -4191,7 +4191,7 @@
     def test_str_slice_2(self):
         ops = """
         [p1, i2]
-        p2 = call(0, p1, 0, i2, descr=strslicedescr)
+        p2 = call_r(0, p1, 0, i2, descr=strslicedescr)
         jump(p2, i2)
         """
         expected = """
@@ -4205,8 +4205,8 @@
     def test_str_slice_3(self):
         ops = """
         [p1, i1, i2, i3, i4]
-        p2 = call(0, p1, i1, i2, descr=strslicedescr)
-        p3 = call(0, p2, i3, i4, descr=strslicedescr)
+        p2 = call_r(0, p1, i1, i2, descr=strslicedescr)
+        p3 = call_r(0, p2, i3, i4, descr=strslicedescr)
         jump(p3, i1, i2, i3, i4)
         """
         expected = """
@@ -4223,7 +4223,7 @@
     def test_str_slice_getitem1(self):
         ops = """
         [p1, i1, i2, i3]
-        p2 = call(0, p1, i1, i2, descr=strslicedescr)
+        p2 = call_r(0, p1, i1, i2, descr=strslicedescr)
         i4 = strgetitem(p2, i3)
         escape(i4)
         jump(p1, i1, i2, i3)
@@ -4244,7 +4244,7 @@
         p1 = newstr(2)
         strsetitem(p1, 0, i3)
         strsetitem(p1, 1, i4)
-        p2 = call(0, p1, 1, 2, descr=strslicedescr)
+        p2 = call_r(0, p1, 1, 2, descr=strslicedescr)
         i5 = strgetitem(p2, 0)
         escape(i5)
         jump(i3, i4)
@@ -4259,8 +4259,8 @@
     def test_str_slice_concat(self):
         ops = """
         [p1, i1, i2, p2]
-        p3 = call(0, p1, i1, i2, descr=strslicedescr)
-        p4 = call(0, p3, p2, descr=strconcatdescr)
+        p3 = call_r(0, p1, i1, i2, descr=strslicedescr)
+        p4 = call_r(0, p3, p2, descr=strconcatdescr)
         jump(p4, i1, i2, p2)
         """
         expected = """
@@ -4280,7 +4280,7 @@
         []
         p0 = newstr(11)
         copystrcontent(s"hello world", p0, 0, 0, 11)
-        p1 = call(0, p0, 0, 5, descr=strslicedescr)
+        p1 = call_r(0, p0, 0, 5, descr=strslicedescr)
         finish(p1)
         """
         expected = """
@@ -4318,7 +4318,7 @@
     def test_str_equal_noop1(self):
         ops = """
         [p1, p2]
-        i0 = call(0, p1, p2, descr=strequaldescr)
+        i0 = call_i(0, p1, p2, descr=strequaldescr)
         escape(i0)
         jump(p1, p2)
         """
@@ -4327,8 +4327,8 @@
     def test_str_equal_noop2(self):
         ops = """
         [p1, p2, p3]
-        p4 = call(0, p1, p2, descr=strconcatdescr)
-        i0 = call(0, p3, p4, descr=strequaldescr)
+        p4 = call_r(0, p1, p2, descr=strconcatdescr)
+        i0 = call_i(0, p3, p4, descr=strequaldescr)
         escape(i0)
         jump(p1, p2, p3)
         """
@@ -4340,7 +4340,7 @@
         p4 = newstr(i3)
         copystrcontent(p1, p4, 0, 0, i1)
         copystrcontent(p2, p4, 0, i1, i2)
-        i0 = call(0, p3, p4, descr=strequaldescr)
+        i0 = call_i(0, p3, p4, descr=strequaldescr)
         escape(i0)
         jump(p1, p2, p3)
         """
@@ -4349,15 +4349,15 @@
     def test_str_equal_slice1(self):
         ops = """
         [p1, i1, i2, p3]
-        p4 = call(0, p1, i1, i2, descr=strslicedescr)
-        i0 = call(0, p4, p3, descr=strequaldescr)
+        p4 = call_r(0, p1, i1, i2, descr=strslicedescr)
+        i0 = call_i(0, p4, p3, descr=strequaldescr)
         escape(i0)
         jump(p1, i1, i2, p3)
         """
         expected = """
         [p1, i1, i2, p3]
         i3 = int_sub(i2, i1)
-        i0 = call(0, p1, i1, i3, p3, descr=streq_slice_checknull_descr)
+        i0 = call_i(0, p1, i1, i3, p3, descr=streq_slice_checknull_descr)
         escape(i0)
         jump(p1, i1, i2, p3)
         """
@@ -4366,15 +4366,15 @@
     def test_str_equal_slice2(self):
         ops = """
         [p1, i1, i2, p3]
-        p4 = call(0, p1, i1, i2, descr=strslicedescr)
-        i0 = call(0, p3, p4, descr=strequaldescr)
+        p4 = call_r(0, p1, i1, i2, descr=strslicedescr)
+        i0 = call_i(0, p3, p4, descr=strequaldescr)
         escape(i0)
         jump(p1, i1, i2, p3)
         """
         expected = """
         [p1, i1, i2, p3]
         i4 = int_sub(i2, i1)
-        i0 = call(0, p1, i1, i4, p3, descr=streq_slice_checknull_descr)
+        i0 = call_i(0, p1, i1, i4, p3, descr=streq_slice_checknull_descr)
         escape(i0)
         jump(p1, i1, i2, p3)
         """
@@ -4384,8 +4384,8 @@
         ops = """
         [p1, i1, i2, p3]
         guard_nonnull(p3) []
-        p4 = call(0, p1, i1, i2, descr=strslicedescr)
-        i0 = call(0, p3, p4, descr=strequaldescr)
+        p4 = call_r(0, p1, i1, i2, descr=strslicedescr)
+        i0 = call_i(0, p3, p4, descr=strequaldescr)
         escape(i0)
         jump(p1, i1, i2, p3)
         """
@@ -4393,7 +4393,7 @@
         [p1, i1, i2, p3]
         guard_nonnull(p3) []
         i4 = int_sub(i2, i1)
-        i0 = call(0, p1, i1, i4, p3, descr=streq_slice_nonnull_descr)
+        i0 = call_i(0, p1, i1, i4, p3, descr=streq_slice_nonnull_descr)
         escape(i0)
         jump(p1, i1, i2, p3)
         """
@@ -4402,15 +4402,15 @@
     def test_str_equal_slice4(self):
         ops = """
         [p1, i1, i2]
-        p3 = call(0, p1, i1, i2, descr=strslicedescr)
-        i0 = call(0, p3, s"x", descr=strequaldescr)
+        p3 = call_r(0, p1, i1, i2, descr=strslicedescr)
+        i0 = call_i(0, p3, s"x", descr=strequaldescr)
         escape(i0)
         jump(p1, i1, i2)
         """
         expected = """
         [p1, i1, i2]
         i3 = int_sub(i2, i1)
-        i0 = call(0, p1, i1, i3, 120, descr=streq_slice_char_descr)
+        i0 = call_i(0, p1, i1, i3, 120, descr=streq_slice_char_descr)
         escape(i0)
         jump(p1, i1, i2)
         """
@@ -4419,17 +4419,17 @@
     def test_str_equal_slice5(self):
         ops = """
         [p1, i1, i2, i3]
-        p4 = call(0, p1, i1, i2, descr=strslicedescr)
+        p4 = call_r(0, p1, i1, i2, descr=strslicedescr)
         p5 = newstr(1)
         strsetitem(p5, 0, i3)
-        i0 = call(0, p5, p4, descr=strequaldescr)
+        i0 = call_i(0, p5, p4, descr=strequaldescr)
         escape(i0)
         jump(p1, i1, i2, i3)
         """
         expected = """
         [p1, i1, i2, i3]
         i4 = int_sub(i2, i1)
-        i0 = call(0, p1, i1, i4, i3, descr=streq_slice_char_descr)
+        i0 = call_i(0, p1, i1, i4, i3, descr=streq_slice_char_descr)
         escape(i0)
         jump(p1, i1, i2, i3)
         """
@@ -4438,7 +4438,7 @@
     def test_str_equal_none1(self):
         ops = """
         [p1]
-        i0 = call(0, p1, NULL, descr=strequaldescr)
+        i0 = call_i(0, p1, NULL, descr=strequaldescr)
         escape(i0)
         jump(p1)
         """
@@ -4453,7 +4453,7 @@
     def test_str_equal_none2(self):
         ops = """
         [p1]
-        i0 = call(0, NULL, p1, descr=strequaldescr)
+        i0 = call_i(0, NULL, p1, descr=strequaldescr)
         escape(i0)
         jump(p1)
         """
@@ -4469,14 +4469,14 @@
         ops = """
         [p1]
         guard_nonnull(p1) []
-        i0 = call(0, p1, s"hello world", descr=strequaldescr)
+        i0 = call_i(0, p1, s"hello world", descr=strequaldescr)
         escape(i0)
         jump(p1)
         """
         expected = """
         [p1]
         guard_nonnull(p1) []
-        i0 = call(0, p1, s"hello world", descr=streq_nonnull_descr)
+        i0 = call_i(0, p1, s"hello world", descr=streq_nonnull_descr)
         escape(i0)
         jump(p1)
         """
@@ -4486,7 +4486,7 @@
         ops = """
         [p1]
         guard_nonnull(p1) []
-        i0 = call(0, p1, s"", descr=strequaldescr)
+        i0 = call_i(0, p1, s"", descr=strequaldescr)
         escape(i0)
         jump(p1)
         """
@@ -4504,14 +4504,14 @@
         ops = """
         [p1]
         guard_nonnull(p1) []
-        i0 = call(0, p1, s"x", descr=strequaldescr)
+        i0 = call_i(0, p1, s"x", descr=strequaldescr)
         escape(i0)
         jump(p1)
         """
         expected = """
         [p1]
         guard_nonnull(p1) []
-        i0 = call(0, p1, 120, descr=streq_nonnull_char_descr)
+        i0 = call_i(0, p1, 120, descr=streq_nonnull_char_descr)
         escape(i0)
         jump(p1)
         """
@@ -4520,8 +4520,8 @@
     def test_str_equal_nonnull4(self):
         ops = """
         [p1, p2]
-        p4 = call(0, p1, p2, descr=strconcatdescr)
-        i0 = call(0, s"hello world", p4, descr=strequaldescr)
+        p4 = call_r(0, p1, p2, descr=strconcatdescr)
+        i0 = call_i(0, s"hello world", p4, descr=strequaldescr)
         escape(i0)
         jump(p1, p2)
         """
@@ -4533,7 +4533,7 @@
         p4 = newstr(i3)
         copystrcontent(p1, p4, 0, 0, i1)
         copystrcontent(p2, p4, 0, i1, i2)
-        i0 = call(0, s"hello world", p4, descr=streq_nonnull_descr)
+        i0 = call_i(0, s"hello world", p4, descr=streq_nonnull_descr)
         escape(i0)
         jump(p1, p2)
         """
@@ -4543,7 +4543,7 @@
         ops = """
         [i1]
         p1 = newstr(0)
-        i0 = call(0, p1, s"", descr=strequaldescr)
+        i0 = call_i(0, p1, s"", descr=strequaldescr)
         escape(i0)
         jump(i1)
         """
@@ -4559,7 +4559,7 @@
         [i1]
         p1 = newstr(1)
         strsetitem(p1, 0, i1)
-        i0 = call(0, p1, s"x", descr=strequaldescr)
+        i0 = call_i(0, p1, s"x", descr=strequaldescr)
         escape(i0)
         jump(i1)
         """
@@ -4577,7 +4577,7 @@
         p1 = newstr(2)
         strsetitem(p1, 0, i1)
         strsetitem(p1, 1, i2)
-        i0 = call(0, p1, s"xy", descr=strequaldescr)
+        i0 = call_i(0, p1, s"xy", descr=strequaldescr)
         escape(i0)
         jump(i1, i2)
         """
@@ -4586,7 +4586,7 @@
         p1 = newstr(2)
         strsetitem(p1, 0, i1)
         strsetitem(p1, 1, i2)
-        i0 = call(0, p1, s"xy", descr=streq_lengthok_descr)
+        i0 = call_i(0, p1, s"xy", descr=streq_lengthok_descr)
         escape(i0)
         jump(i1, i2)
         """
@@ -4595,13 +4595,13 @@
     def test_str_equal_chars3(self):
         ops = """
         [p1]
-        i0 = call(0, s"x", p1, descr=strequaldescr)
+        i0 = call_i(0, s"x", p1, descr=strequaldescr)
         escape(i0)
         jump(p1)
         """
         expected = """
         [p1]
-        i0 = call(0, p1, 120, descr=streq_checknull_char_descr)
+        i0 = call_i(0, p1, 120, descr=streq_checknull_char_descr)
         escape(i0)
         jump(p1)
         """
@@ -4612,7 +4612,7 @@
         [i1]
         p1 = newstr(1)
         strsetitem(p1, 0, i1)
-        i0 = call(0, s"xy", p1, descr=strequaldescr)
+        i0 = call_i(0, s"xy", p1, descr=strequaldescr)
         escape(i0)
         jump(i1)
         """
@@ -4626,7 +4626,7 @@
     def test_str2unicode_constant(self):
         ops = """
         []
-        p0 = call(0, "xy", descr=s2u_descr)      # string -> unicode
+        p0 = call_r(0, "xy", descr=s2u_descr)      # string -> unicode
         escape(p0)
         jump()
         """
@@ -4640,7 +4640,7 @@
     def test_str2unicode_nonconstant(self):
         ops = """
         [p0]
-        p1 = call(0, p0, descr=s2u_descr)      # string -> unicode
+        p1 = call_r(0, p0, descr=s2u_descr)      # string -> unicode
         escape(p1)
         jump(p1)
         """
diff --git a/pypy/jit/metainterp/optimizeopt/vstring.py b/pypy/jit/metainterp/optimizeopt/vstring.py
--- a/pypy/jit/metainterp/optimizeopt/vstring.py
+++ b/pypy/jit/metainterp/optimizeopt/vstring.py
@@ -6,7 +6,7 @@
 from pypy.jit.metainterp.optimizeopt.optimizer import llhelper, REMOVED
 from pypy.jit.metainterp.optimizeopt.util import make_dispatcher_method
 from pypy.jit.metainterp.resoperation import rop, Const, ConstInt, ConstPtr,\
-     BoxInt, REF, INT, create_resop_1, create_resop_2, create_resop,\
+     REF, INT, create_resop_1, create_resop_2, create_resop,\
      create_resop_3
 from pypy.rlib.objectmodel import specialize, we_are_translated
 from pypy.rlib.unroll import unrolling_iterable
@@ -68,7 +68,7 @@
     @specialize.arg(1)
     def get_constant_string_spec(self, mode):
         if self.is_constant():
-            s = self.box.getref(lltype.Ptr(mode.LLTYPE))
+            s = self.op.getref(lltype.Ptr(mode.LLTYPE))
             return mode.hlstr(s)
         else:
             return None
@@ -278,8 +278,8 @@
             s1 = self.vstr.get_constant_string_spec(mode)
             if s1 is None:
                 return None
-            start = self.vstart.box.getint()
-            length = self.vlength.box.getint()
+            start = self.vstart.op.getint()
+            length = self.vlength.op.getint()
             assert start >= 0
             assert length >= 0
             return s1[start : start + length]
@@ -319,10 +319,9 @@
             charbox = _strgetitem(string_optimizer, srcbox, srcoffsetbox, mode)
             srcoffsetbox = _int_add(string_optimizer, srcoffsetbox, CONST_1)
             assert not targetbox.is_constant()
-            string_optimizer.emit_operation(ResOperation(mode.STRSETITEM, [targetbox,
-                                                                           offsetbox,
-                                                                           charbox],
-                                              None))
+            op = create_resop_3(mode.STRSETITEM, None, targetbox, offsetbox,
+                                charbox)
+            string_optimizer.emit_operation(op)
             offsetbox = _int_add(string_optimizer, offsetbox, CONST_1)
     else:
         if need_next_offset:
@@ -356,9 +355,9 @@
             return box1
         if isinstance(box1, ConstInt):
             return ConstInt(box1.value - box2.value)
-    resbox = BoxInt()
-    string_optimizer.emit_operation(ResOperation(rop.INT_SUB, [box1, box2], resbox))
-    return resbox
+    op = create_resop_2(rop.INT_SUB, 0, box1, box2)
+    string_optimizer.emit_operation(op)
+    return op
 
 def _strgetitem(string_optimizer, strbox, indexbox, mode, resbox=None):
     if isinstance(strbox, ConstPtr) and isinstance(indexbox, ConstInt):
@@ -368,11 +367,11 @@
         else:
             s = strbox.getref(lltype.Ptr(rstr.UNICODE))
             return ConstInt(ord(s.chars[indexbox.getint()]))
-    if resbox is None:
-        resbox = BoxInt()
-    string_optimizer.emit_operation(ResOperation(mode.STRGETITEM, [strbox, indexbox],
-                                                 resbox))
-    return resbox
+    op = create_resop_2(mode.STRGETITEM, 0, strbox, indexbox)
+    if resbox is not None:
+        string_optimizer.replace(resbox, op)
+    string_optimizer.emit_operation(op)
+    return op
 
 
 class OptString(optimizer.Optimization):
@@ -390,10 +389,9 @@
         self.setvalue(op, vvalue)
         return vvalue
 
-    def make_vstring_slice(self, box, source_op, mode):
-        xxx
-        vvalue = VStringSliceValue(box, source_op, mode)
-        self.make_equal_to(box, vvalue)
+    def make_vstring_slice(self, op, mode):
+        vvalue = VStringSliceValue(op, mode)
+        self.setvalue(op, vvalue)
         return vvalue
 
     def optimize_NEWSTR(self, op):
@@ -458,7 +456,7 @@
         if isinstance(value, VStringConcatValue) and vindex.is_constant():
             len1box = value.left.getstrlen(self, mode, None)
             if isinstance(len1box, ConstInt):
-                index = vindex.box.getint()
+                index = vindex.op.getint()
                 len1 = len1box.getint()
                 if index < len1:
                     return self.strgetitem(value.left, vindex, mode)
@@ -500,7 +498,7 @@
         dststart = self.getvalue(op.getarg(3))
         length = self.getvalue(op.getarg(4))
 
-        if length.is_constant() and length.box.getint() == 0:
+        if length.is_constant() and length.op.getint() == 0:
             return
         elif (src.is_virtual() and dst.is_virtual() and srcstart.is_constant() and
             dststart.is_constant() and length.is_constant()):
@@ -568,7 +566,7 @@
             u = unicode(s)
         except UnicodeDecodeError:
             return False
-        self.make_constant(op.result, get_const_ptr_for_unicode(u))
+        self.make_constant(op, get_const_ptr_for_unicode(u))
         self.last_emitted_operation = REMOVED
         return True
 
@@ -606,7 +604,7 @@
                                 vstart.force_box(self))
             vstart = self.getvalue(startbox)
         #
-        value = self.make_vstring_slice(op.result, op, mode)
+        value = self.make_vstring_slice(op, mode)
         value.setup(vstr, vstart, self.getvalue(lengthbox))
         return True
 
@@ -621,35 +619,40 @@
             isinstance(l2box, ConstInt) and
             l1box.value != l2box.value):
             # statically known to have a different length
-            self.make_constant(op.result, CONST_0)
+            self.make_constant(op, CONST_0)
             return True
         #
-        if self.handle_str_equal_level1(v1, v2, op.result, mode):
+        if self.handle_str_equal_level1(v1, v2, op, mode):
             return True
-        if self.handle_str_equal_level1(v2, v1, op.result, mode):
+        if self.handle_str_equal_level1(v2, v1, op, mode):
             return True
-        if self.handle_str_equal_level2(v1, v2, op.result, mode):
+        if self.handle_str_equal_level2(v1, v2, op, mode):
             return True
-        if self.handle_str_equal_level2(v2, v1, op.result, mode):
+        if self.handle_str_equal_level2(v2, v1, op, mode):
             return True
         #
         if v1.is_nonnull() and v2.is_nonnull():
-            if l1box is not None and l2box is not None and l1box.same_box(l2box):
+            if l1box is not None and l2box is not None and l1box.eq_value(l2box):
                 do = EffectInfo.OS_STREQ_LENGTHOK
             else:
                 do = EffectInfo.OS_STREQ_NONNULL
             self.generate_modified_call(do, [v1.force_box(self),
-                                             v2.force_box(self)], op.result, mode)
+                                             v2.force_box(self)], op, mode)
             return True
         return False
 
     def handle_str_equal_level1(self, v1, v2, resultbox, mode):
         l2box = v2.getstrlen(None, mode, None)
+        seo = self.optimizer.send_extra_operation
         if isinstance(l2box, ConstInt):
             if l2box.value == 0:
                 lengthbox = v1.getstrlen(self, mode, None)
-                seo = self.optimizer.send_extra_operation
-                seo(ResOperation(rop.INT_EQ, [lengthbox, CONST_0], resultbox))
+                if lengthbox.is_constant():
+                    op = ConstInt(lengthbox.eq_value(CONST_0))
+                else:
+                    op = create_resop_2(rop.INT_EQ, 0, lengthbox, CONST_0)
+                    seo(op)
+                self.replace(resultbox, op)
                 return True
             if l2box.value == 1:
                 l1box = v1.getstrlen(None, mode, None)
@@ -657,10 +660,10 @@
                     # comparing two single chars
                     vchar1 = self.strgetitem(v1, optimizer.CVAL_ZERO, mode)
                     vchar2 = self.strgetitem(v2, optimizer.CVAL_ZERO, mode)
-                    seo = self.optimizer.send_extra_operation
-                    seo(ResOperation(rop.INT_EQ, [vchar1.force_box(self),
-                                                  vchar2.force_box(self)],
-                                     resultbox))
+                    op = create_resop_2(rop.INT_EQ, 0, vchar1.force_box(self),
+                                        vchar2.force_box(self))
+                    seo(op)
+                    self.replace(resultbox, op)
                     return True
                 if isinstance(v1, VStringSliceValue):
                     vchar = self.strgetitem(v2, optimizer.CVAL_ZERO, mode)
@@ -679,9 +682,9 @@
             if v1.is_null():
                 self.make_constant(resultbox, CONST_1)
                 return True
-            op = ResOperation(rop.PTR_EQ, [v1.force_box(self),
-                                           llhelper.CONST_NULL],
-                              resultbox)
+            op = create_resop_2(rop.PTR_EQ, 0, v1.force_box(self),
+                                llhelper.CONST_NULL)
+            self.replace(resultbox, op)
             self.emit_operation(op)
             return True
         #
@@ -717,8 +720,9 @@
         oopspecindex += mode.OS_offset
         cic = self.optimizer.metainterp_sd.callinfocollection
         calldescr, func = cic.callinfo_for_oopspec(oopspecindex)
-        op = ResOperation(rop.CALL, [ConstInt(func)] + args, result,
+        op = create_resop(rop.CALL_i, 0, [ConstInt(func)] + args,
                           descr=calldescr)
+        self.replace(result, op)
         self.emit_operation(op)
 
     def propagate_forward(self, op):


More information about the pypy-commit mailing list