Author: Wim Lavrijsen <[email protected]>
Branch: reflex-support
Changeset: r58419:e1f77fb74300
Date: 2012-10-25 02:37 -0700
http://bitbucket.org/pypy/pypy/changeset/e1f77fb74300/
Log: merge default into branch and nudge the annotator; translation works
again
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
@@ -4306,14 +4306,7 @@
"""
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)
@@ -4963,12 +4956,7 @@
"""
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)
@@ -4984,10 +4972,7 @@
"""
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)
@@ -5067,6 +5052,21 @@
"""
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 = """
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
@@ -489,6 +489,7 @@
def optimize_COPYSTRCONTENT(self, op):
self._optimize_COPYSTRCONTENT(op, mode_string)
+
def optimize_COPYUNICODECONTENT(self, op):
self._optimize_COPYSTRCONTENT(op, mode_unicode)
@@ -507,8 +508,8 @@
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()
diff --git a/pypy/module/array/interp_array.py
b/pypy/module/array/interp_array.py
--- a/pypy/module/array/interp_array.py
+++ b/pypy/module/array/interp_array.py
@@ -9,6 +9,7 @@
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
@@ -466,6 +467,9 @@
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:
@@ -495,13 +499,13 @@
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):
diff --git a/pypy/module/cppyy/interp_cppyy.py
b/pypy/module/cppyy/interp_cppyy.py
--- a/pypy/module/cppyy/interp_cppyy.py
+++ b/pypy/module/cppyy/interp_cppyy.py
@@ -422,10 +422,9 @@
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')
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit