[pypy-svn] r77242 - in pypy/branch/fast-forward: . pypy/jit/metainterp/optimizeopt pypy/jit/metainterp/test pypy/module/array/test pypy/rpython/lltypesystem pypy/rpython/lltypesystem/test
afa at codespeak.net
afa at codespeak.net
Tue Sep 21 18:49:58 CEST 2010
Author: afa
Date: Tue Sep 21 18:49:56 2010
New Revision: 77242
Modified:
pypy/branch/fast-forward/ (props changed)
pypy/branch/fast-forward/pypy/jit/metainterp/optimizeopt/ (props changed)
pypy/branch/fast-forward/pypy/jit/metainterp/optimizeopt/__init__.py (props changed)
pypy/branch/fast-forward/pypy/jit/metainterp/optimizeopt/heap.py (props changed)
pypy/branch/fast-forward/pypy/jit/metainterp/optimizeopt/intbounds.py (props changed)
pypy/branch/fast-forward/pypy/jit/metainterp/optimizeopt/intutils.py (props changed)
pypy/branch/fast-forward/pypy/jit/metainterp/optimizeopt/optimizer.py (props changed)
pypy/branch/fast-forward/pypy/jit/metainterp/optimizeopt/rewrite.py (props changed)
pypy/branch/fast-forward/pypy/jit/metainterp/optimizeopt/virtualize.py (props changed)
pypy/branch/fast-forward/pypy/jit/metainterp/test/test_optimizeopt.py
pypy/branch/fast-forward/pypy/module/array/test/test_array_old.py (props changed)
pypy/branch/fast-forward/pypy/rpython/lltypesystem/ll2ctypes.py
pypy/branch/fast-forward/pypy/rpython/lltypesystem/test/test_ll2ctypes.py
Log:
Merge from trunk
Modified: pypy/branch/fast-forward/pypy/jit/metainterp/test/test_optimizeopt.py
==============================================================================
--- pypy/branch/fast-forward/pypy/jit/metainterp/test/test_optimizeopt.py (original)
+++ pypy/branch/fast-forward/pypy/jit/metainterp/test/test_optimizeopt.py Tue Sep 21 18:49:56 2010
@@ -2206,6 +2206,43 @@
"""
self.optimize_loop(ops, 'Not', expected)
+ def test_fold_partially_constant_ops_ovf(self):
+ ops = """
+ [i0]
+ i1 = int_sub_ovf(i0, 0)
+ guard_no_overflow() []
+ jump(i1)
+ """
+ expected = """
+ [i0]
+ jump(i0)
+ """
+ self.optimize_loop(ops, 'Not', expected)
+
+ ops = """
+ [i0]
+ i1 = int_add_ovf(i0, 0)
+ guard_no_overflow() []
+ jump(i1)
+ """
+ expected = """
+ [i0]
+ jump(i0)
+ """
+ self.optimize_loop(ops, 'Not', expected)
+
+ ops = """
+ [i0]
+ i1 = int_add_ovf(0, i0)
+ guard_no_overflow() []
+ jump(i1)
+ """
+ expected = """
+ [i0]
+ jump(i0)
+ """
+ self.optimize_loop(ops, 'Not', expected)
+
# ----------
def make_fail_descr(self):
Modified: pypy/branch/fast-forward/pypy/rpython/lltypesystem/ll2ctypes.py
==============================================================================
--- pypy/branch/fast-forward/pypy/rpython/lltypesystem/ll2ctypes.py (original)
+++ pypy/branch/fast-forward/pypy/rpython/lltypesystem/ll2ctypes.py Tue Sep 21 18:49:56 2010
@@ -738,10 +738,10 @@
elif isinstance(T.TO, lltype.Array):
if T.TO._hints.get('nolength', False):
container = _array_of_unknown_length(T.TO)
- container._storage = cobj
+ container._storage = type(cobj)(cobj.contents)
else:
container = _array_of_known_length(T.TO)
- container._storage = cobj
+ container._storage = type(cobj)(cobj.contents)
elif isinstance(T.TO, lltype.FuncType):
cobjkey = intmask(ctypes.cast(cobj, ctypes.c_void_p).value)
if cobjkey in _int2obj:
Modified: pypy/branch/fast-forward/pypy/rpython/lltypesystem/test/test_ll2ctypes.py
==============================================================================
--- pypy/branch/fast-forward/pypy/rpython/lltypesystem/test/test_ll2ctypes.py (original)
+++ pypy/branch/fast-forward/pypy/rpython/lltypesystem/test/test_ll2ctypes.py Tue Sep 21 18:49:56 2010
@@ -1252,6 +1252,32 @@
assert i == llmemory.cast_adr_to_int(a, "forced")
lltype.free(p, flavor='raw')
+ def test_freelist(self):
+ S = lltype.Struct('S', ('x', lltype.Signed), ('y', lltype.Signed))
+ SP = lltype.Ptr(S)
+ chunk = lltype.malloc(rffi.CArrayPtr(S).TO, 10, flavor='raw')
+ assert lltype.typeOf(chunk) == rffi.CArrayPtr(S)
+ free_list = lltype.nullptr(rffi.VOIDP.TO)
+ # build list
+ current = chunk
+ for i in range(10):
+ rffi.cast(rffi.VOIDPP, current)[0] = free_list
+ free_list = rffi.cast(rffi.VOIDP, current)
+ current = rffi.ptradd(current, 1)
+ # get one
+ p = free_list
+ free_list = rffi.cast(rffi.VOIDPP, p)[0]
+ rffi.cast(SP, p).x = 0
+ # get two
+ p = free_list
+ free_list = rffi.cast(rffi.VOIDPP, p)[0]
+ rffi.cast(SP, p).x = 0
+ # get three
+ p = free_list
+ free_list = rffi.cast(rffi.VOIDPP, p)[0]
+ rffi.cast(SP, p).x = 0
+ lltype.free(chunk, flavor='raw')
+
class TestPlatform(object):
def test_lib_on_libpaths(self):
from pypy.translator.platform import platform
More information about the Pypy-commit
mailing list