Author: Alex Gaynor <alex.gay...@gmail.com> Branch: unroll-if-alt Changeset: r46256:cc4d128b64be Date: 2011-08-03 12:54 -0700 http://bitbucket.org/pypy/pypy/changeset/cc4d128b64be/
Log: Use the decorators here. diff --git a/pypy/objspace/std/bytearrayobject.py b/pypy/objspace/std/bytearrayobject.py --- a/pypy/objspace/std/bytearrayobject.py +++ b/pypy/objspace/std/bytearrayobject.py @@ -250,7 +250,8 @@ def repr__Bytearray(space, w_bytearray): s = w_bytearray.data - buf = StringBuilder(50) + # Good default if there are no replacements. + buf = StringBuilder(len("bytearray(b'')") + len(s)) buf.append("bytearray(b'") diff --git a/pypy/rlib/rgc.py b/pypy/rlib/rgc.py --- a/pypy/rlib/rgc.py +++ b/pypy/rlib/rgc.py @@ -1,6 +1,9 @@ -import gc, types +import gc +import types + +from pypy.rlib import jit +from pypy.rlib.objectmodel import we_are_translated, enforceargs, specialize from pypy.rpython.extregistry import ExtRegistryEntry -from pypy.rlib.objectmodel import we_are_translated from pypy.rpython.lltypesystem import lltype, llmemory # ____________________________________________________________ @@ -74,7 +77,7 @@ # when the gc policy doesn't support pools, just return # the argument (which is lltyped as Void anyway) opname = 'same_as' - + s_pool_ptr = annmodel.SomeExternalObject(GcPool) r_pool_ptr = hop.rtyper.getrepr(s_pool_ptr) vlist = hop.inputargs(r_pool_ptr) @@ -156,7 +159,7 @@ if len(hop.args_s) == 1: args_v = hop.inputargs(lltype.Signed) return hop.genop('gc__collect', args_v, resulttype=hop.r_result) - + class SetMaxHeapSizeEntry(ExtRegistryEntry): _about_ = set_max_heap_size @@ -257,6 +260,9 @@ hop.exception_cannot_occur() return hop.genop(opname, vlist, resulttype = hop.r_result.lowleveltype) +@jit.oopspec('list.ll_arraycopy(source, dest, source_start, dest_start, length)') +@specialize.ll() +@enforceargs(None, None, int, int, int) def ll_arraycopy(source, dest, source_start, dest_start, length): from pypy.rpython.lltypesystem.lloperation import llop from pypy.rlib.objectmodel import keepalive_until_here @@ -285,14 +291,11 @@ llmemory.sizeof(TP.OF) * source_start) cp_dest_addr = (dest_addr + llmemory.itemoffsetof(TP, 0) + llmemory.sizeof(TP.OF) * dest_start) - + llmemory.raw_memcopy(cp_source_addr, cp_dest_addr, llmemory.sizeof(TP.OF) * length) keepalive_until_here(source) keepalive_until_here(dest) -ll_arraycopy._annenforceargs_ = [None, None, int, int, int] -ll_arraycopy._annspecialcase_ = 'specialize:ll' -ll_arraycopy.oopspec = 'list.ll_arraycopy(source, dest, source_start, dest_start, length)' def ll_shrink_array(p, smallerlength): from pypy.rpython.lltypesystem.lloperation import llop @@ -316,7 +319,7 @@ llmemory.itemoffsetof(ARRAY, 0)) source_addr = llmemory.cast_ptr_to_adr(p) + offset dest_addr = llmemory.cast_ptr_to_adr(newp) + offset - llmemory.raw_memcopy(source_addr, dest_addr, + llmemory.raw_memcopy(source_addr, dest_addr, llmemory.sizeof(ARRAY.OF) * smallerlength) keepalive_until_here(p) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit