Author: Christian Tismer <[email protected]>
Branch:
Changeset: r48943:7c7c46d6a78d
Date: 2011-11-08 16:41 +0100
http://bitbucket.org/pypy/pypy/changeset/7c7c46d6a78d/
Log: Merge
diff --git a/lib_pypy/_ctypes/pointer.py b/lib_pypy/_ctypes/pointer.py
--- a/lib_pypy/_ctypes/pointer.py
+++ b/lib_pypy/_ctypes/pointer.py
@@ -124,7 +124,8 @@
# for now, we always allow types.pointer, else a lot of tests
# break. We need to rethink how pointers are represented, though
if my_ffitype is not ffitype and ffitype is not _ffi.types.void_p:
- raise ArgumentError, "expected %s instance, got %s" % (type(value),
ffitype)
+ raise ArgumentError("expected %s instance, got %s" % (type(value),
+ ffitype))
return value._get_buffer_value()
def _cast_addr(obj, _, tp):
diff --git a/pypy/jit/codewriter/effectinfo.py
b/pypy/jit/codewriter/effectinfo.py
--- a/pypy/jit/codewriter/effectinfo.py
+++ b/pypy/jit/codewriter/effectinfo.py
@@ -78,6 +78,9 @@
#
OS_MATH_SQRT = 100
+ # for debugging:
+ _OS_CANRAISE = set([OS_NONE, OS_STR2UNICODE, OS_LIBFFI_CALL])
+
def __new__(cls, readonly_descrs_fields, readonly_descrs_arrays,
write_descrs_fields, write_descrs_arrays,
extraeffect=EF_CAN_RAISE,
@@ -116,6 +119,8 @@
result.extraeffect = extraeffect
result.can_invalidate = can_invalidate
result.oopspecindex = oopspecindex
+ if result.check_can_raise():
+ assert oopspecindex in cls._OS_CANRAISE
cls._cache[key] = result
return result
@@ -125,6 +130,10 @@
def check_can_invalidate(self):
return self.can_invalidate
+ def check_is_elidable(self):
+ return (self.extraeffect == self.EF_ELIDABLE_CAN_RAISE or
+ self.extraeffect == self.EF_ELIDABLE_CANNOT_RAISE)
+
def check_forces_virtual_or_virtualizable(self):
return self.extraeffect >= self.EF_FORCES_VIRTUAL_OR_VIRTUALIZABLE
diff --git a/pypy/jit/codewriter/test/test_flatten.py
b/pypy/jit/codewriter/test/test_flatten.py
--- a/pypy/jit/codewriter/test/test_flatten.py
+++ b/pypy/jit/codewriter/test/test_flatten.py
@@ -5,7 +5,7 @@
from pypy.jit.codewriter.format import assert_format
from pypy.jit.codewriter import longlong
from pypy.jit.metainterp.history import AbstractDescr
-from pypy.rpython.lltypesystem import lltype, rclass, rstr
+from pypy.rpython.lltypesystem import lltype, rclass, rstr, rffi
from pypy.objspace.flow.model import SpaceOperation, Variable, Constant
from pypy.translator.unsimplify import varoftype
from pypy.rlib.rarithmetic import ovfcheck, r_uint, r_longlong, r_ulonglong
@@ -743,7 +743,6 @@
""", transform=True)
def test_force_cast(self):
- from pypy.rpython.lltypesystem import rffi
# NB: we don't need to test for INT here, the logic in jtransform is
# general enough so that if we have the below cases it should
# generalize also to INT
@@ -849,7 +848,6 @@
transform=True)
def test_force_cast_pointer(self):
- from pypy.rpython.lltypesystem import rffi
def h(p):
return rffi.cast(rffi.VOIDP, p)
self.encoding_test(h, [lltype.nullptr(rffi.CCHARP.TO)], """
@@ -857,7 +855,6 @@
""", transform=True)
def test_force_cast_floats(self):
- from pypy.rpython.lltypesystem import rffi
# Caststs to lltype.Float
def f(n):
return rffi.cast(lltype.Float, n)
@@ -964,7 +961,6 @@
""", transform=True)
def test_direct_ptradd(self):
- from pypy.rpython.lltypesystem import rffi
def f(p, n):
return lltype.direct_ptradd(p, n)
self.encoding_test(f, [lltype.nullptr(rffi.CCHARP.TO), 123], """
@@ -975,7 +971,6 @@
def check_force_cast(FROM, TO, operations, value):
"""Check that the test is correctly written..."""
- from pypy.rpython.lltypesystem import rffi
import re
r = re.compile('(\w+) \%i\d, \$(-?\d+)')
#
diff --git a/pypy/jit/metainterp/optimizeopt/test/test_util.py
b/pypy/jit/metainterp/optimizeopt/test/test_util.py
--- a/pypy/jit/metainterp/optimizeopt/test/test_util.py
+++ b/pypy/jit/metainterp/optimizeopt/test/test_util.py
@@ -183,6 +183,7 @@
can_invalidate=True))
arraycopydescr = cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT,
EffectInfo([], [arraydescr], [], [arraydescr],
+ EffectInfo.EF_CANNOT_RAISE,
oopspecindex=EffectInfo.OS_ARRAYCOPY))
@@ -212,12 +213,14 @@
_oopspecindex = getattr(EffectInfo, _os)
locals()[_name] = \
cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT,
- EffectInfo([], [], [], [], oopspecindex=_oopspecindex))
+ EffectInfo([], [], [], [], EffectInfo.EF_CANNOT_RAISE,
+ oopspecindex=_oopspecindex))
#
_oopspecindex = getattr(EffectInfo, _os.replace('STR', 'UNI'))
locals()[_name.replace('str', 'unicode')] = \
cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT,
- EffectInfo([], [], [], [], oopspecindex=_oopspecindex))
+ EffectInfo([], [], [], [], EffectInfo.EF_CANNOT_RAISE,
+ oopspecindex=_oopspecindex))
s2u_descr = cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT,
EffectInfo([], [], [], [], oopspecindex=EffectInfo.OS_STR2UNICODE))
diff --git a/pypy/jit/metainterp/pyjitpl.py b/pypy/jit/metainterp/pyjitpl.py
--- a/pypy/jit/metainterp/pyjitpl.py
+++ b/pypy/jit/metainterp/pyjitpl.py
@@ -1345,10 +1345,8 @@
if effect == effectinfo.EF_LOOPINVARIANT:
return self.execute_varargs(rop.CALL_LOOPINVARIANT, allboxes,
descr, False, False)
- exc = (effect != effectinfo.EF_CANNOT_RAISE and
- effect != effectinfo.EF_ELIDABLE_CANNOT_RAISE)
- pure = (effect == effectinfo.EF_ELIDABLE_CAN_RAISE or
- effect == effectinfo.EF_ELIDABLE_CANNOT_RAISE)
+ exc = effectinfo.check_can_raise()
+ pure = effectinfo.check_is_elidable()
return self.execute_varargs(rop.CALL, allboxes, descr, exc, pure)
def do_residual_or_indirect_call(self, funcbox, calldescr, argboxes):
diff --git a/pypy/jit/metainterp/test/test_ajit.py
b/pypy/jit/metainterp/test/test_ajit.py
--- a/pypy/jit/metainterp/test/test_ajit.py
+++ b/pypy/jit/metainterp/test/test_ajit.py
@@ -3678,3 +3678,16 @@
assert x == -42
x = self.interp_operations(f, [1000, 1], translationoptions=topt)
assert x == 999
+
+ def test_ll_arraycopy(self):
+ from pypy.rlib import rgc
+ A = lltype.GcArray(lltype.Char)
+ a = lltype.malloc(A, 10)
+ for i in range(10): a[i] = chr(i)
+ b = lltype.malloc(A, 10)
+ #
+ def f(c, d, e):
+ rgc.ll_arraycopy(a, b, c, d, e)
+ return 42
+ self.interp_operations(f, [1, 2, 3])
+ self.check_operations_history(call=1, guard_no_exception=0)
diff --git a/pypy/module/cpyext/include/patchlevel.h
b/pypy/module/cpyext/include/patchlevel.h
--- a/pypy/module/cpyext/include/patchlevel.h
+++ b/pypy/module/cpyext/include/patchlevel.h
@@ -29,7 +29,7 @@
#define PY_VERSION "2.7.1"
/* PyPy version as a string */
-#define PYPY_VERSION "1.6.1"
+#define PYPY_VERSION "1.7.1"
/* Subversion Revision number of this file (not of the repository).
* Empty since Mercurial migration. */
diff --git a/pypy/module/sys/version.py b/pypy/module/sys/version.py
--- a/pypy/module/sys/version.py
+++ b/pypy/module/sys/version.py
@@ -10,7 +10,7 @@
CPYTHON_VERSION = (2, 7, 1, "final", 42) #XXX # sync patchlevel.h
CPYTHON_API_VERSION = 1013 #XXX # sync with include/modsupport.h
-PYPY_VERSION = (1, 6, 1, "dev", 0) #XXX # sync patchlevel.h
+PYPY_VERSION = (1, 7, 1, "dev", 0) #XXX # sync patchlevel.h
if platform.name == 'msvc':
COMPILER_INFO = 'MSC v.%d 32 bit' % (platform.version * 10 + 600)
diff --git a/pypy/objspace/std/test/test_stdobjspace.py
b/pypy/objspace/std/test/test_stdobjspace.py
--- a/pypy/objspace/std/test/test_stdobjspace.py
+++ b/pypy/objspace/std/test/test_stdobjspace.py
@@ -1,5 +1,6 @@
from pypy.interpreter.error import OperationError
from pypy.interpreter.gateway import app2interp
+from pypy.conftest import gettestobjspace
class TestW_StdObjSpace:
@@ -60,3 +61,10 @@
typedef = None
assert space.isinstance_w(X(), space.w_str)
+
+ def test_withstrbuf_fastpath_isinstance(self):
+ from pypy.objspace.std.stringobject import W_StringObject
+
+ space = gettestobjspace(withstrbuf=True)
+ assert space._get_interplevel_cls(space.w_str) is W_StringObject
+
diff --git a/pypy/rlib/rgc.py b/pypy/rlib/rgc.py
--- a/pypy/rlib/rgc.py
+++ b/pypy/rlib/rgc.py
@@ -163,8 +163,10 @@
source_start, dest_start,
length):
# if the write barrier is not supported, copy by hand
- for i in range(length):
+ i = 0
+ while i < length:
dest[i + dest_start] = source[i + source_start]
+ i += 1
return
source_addr = llmemory.cast_ptr_to_adr(source)
dest_addr = llmemory.cast_ptr_to_adr(dest)
diff --git a/pypy/translator/backendopt/test/test_canraise.py
b/pypy/translator/backendopt/test/test_canraise.py
--- a/pypy/translator/backendopt/test/test_canraise.py
+++ b/pypy/translator/backendopt/test/test_canraise.py
@@ -201,6 +201,16 @@
result = ra.can_raise(ggraph.startblock.operations[0])
assert result
+ def test_ll_arraycopy(self):
+ from pypy.rpython.lltypesystem import rffi
+ from pypy.rlib.rgc import ll_arraycopy
+ def f(a, b, c, d, e):
+ ll_arraycopy(a, b, c, d, e)
+ t, ra = self.translate(f, [rffi.CCHARP, rffi.CCHARP, int, int, int])
+ fgraph = graphof(t, f)
+ result = ra.can_raise(fgraph.startblock.operations[0])
+ assert not result
+
class TestOOType(OORtypeMixin, BaseTestCanRaise):
def test_can_raise_recursive(self):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit