Commits

wlav committed e1f77fb Merge

merge default into branch and nudge the annotator; translation works again

  • Participants
  • Parent commits 86b72e5, f7a2f8b
  • Branches reflex-support

Comments (0)

Files changed (4)

File pypy/jit/metainterp/optimizeopt/test/test_optimizebasic.py

         """
         expected = """
         []
-        p0 = newstr(11)
-        copystrcontent(s"hello world", p0, 0, 0, 11)
-        # Eventually this should just return s"hello", but ATM this test is
-        # just verifying that it doesn't return "\0\0\0\0\0", so being
-        # slightly underoptimized is ok.
-        p1 = newstr(5)
-        copystrcontent(p0, p1, 0, 0, 5)
-        finish(p1)
+        finish(s"hello")
         """
         self.optimize_strunicode_loop(ops, expected)
 
         """
         expected = """
         [i1]
-        p0 = newstr(6)
-        copystrcontent(s"hello!", p0, 0, 0, 6)
-        p1 = newstr(12)
-        copystrcontent(p0, p1, 0, 0, 6)
-        copystrcontent(s"abc123", p1, 0, 6, 6)
-        i0 = strgetitem(p1, i1)
+        i0 = strgetitem(s"hello!abc123", i1)
         finish(i0)
         """
         self.optimize_strunicode_loop(ops, expected)
         """
         expected = """
         []
-        p0 = newstr(6)
-        copystrcontent(s"hello!", p0, 0, 0, 6)
-        i0 = strgetitem(p0, 0)
-        finish(i0)
+        finish(104)
         """
         self.optimize_strunicode_loop(ops, expected)
 
         """
         self.optimize_strunicode_loop(ops, expected)
 
+    def test_str_copy_constant_virtual(self):
+        ops = """
+        []
+        p0 = newstr(10)
+        copystrcontent(s"abcd", p0, 0, 0, 4)
+        strsetitem(p0, 4, 101)
+        copystrcontent(s"fghij", p0, 0, 5, 5)
+        finish(p0)
+        """
+        expected = """
+        []
+        finish(s"abcdefghij")
+        """
+        self.optimize_strunicode_loop(ops, expected)
+
     def test_call_pure_vstring_const(self):
         py.test.skip("implement me")
         ops = """

File pypy/jit/metainterp/optimizeopt/vstring.py

 
     def optimize_COPYSTRCONTENT(self, op):
         self._optimize_COPYSTRCONTENT(op, mode_string)
+
     def optimize_COPYUNICODECONTENT(self, op):
         self._optimize_COPYSTRCONTENT(op, mode_unicode)
 
 
         if length.is_constant() and length.box.getint() == 0:
             return
-        elif (src.is_virtual() and dst.is_virtual() and srcstart.is_constant() and
-            dststart.is_constant() and length.is_constant()):
+        elif ((src.is_virtual() or src.is_constant()) and dst.is_virtual() and
+            srcstart.is_constant() and dststart.is_constant() and length.is_constant()):
 
             src_start = srcstart.force_box(self).getint()
             dst_start = dststart.force_box(self).getint()

File pypy/module/array/interp_array.py

 from pypy.objspace.std.multimethod import FailedToImplement
 from pypy.objspace.std.stdtypedef import SMM, StdTypeDef
 from pypy.objspace.std.register_all import register_all
+from pypy.rlib import jit
 from pypy.rlib.rarithmetic import ovfcheck, widen
 from pypy.rlib.unroll import unrolling_iterable
 from pypy.rlib.objectmodel import specialize, keepalive_until_here
         self.setlen(0)
         self.fromsequence(w_lst)
 
+    # We can't look into this function until ptradd works with things (in the
+    # JIT) other than rffi.CCHARP
+    @jit.dont_look_inside
     def delslice__Array_ANY_ANY(space, self, w_i, w_j):
         i = space.int_w(w_i)
         if i < 0:
             rffi.c_memcpy(
                 rffi.cast(rffi.VOIDP, rffi.ptradd(self.buffer, i)),
                 rffi.cast(rffi.VOIDP, rffi.ptradd(oldbuffer, j)),
-                (self.len - j) * mytype.bytes)
+                (self.len - j) * mytype.bytes
+            )
         self.len -= j - i
         self.allocated = self.len
         if oldbuffer:
             lltype.free(oldbuffer, flavor='raw')
 
-
     # Add and mul methods
 
     def add__Array_Array(space, self, other):

File pypy/module/cppyy/interp_cppyy.py

         self.functions = debug.make_sure_not_resized(functions)
 
     def is_static(self):
-        if not isinstance(self.functions[0], CPPFunction):
-            return self.space.w_False
-        return self.space.w_True
-        #self.space.wrap(isinstance(self.functions[0], CPPFunction))
+        f = self.functions[0]
+        assert isinstance(f, CPPMethod)
+        self.space.wrap(isinstance(f, CPPFunction))
 
     @jit.unroll_safe
     @unwrap_spec(args_w='args_w')