Author: fijal Date: Tue Dec 4 17:24:36 2007 New Revision: 49345 Added: pypy/dist/pypy/rlib/debug.py (contents, props changed) Modified: pypy/dist/pypy/jit/codegen/llgraph/rgenop.py pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py pypy/dist/pypy/module/thread/ll_thread.py pypy/dist/pypy/rlib/objectmodel.py pypy/dist/pypy/rpython/extfunc.py pypy/dist/pypy/rpython/lltypesystem/llarena.py pypy/dist/pypy/rpython/lltypesystem/rlist.py pypy/dist/pypy/rpython/lltypesystem/rstr.py pypy/dist/pypy/rpython/memory/gc/base.py pypy/dist/pypy/rpython/memory/gc/generation.py pypy/dist/pypy/rpython/memory/gc/marksweep.py pypy/dist/pypy/rpython/memory/gc/semispace.py pypy/dist/pypy/rpython/memory/gctransform/framework.py pypy/dist/pypy/rpython/numpy/rarray.py pypy/dist/pypy/rpython/rlist.py pypy/dist/pypy/rpython/test/test_rbuiltin.py Log: Rename objectmodel.debug_assert to debug.ll_assert and objectmodel.debug_llinterpcall to debug.llinterpcall
Modified: pypy/dist/pypy/jit/codegen/llgraph/rgenop.py ============================================================================== --- pypy/dist/pypy/jit/codegen/llgraph/rgenop.py (original) +++ pypy/dist/pypy/jit/codegen/llgraph/rgenop.py Tue Dec 4 17:24:36 2007 @@ -1,4 +1,5 @@ -from pypy.rlib.objectmodel import specialize, debug_assert +from pypy.rlib.objectmodel import specialize +from pypy.rlib.debug import ll_assert from pypy.rpython.lltypesystem import lltype, llmemory from pypy.jit.codegen.model import AbstractRGenOp, GenLabel, GenBuilder from pypy.jit.codegen.model import GenVar, GenConst, CodeGenSwitch @@ -72,7 +73,7 @@ l_case = llimpl.add_case(self.b, gv_case.v) b = llimpl.closelinktofreshblock(l_case, self.args_gv, self.l_default) builder = LLBuilder(self.rgenop, self.gv_f, b) - debug_assert(self.rgenop.currently_writing is None or + ll_assert(self.rgenop.currently_writing is None or # special case: we stop replaying and add a case after # a call to flexswitch() on a replay builder self.rgenop.currently_writing.is_default_builder, @@ -85,7 +86,7 @@ self.l_default = l_default b = llimpl.closelinktofreshblock(l_default, self.args_gv, None) builder = LLBuilder(self.rgenop, self.gv_f, b) - debug_assert(self.rgenop.currently_writing is None, + ll_assert(self.rgenop.currently_writing is None, "_add_default: currently_writing elsewhere") self.rgenop.currently_writing = builder builder.is_default_builder = True @@ -101,19 +102,19 @@ self.b = block def end(self): - debug_assert(self.rgenop.currently_writing is None, + ll_assert(self.rgenop.currently_writing is None, "end: currently_writing") llimpl.end(self.gv_f) @specialize.arg(1) def genop1(self, opname, gv_arg): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "genop1: bad currently_writing") return LLVar(llimpl.genop(self.b, opname, [gv_arg], llimpl.guess)) @specialize.arg(1) def genraisingop1(self, opname, gv_arg): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "genraisingop1: bad currently_writing") gv_res = LLVar(llimpl.genop(self.b, opname, [gv_arg], llimpl.guess)) gv_exc = LLVar(llimpl.genop(self.b, "check_and_clear_exc", [], @@ -122,14 +123,14 @@ @specialize.arg(1) def genop2(self, opname, gv_arg1, gv_arg2): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "genop2: bad currently_writing") return LLVar(llimpl.genop(self.b, opname, [gv_arg1, gv_arg2], llimpl.guess)) @specialize.arg(1) def genraisingop2(self, opname, gv_arg1, gv_arg2): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "genraisingop2: bad currently_writing") gv_res = LLVar(llimpl.genop(self.b, opname, [gv_arg1, gv_arg2], llimpl.guess)) @@ -138,7 +139,7 @@ return gv_res, gv_exc def genop_call(self, (ARGS_gv, gv_RESULT, _), gv_callable, args_gv): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "genop_call: bad currently_writing") vars_gv = [gv_callable] j = 0 @@ -157,7 +158,7 @@ return LLVar(v) def genop_getfield(self, (gv_name, gv_PTRTYPE, gv_FIELDTYPE), gv_ptr): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "genop_getfield: bad currently_writing") return LLVar(llimpl.gengetfield(self.b, gv_ptr.v, gv_PTRTYPE.v, gv_name.v)) @@ -167,7 +168,7 @@ def genop_setfield(self, (gv_name, gv_PTRTYPE, gv_FIELDTYPE), gv_ptr, gv_value): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "genop_setfield: bad currently_writing") v_value = llimpl.cast(self.b, gv_FIELDTYPE.v, gv_value.v) llimpl.gensetfield(self.b, gv_ptr.v, gv_PTRTYPE.v, gv_name.v, v_value) @@ -178,7 +179,7 @@ # gv_Void.v)) def genop_getsubstruct(self, (gv_name, gv_PTRTYPE, gv_FIELDTYPE), gv_ptr): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "genop_getsubstruct: bad currently_writing") return LLVar(llimpl.gengetsubstruct(self.b, gv_ptr.v, gv_PTRTYPE.v, gv_name.v)) @@ -187,7 +188,7 @@ # gv_FIELDTYPE.v)) def genop_getarrayitem(self, gv_ITEMTYPE, gv_ptr, gv_index): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "genop_getarrayitem: bad currently_writing") return LLVar(llimpl.gengetarrayitem(self.b, gv_ITEMTYPE.v, gv_ptr.v, gv_index.v)) @@ -196,7 +197,7 @@ # gv_ITEMTYPE.v)) def genop_getarraysubstruct(self, gv_ITEMTYPE, gv_ptr, gv_index): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "genop_getarraysubstruct: bad currently_writing") return LLVar(llimpl.gengetarraysubstruct(self.b, gv_ptr.v, gv_index.v)) #vars_gv = [gv_ptr.v, gv_index.v] @@ -204,53 +205,53 @@ # gv_ITEMTYPE.v)) def genop_setarrayitem(self, gv_ITEMTYPE, gv_ptr, gv_index, gv_value): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "genop_setarrayitem: bad currently_writing") llimpl.gensetarrayitem(self.b, gv_ptr.v, gv_index.v, gv_value.v) #vars_gv = [gv_ptr.v, gv_index.v, gv_value.v] #llimpl.genop(self.b, 'setarrayitem', vars_gv, gv_Void.v) def genop_getarraysize(self, gv_ITEMTYPE, gv_ptr): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "genop_getarraysize: bad currently_writing") return LLVar(llimpl.gengetarraysize(self.b, gv_ptr.v)) #return LLVar(llimpl.genop(self.b, 'getarraysize', [gv_ptr.v], # gv_Signed.v)) def genop_malloc_fixedsize(self, (gv_TYPE, gv_PTRTYPE)): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "genop_malloc_fixedsize: bad currently_writing") vars_gv = [gv_TYPE.v, gv_flavor_gc.v] return LLVar(llimpl.genop(self.b, 'malloc', vars_gv, gv_PTRTYPE.v)) def genop_malloc_varsize(self, (gv_TYPE, gv_PTRTYPE), gv_length): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "genop_malloc_varsize: bad currently_writing") vars_gv = [gv_TYPE.v, gv_flavor_gc.v, gv_length.v] return LLVar(llimpl.genop(self.b, 'malloc_varsize', vars_gv, gv_PTRTYPE.v)) def genop_same_as(self, gv_TYPE, gv_value): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "genop_same_as: bad currently_writing") gv_value = llimpl.cast(self.b, gv_TYPE.v, gv_value.v) return LLVar(llimpl.genop(self.b, 'same_as', [gv_value], gv_TYPE.v)) def genop_ptr_iszero(self, gv_PTRTYPE, gv_ptr): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "genop_ptr_iszero: bad currently_writing") gv_ptr = llimpl.cast(self.b, gv_PTRTYPE.v, gv_ptr.v) return LLVar(llimpl.genop(self.b, 'ptr_iszero', [gv_ptr], gv_Bool.v)) def genop_ptr_nonzero(self, gv_PTRTYPE, gv_ptr): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "genop_ptr_nonzero: bad currently_writing") gv_ptr = llimpl.cast(self.b, gv_PTRTYPE.v, gv_ptr.v) return LLVar(llimpl.genop(self.b, 'ptr_nonzero', [gv_ptr], gv_Bool.v)) def genop_ptr_eq(self, gv_PTRTYPE, gv_ptr1, gv_ptr2): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "genop_ptr_eq: bad currently_writing") gv_ptr1 = llimpl.cast(self.b, gv_PTRTYPE.v, gv_ptr1.v) gv_ptr2 = llimpl.cast(self.b, gv_PTRTYPE.v, gv_ptr2.v) @@ -258,7 +259,7 @@ gv_Bool.v)) def genop_ptr_ne(self, gv_PTRTYPE, gv_ptr1, gv_ptr2): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "genop_ptr_ne: bad currently_writing") gv_ptr1 = llimpl.cast(self.b, gv_PTRTYPE.v, gv_ptr1.v) gv_ptr2 = llimpl.cast(self.b, gv_PTRTYPE.v, gv_ptr2.v) @@ -266,7 +267,7 @@ gv_Bool.v)) def genop_cast_int_to_ptr(self, gv_PTRTYPE, gv_int): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "genop_cast_int_to_ptr: bad currently_writing") return LLVar(llimpl.genop(self.b, 'cast_int_to_ptr', [gv_int], gv_PTRTYPE.v)) @@ -276,7 +277,7 @@ return [LLVar(llimpl.geninputarg(newb, kind.v)) for kind in kinds] def enter_next_block(self, kinds, args_gv): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "enter_next_block: bad currently_writing") lnk = llimpl.closeblock1(self.b) newb_args_gv = self._newblock(kinds) @@ -297,7 +298,7 @@ self._close() def _jump(self, l_jump, l_no_jump, args_for_jump_gv): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "_jump: bad currently_writing") self.b = llimpl.closelinktofreshblock(l_no_jump, None, None) b2 = llimpl.closelinktofreshblock(l_jump, args_for_jump_gv, None) @@ -321,7 +322,7 @@ return (flexswitch, flexswitch._add_default()) def _close(self): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "_close: bad currently_writing") self.rgenop.currently_writing = None self.b = llimpl.nullblock @@ -333,7 +334,7 @@ assert self.later_block != llimpl.nullblock self.b = self.later_block self.later_block = llimpl.nullblock - debug_assert(self.rgenop.currently_writing is None, + ll_assert(self.rgenop.currently_writing is None, "start_writing: currently_writing") self.rgenop.currently_writing = self @@ -352,18 +353,18 @@ # read_frame_var support def genop_get_frame_base(self): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "genop_get_frame_base: bad currently_writing") return LLVar(llimpl.genop(self.b, 'get_frame_base', [], gv_Address.v)) def get_frame_info(self, vars): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "get_frame_info: bad currently_writing") return llimpl.get_frame_info(self.b, vars) def alloc_frame_place(self, gv_TYPE, gv_initial_value=None): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "alloc_frame_place: bad currently_writing") if gv_initial_value is None: gv_initial_value = self.rgenop.genzeroconst(gv_TYPE) @@ -373,9 +374,9 @@ return LLPlace(v, llimpl.get_frame_info(self.b, [v])) def genop_absorb_place(self, gv_TYPE, place): - debug_assert(self.rgenop.currently_writing is self, + ll_assert(self.rgenop.currently_writing is self, "alloc_frame_place: bad currently_writing") - debug_assert(not place.absorbed, "place already absorbed") + ll_assert(not place.absorbed, "place already absorbed") place.absorbed = True return place.v @@ -449,7 +450,7 @@ def replay(self, label, kinds): builder = LLBuilder(self, label.g, llimpl.nullblock) args_gv = builder._newblock(kinds) - debug_assert(self.currently_writing is None, + ll_assert(self.currently_writing is None, "replay: currently_writing") self.currently_writing = builder return builder, args_gv Modified: pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py ============================================================================== --- pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py (original) +++ pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py Tue Dec 4 17:24:36 2007 @@ -10,7 +10,8 @@ from pypy.objspace.flow.model import summary, Variable from pypy.rpython.lltypesystem import lltype, llmemory, rstr from pypy.rlib.jit import hint -from pypy.rlib.objectmodel import keepalive_until_here, debug_assert +from pypy.rlib.objectmodel import keepalive_until_here +from pypy.rlib.debug import ll_assert from pypy.rlib.unroll import unrolling_iterable from pypy.rlib.rarithmetic import ovfcheck from pypy.rpython.annlowlevel import PseudoHighLevelCallable, cachedtype @@ -1379,7 +1380,7 @@ return s def g(s): # assumes that s is not null here - debug_assert(bool(s), "please don't give me a null") + ll_assert(bool(s), "please don't give me a null") return 5 def f(m): s = h() Modified: pypy/dist/pypy/module/thread/ll_thread.py ============================================================================== --- pypy/dist/pypy/module/thread/ll_thread.py (original) +++ pypy/dist/pypy/module/thread/ll_thread.py Tue Dec 4 17:24:36 2007 @@ -10,7 +10,7 @@ from pypy.rpython.extregistry import ExtRegistryEntry from pypy.annotation import model as annmodel from pypy.rpython.lltypesystem.lltype import typeOf -from pypy.rlib.objectmodel import debug_assert +from pypy.rlib.debug import ll_assert from pypy.tool import autopath from distutils import sysconfig python_inc = sysconfig.get_python_inc() @@ -154,11 +154,11 @@ return bool(c_thread_acquirelock_NOAUTO(self._lock, int(flag))) def release(self): - debug_assert(not self.acquire(False), "Lock_NOAUTO was not held!") + ll_assert(not self.acquire(False), "Lock_NOAUTO was not held!") c_thread_releaselock_NOAUTO(self._lock) def fused_release_acquire(self): - debug_assert(not self.acquire(False), "Lock_NOAUTO was not held!") + ll_assert(not self.acquire(False), "Lock_NOAUTO was not held!") c_thread_fused_releaseacquirelock_NOAUTO(self._lock) def __del__(self): Added: pypy/dist/pypy/rlib/debug.py ============================================================================== --- (empty file) +++ pypy/dist/pypy/rlib/debug.py Tue Dec 4 17:24:36 2007 @@ -0,0 +1,59 @@ + +from pypy.rpython.extregistry import ExtRegistryEntry + +def ll_assert(x, msg): + """After translation to C, this becomes an RPyAssert.""" + assert x, msg + +class Entry(ExtRegistryEntry): + _about_ = ll_assert + + def compute_result_annotation(self, s_x, s_msg): + assert s_msg.is_constant(), ("ll_assert(x, msg): " + "the msg must be constant") + return None + + def specialize_call(self, hop): + from pypy.rpython.lltypesystem import lltype + vlist = hop.inputargs(lltype.Bool, lltype.Void) + hop.genop('debug_assert', vlist) + + +def llinterpcall(RESTYPE, pythonfunction, *args): + """When running on the llinterp, this causes the llinterp to call to + the provided Python function with the run-time value of the given args. + The Python function should return a low-level object of type RESTYPE. + This should never be called after translation: use this only if + running_on_llinterp is true. + """ + raise NotImplementedError + +class Entry(ExtRegistryEntry): + _about_ = llinterpcall + + def compute_result_annotation(self, s_RESTYPE, s_pythonfunction, *args_s): + from pypy.annotation import model as annmodel + from pypy.rpython.lltypesystem import lltype + assert s_RESTYPE.is_constant() + assert s_pythonfunction.is_constant() + s_result = s_RESTYPE.const + if isinstance(s_result, lltype.LowLevelType): + s_result = annmodel.lltype_to_annotation(s_result) + assert isinstance(s_result, annmodel.SomeObject) + return s_result + + def specialize_call(self, hop): + from pypy.annotation import model as annmodel + from pypy.rpython.lltypesystem import lltype + RESTYPE = hop.args_s[0].const + if not isinstance(RESTYPE, lltype.LowLevelType): + assert isinstance(RESTYPE, annmodel.SomeObject) + r_result = hop.rtyper.getrepr(RESTYPE) + RESTYPE = r_result.lowleveltype + pythonfunction = hop.args_s[1].const + c_pythonfunction = hop.inputconst(lltype.Void, pythonfunction) + args_v = [hop.inputarg(hop.args_r[i], arg=i) + for i in range(2, hop.nb_args)] + return hop.genop('debug_llinterpcall', [c_pythonfunction] + args_v, + resulttype=RESTYPE) + Modified: pypy/dist/pypy/rlib/objectmodel.py ============================================================================== --- pypy/dist/pypy/rlib/objectmodel.py (original) +++ pypy/dist/pypy/rlib/objectmodel.py Tue Dec 4 17:24:36 2007 @@ -201,65 +201,6 @@ raise TyperError("current_object_addr_as_int() cannot be applied to" " %r" % (vobj.concretetype,)) -# ____________________________________________________________ - -def debug_assert(x, msg): - """After translation to C, this becomes an RPyAssert.""" - assert x, msg - -class Entry(ExtRegistryEntry): - _about_ = debug_assert - - def compute_result_annotation(self, s_x, s_msg): - assert s_msg.is_constant(), ("debug_assert(x, msg): " - "the msg must be constant") - return None - - def specialize_call(self, hop): - from pypy.rpython.lltypesystem import lltype - vlist = hop.inputargs(lltype.Bool, lltype.Void) - hop.genop('debug_assert', vlist) - - -def debug_llinterpcall(RESTYPE, pythonfunction, *args): - """When running on the llinterp, this causes the llinterp to call to - the provided Python function with the run-time value of the given args. - The Python function should return a low-level object of type RESTYPE. - This should never be called after translation: use this only if - running_on_llinterp is true. - """ - raise NotImplementedError - -class Entry(ExtRegistryEntry): - _about_ = debug_llinterpcall - - def compute_result_annotation(self, s_RESTYPE, s_pythonfunction, *args_s): - from pypy.annotation import model as annmodel - from pypy.rpython.lltypesystem import lltype - assert s_RESTYPE.is_constant() - assert s_pythonfunction.is_constant() - s_result = s_RESTYPE.const - if isinstance(s_result, lltype.LowLevelType): - s_result = annmodel.lltype_to_annotation(s_result) - assert isinstance(s_result, annmodel.SomeObject) - return s_result - - def specialize_call(self, hop): - from pypy.annotation import model as annmodel - from pypy.rpython.lltypesystem import lltype - RESTYPE = hop.args_s[0].const - if not isinstance(RESTYPE, lltype.LowLevelType): - assert isinstance(RESTYPE, annmodel.SomeObject) - r_result = hop.rtyper.getrepr(RESTYPE) - RESTYPE = r_result.lowleveltype - pythonfunction = hop.args_s[1].const - c_pythonfunction = hop.inputconst(lltype.Void, pythonfunction) - args_v = [hop.inputarg(hop.args_r[i], arg=i) - for i in range(2, hop.nb_args)] - return hop.genop('debug_llinterpcall', [c_pythonfunction] + args_v, - resulttype=RESTYPE) - - def hlinvoke(repr, llcallable, *args): raise TypeError, "hlinvoke is meant to be rtyped and not called direclty" Modified: pypy/dist/pypy/rpython/extfunc.py ============================================================================== --- pypy/dist/pypy/rpython/extfunc.py (original) +++ pypy/dist/pypy/rpython/extfunc.py Tue Dec 4 17:24:36 2007 @@ -182,12 +182,12 @@ # If we have both an {ll,oo}impl and a {ll,oo}fakeimpl, # we need a wrapper that selects the proper one and calls it from pypy.rlib.objectmodel import running_on_llinterp - from pypy.rlib.objectmodel import debug_llinterpcall + from pypy.rlib.debug import llinterpcall from pypy.tool.sourcetools import func_with_new_name original_impl = impl def ll_wrapper(*args): if running_on_llinterp: - return debug_llinterpcall(s_result, fakeimpl, *args) + return llinterpcall(s_result, fakeimpl, *args) else: return original_impl(*args) impl = func_with_new_name(ll_wrapper, name + '_wrapper') Modified: pypy/dist/pypy/rpython/lltypesystem/llarena.py ============================================================================== --- pypy/dist/pypy/rpython/lltypesystem/llarena.py (original) +++ pypy/dist/pypy/rpython/lltypesystem/llarena.py Tue Dec 4 17:24:36 2007 @@ -276,7 +276,7 @@ import os, sys from pypy.rpython.lltypesystem import rffi, lltype from pypy.rpython.extfunc import register_external -from pypy.rlib.objectmodel import debug_assert, CDefinedIntSymbolic +from pypy.rlib.objectmodel import CDefinedIntSymbolic if os.name == 'posix': READ_MAX = (sys.maxint//4) + 1 # upper bound on reads to avoid surprises Modified: pypy/dist/pypy/rpython/lltypesystem/rlist.py ============================================================================== --- pypy/dist/pypy/rpython/lltypesystem/rlist.py (original) +++ pypy/dist/pypy/rpython/lltypesystem/rlist.py Tue Dec 4 17:24:36 2007 @@ -16,8 +16,11 @@ Bool, nullptr, typeMethod from pypy.rpython.lltypesystem import rstr from pypy.rpython import robject -from pypy.rlib.objectmodel import debug_assert +from pypy.rlib.debug import ll_assert from pypy.rlib.rarithmetic import ovfcheck +from pypy.rpython.lltypesystem.llmemory import cast_ptr_to_adr, raw_memclear,\ + raw_memcopy, sizeof, itemoffsetof +from pypy.rpython.lltypesystem import rffi # ____________________________________________________________ # @@ -284,7 +287,7 @@ # system malloc(). # The growth pattern is: 0, 4, 8, 16, 25, 35, 46, 58, 72, 88, ... if newsize <= 0: - debug_assert(newsize == 0, "negative list length") + ll_assert(newsize == 0, "negative list length") new_allocated = 0 else: if newsize < 9: @@ -305,11 +308,11 @@ else: p = new_allocated - 1 while p >= 0: - newitems[p] = items[p] - ITEM = typeOf(l).TO.ITEM - if isinstance(ITEM, Ptr): - items[p] = nullptr(ITEM.TO) - p -= 1 + newitems[p] = items[p] + ITEM = typeOf(l).TO.ITEM + if isinstance(ITEM, Ptr): + items[p] = nullptr(ITEM.TO) + p -= 1 l.length = newsize l.items = newitems _ll_list_resize_really._annenforceargs_ = (None, int) @@ -356,7 +359,7 @@ # Accessor methods def ll_newlist(LIST, length): - debug_assert(length >= 0, "negative list length") + ll_assert(length >= 0, "negative list length") l = malloc(LIST) l.length = length l.items = malloc(LIST.items.TO, length) @@ -391,17 +394,17 @@ return l.items def ll_getitem_fast(l, index): - debug_assert(index < l.length, "getitem out of bounds") + ll_assert(index < l.length, "getitem out of bounds") return l.ll_items()[index] def ll_setitem_fast(l, index, item): - debug_assert(index < l.length, "setitem out of bounds") + ll_assert(index < l.length, "setitem out of bounds") l.ll_items()[index] = item # fixed size versions def ll_fixed_newlist(LIST, length): - debug_assert(length >= 0, "negative fixed list length") + ll_assert(length >= 0, "negative fixed list length") l = malloc(LIST, length) return l ll_fixed_newlist = typeMethod(ll_fixed_newlist) @@ -418,11 +421,11 @@ return l def ll_fixed_getitem_fast(l, index): - debug_assert(index < len(l), "fixed getitem out of bounds") + ll_assert(index < len(l), "fixed getitem out of bounds") return l[index] def ll_fixed_setitem_fast(l, index, item): - debug_assert(index < len(l), "fixed setitem out of bounds") + ll_assert(index < len(l), "fixed setitem out of bounds") l[index] = item def newlist(llops, r_list, items_v): Modified: pypy/dist/pypy/rpython/lltypesystem/rstr.py ============================================================================== --- pypy/dist/pypy/rpython/lltypesystem/rstr.py (original) +++ pypy/dist/pypy/rpython/lltypesystem/rstr.py Tue Dec 4 17:24:36 2007 @@ -2,7 +2,7 @@ from pypy.tool.pairtype import pairtype from pypy.rpython.error import TyperError from pypy.rlib.objectmodel import malloc_zero_filled, we_are_translated -from pypy.rlib.objectmodel import debug_assert +from pypy.rlib.debug import ll_assert from pypy.rpython.robject import PyObjRepr, pyobj_repr from pypy.rlib.rarithmetic import _hash_string from pypy.rpython.rmodel import inputconst, IntegerRepr @@ -30,7 +30,7 @@ def new_malloc(TP): def mallocstr(length): - debug_assert(length >= 0, "negative string length") + ll_assert(length >= 0, "negative string length") r = malloc(TP, length) if not we_are_translated() or not malloc_zero_filled: r.hash = 0 @@ -228,8 +228,8 @@ def ll_stritem_nonneg(s, i): chars = s.chars - debug_assert(i>=0, "negative str getitem index") - debug_assert(i<len(chars), "str getitem index out of bound") + ll_assert(i>=0, "negative str getitem index") + ll_assert(i<len(chars), "str getitem index out of bound") return chars[i] ll_stritem_nonneg._annenforceargs_ = [None, int] Modified: pypy/dist/pypy/rpython/memory/gc/base.py ============================================================================== --- pypy/dist/pypy/rpython/memory/gc/base.py (original) +++ pypy/dist/pypy/rpython/memory/gc/base.py Tue Dec 4 17:24:36 2007 @@ -1,5 +1,5 @@ from pypy.rpython.lltypesystem import lltype, llmemory -from pypy.rlib.objectmodel import debug_assert +from pypy.rlib.debug import ll_assert class GCBase(object): _alloc_flavor_ = "raw" @@ -156,7 +156,7 @@ # double-check that the answer we got is correct lst = self.wr_to_objects_with_id target = llmemory.weakref_deref(llmemory.GCREF, lst[i]) - debug_assert(target == ptr, "bogus object_id_dict") + ll_assert(target == ptr, "bogus object_id_dict") return i + 1 # found via the dict # Walk the tail of the list, where entries are not also in the dict lst = self.wr_to_objects_with_id @@ -167,7 +167,7 @@ if not target: freeentry = i else: - debug_assert(self.get_type_id(llmemory.cast_ptr_to_adr(target)) + ll_assert(self.get_type_id(llmemory.cast_ptr_to_adr(target)) > 0, "bogus weakref in compute_id()") # record this entry in the dict adr = llmemory.cast_ptr_to_adr(target) @@ -179,7 +179,7 @@ # not found wr = llmemory.weakref_create(ptr) if freeentry < 0: - debug_assert(end == len(lst), "unexpected lst growth in gc_id") + ll_assert(end == len(lst), "unexpected lst growth in gc_id") i = end lst.append(wr) else: Modified: pypy/dist/pypy/rpython/memory/gc/generation.py ============================================================================== --- pypy/dist/pypy/rpython/memory/gc/generation.py (original) +++ pypy/dist/pypy/rpython/memory/gc/generation.py Tue Dec 4 17:24:36 2007 @@ -3,7 +3,8 @@ GCFLAG_IMMORTAL from pypy.rpython.lltypesystem.llmemory import NULL, raw_malloc_usage from pypy.rpython.lltypesystem import lltype, llmemory, llarena -from pypy.rlib.objectmodel import free_non_gc_object, debug_assert +from pypy.rlib.objectmodel import free_non_gc_object +from pypy.rlib.debug import ll_assert from pypy.rpython.lltypesystem.lloperation import llop # The following flag is never set on young objects, i.e. the ones living @@ -60,7 +61,7 @@ contains_weakptr=False): if (has_finalizer or not can_collect or raw_malloc_usage(size) >= self.nursery_size // 2): - debug_assert(not contains_weakptr, "wrong case for mallocing weakref") + ll_assert(not contains_weakptr, "wrong case for mallocing weakref") # "non-simple" case or object too big: don't use the nursery return SemiSpaceGC.malloc_fixedsize(self, typeid, size, can_collect, has_finalizer, @@ -174,7 +175,7 @@ if self.nursery_size > self.top_of_space - self.free: # the semispace is running out, do a full collect self.obtain_free_space(self.nursery_size) - debug_assert(self.nursery_size <= self.top_of_space - self.free, + ll_assert(self.nursery_size <= self.top_of_space - self.free, "obtain_free_space failed to do its job") if self.nursery: if DEBUG_PRINT: @@ -303,7 +304,7 @@ self.remember_young_pointer(addr_struct, newvalue) def remember_young_pointer(self, addr_struct, addr): - debug_assert(not self.is_in_nursery(addr_struct), + ll_assert(not self.is_in_nursery(addr_struct), "nursery object with GCFLAG_NO_YOUNG_PTRS") if self.is_in_nursery(addr): oldhdr = self.header(addr_struct) Modified: pypy/dist/pypy/rpython/memory/gc/marksweep.py ============================================================================== --- pypy/dist/pypy/rpython/memory/gc/marksweep.py (original) +++ pypy/dist/pypy/rpython/memory/gc/marksweep.py Tue Dec 4 17:24:36 2007 @@ -4,7 +4,7 @@ from pypy.rpython.memory.support import get_address_linked_list from pypy.rpython.memory.gcheader import GCHeaderBuilder from pypy.rpython.lltypesystem import lltype, llmemory -from pypy.rlib.objectmodel import free_non_gc_object, debug_assert +from pypy.rlib.objectmodel import free_non_gc_object from pypy.rpython.lltypesystem.lloperation import llop from pypy.rlib.rarithmetic import ovfcheck from pypy.rpython.memory.gc.base import GCBase @@ -102,6 +102,7 @@ #llop.debug_print(lltype.Void, 'malloc typeid', typeid, # '->', llmemory.cast_adr_to_int(result)) return llmemory.cast_adr_to_ptr(result, llmemory.GCREF) + malloc_fixedsize.dont_inline = True def malloc_fixedsize_clear(self, typeid, size, can_collect, has_finalizer=False, contains_weakptr=False): @@ -135,6 +136,7 @@ #llop.debug_print(lltype.Void, 'malloc typeid', typeid, # '->', llmemory.cast_adr_to_int(result)) return llmemory.cast_adr_to_ptr(result, llmemory.GCREF) + malloc_fixedsize_clear.dont_inline = True def malloc_varsize(self, typeid, length, size, itemsize, offset_to_length, can_collect, has_finalizer=False): @@ -169,6 +171,7 @@ # 'typeid', typeid, # '->', llmemory.cast_adr_to_int(result)) return llmemory.cast_adr_to_ptr(result, llmemory.GCREF) + malloc_varsize.dont_inline = True def malloc_varsize_clear(self, typeid, length, size, itemsize, offset_to_length, can_collect, @@ -205,6 +208,7 @@ # 'typeid', typeid, # '->', llmemory.cast_adr_to_int(result)) return llmemory.cast_adr_to_ptr(result, llmemory.GCREF) + malloc_varsize_clear.dont_inline = True def collect(self): # 1. mark from the roots, and also the objects that objects-with-del Modified: pypy/dist/pypy/rpython/memory/gc/semispace.py ============================================================================== --- pypy/dist/pypy/rpython/memory/gc/semispace.py (original) +++ pypy/dist/pypy/rpython/memory/gc/semispace.py Tue Dec 4 17:24:36 2007 @@ -4,7 +4,8 @@ from pypy.rpython.memory.support import get_address_linked_list from pypy.rpython.memory.gcheader import GCHeaderBuilder from pypy.rpython.lltypesystem import lltype, llmemory, llarena -from pypy.rlib.objectmodel import free_non_gc_object, debug_assert +from pypy.rlib.objectmodel import free_non_gc_object +from pypy.rlib.debug import ll_assert from pypy.rpython.lltypesystem.lloperation import llop from pypy.rlib.rarithmetic import ovfcheck from pypy.rpython.memory.gc.base import MovingGCBase @@ -37,10 +38,10 @@ def setup(self): self.tospace = llarena.arena_malloc(self.space_size, True) - debug_assert(bool(self.tospace), "couldn't allocate tospace") + ll_assert(bool(self.tospace), "couldn't allocate tospace") self.top_of_space = self.tospace + self.space_size self.fromspace = llarena.arena_malloc(self.space_size, True) - debug_assert(bool(self.fromspace), "couldn't allocate fromspace") + ll_assert(bool(self.fromspace), "couldn't allocate fromspace") self.free = self.tospace self.objects_with_finalizers = self.AddressLinkedList() self.run_finalizers = self.AddressLinkedList() @@ -134,7 +135,7 @@ while self.space_size < proposed_size: if not self.double_space_size(): return False - debug_assert(needed <= self.top_of_space - self.free, + ll_assert(needed <= self.top_of_space - self.free, "double_space_size() failed to do its job") return True @@ -166,7 +167,7 @@ # because doing arena_free(self.fromspace) would crash self.fromspace = self.tospace + self.space_size self.top_of_space = self.fromspace - debug_assert(self.free <= self.top_of_space, + ll_assert(self.free <= self.top_of_space, "unexpected growth of GC space usage during collect") return False # out of memory Modified: pypy/dist/pypy/rpython/memory/gctransform/framework.py ============================================================================== --- pypy/dist/pypy/rpython/memory/gctransform/framework.py (original) +++ pypy/dist/pypy/rpython/memory/gctransform/framework.py Tue Dec 4 17:24:36 2007 @@ -7,7 +7,7 @@ from pypy.rpython.memory.gc import marksweep from pypy.rpython.memory.gcheader import GCHeaderBuilder from pypy.rlib.rarithmetic import ovfcheck -from pypy.rlib.objectmodel import debug_assert +from pypy.rlib.debug import ll_assert from pypy.translator.backendopt import graphanalyze from pypy.translator.backendopt.support import var_needsgc from pypy.annotation import model as annmodel @@ -129,39 +129,39 @@ TYPE_INFO_TABLE = lltype.Array(TYPE_INFO) def q_is_varsize(typeid): - debug_assert(typeid > 0, "invalid type_id") + ll_assert(typeid > 0, "invalid type_id") return gcdata.type_info_table[typeid].isvarsize def q_finalizer(typeid): - debug_assert(typeid > 0, "invalid type_id") + ll_assert(typeid > 0, "invalid type_id") return gcdata.type_info_table[typeid].finalizer def q_offsets_to_gc_pointers(typeid): - debug_assert(typeid > 0, "invalid type_id") + ll_assert(typeid > 0, "invalid type_id") return gcdata.type_info_table[typeid].ofstoptrs def q_fixed_size(typeid): - debug_assert(typeid > 0, "invalid type_id") + ll_assert(typeid > 0, "invalid type_id") return gcdata.type_info_table[typeid].fixedsize def q_varsize_item_sizes(typeid): - debug_assert(typeid > 0, "invalid type_id") + ll_assert(typeid > 0, "invalid type_id") return gcdata.type_info_table[typeid].varitemsize def q_varsize_offset_to_variable_part(typeid): - debug_assert(typeid > 0, "invalid type_id") + ll_assert(typeid > 0, "invalid type_id") return gcdata.type_info_table[typeid].ofstovar def q_varsize_offset_to_length(typeid): - debug_assert(typeid > 0, "invalid type_id") + ll_assert(typeid > 0, "invalid type_id") return gcdata.type_info_table[typeid].ofstolength def q_varsize_offsets_to_gcpointers_in_var_part(typeid): - debug_assert(typeid > 0, "invalid type_id") + ll_assert(typeid > 0, "invalid type_id") return gcdata.type_info_table[typeid].varofstoptrs def q_weakpointer_offset(typeid): - debug_assert(typeid > 0, "invalid type_id") + ll_assert(typeid > 0, "invalid type_id") return gcdata.type_info_table[typeid].weakptrofs self.layoutbuilder = TransformerLayoutBuilder(self) @@ -389,7 +389,7 @@ _alloc_flavor_ = 'raw' def setup_root_stack(): stackbase = llmemory.raw_malloc(rootstacksize) - debug_assert(bool(stackbase), "could not allocate root stack") + ll_assert(bool(stackbase), "could not allocate root stack") llmemory.raw_memclear(stackbase, rootstacksize) gcdata.root_stack_top = stackbase gcdata.root_stack_base = stackbase Modified: pypy/dist/pypy/rpython/numpy/rarray.py ============================================================================== --- pypy/dist/pypy/rpython/numpy/rarray.py (original) +++ pypy/dist/pypy/rpython/numpy/rarray.py Tue Dec 4 17:24:36 2007 @@ -5,7 +5,7 @@ from pypy.tool.pairtype import pairtype, pair from pypy.rlib.unroll import unrolling_iterable from pypy.annotation import listdef -from pypy.rlib.objectmodel import debug_assert +from pypy.rlib.debug import ll_assert from pypy.rpython.annlowlevel import ADTInterface from pypy.rpython.memory.lltypelayout import sizeof from pypy.rpython.rmodel import Repr, FloatRepr, inputconst @@ -136,8 +136,8 @@ # Suffix of ao.shape must match target_ao.shape # (suffix starts at the first non-1 entry in ao.shape.) # ao.shape must be no longer than target_ao.shape. - debug_assert(ao.ndim <= ndim, "ao.ndim <= ndim") - debug_assert(target_ao.ndim == ndim, "target_ao.ndim == ndim") + ll_assert(ao.ndim <= ndim, "ao.ndim <= ndim") + ll_assert(target_ao.ndim == ndim, "target_ao.ndim == ndim") # XX check suffix condition here... ? broadcast = ao.ndim < ndim i = 0 @@ -147,7 +147,7 @@ i += 1 if broadcast: return iter_broadcast_to_shape(ITER, ao, target_ao) - debug_assert(ao.ndim == ndim, "ao.ndim == ndim") + ll_assert(ao.ndim == ndim, "ao.ndim == ndim") it = malloc(ITER) it.nd_m1 = ndim - 1 it.size = ll_mul_list(ao.shape, ndim) @@ -165,7 +165,7 @@ def ll_iter_broadcast_to_shape(ITER, ao, target_ao): "iterate over <ao> but broadcast to the shape of <target_ao>" - debug_assert(target_ao.ndim == ndim, "target_ao.ndim == ndim") + ll_assert(target_ao.ndim == ndim, "target_ao.ndim == ndim") delta = j = ndim - ao.ndim shape = target_ao.shape for i in range(ao.ndim): @@ -198,7 +198,7 @@ def ll_array_set(ITEM, it0, it1): if it0.size == 0: return # empty LHS.. - debug_assert(it0.size == it1.size, "it0.size == it1.size") + ll_assert(it0.size == it1.size, "it0.size == it1.size") while it0.index < it0.size: it0.dataptr[0] = cast_primitive(ITEM, it1.dataptr[0]) it0.ll_next() @@ -365,8 +365,8 @@ #______________________________________________________________________________ def ll_array_binop(it0, it1, it2, binop): - debug_assert(it0.size == it1.size, "it0.size == it1.size") - debug_assert(it1.size == it2.size, "it0.size == it1.size") + ll_assert(it0.size == it1.size, "it0.size == it1.size") + ll_assert(it1.size == it2.size, "it0.size == it1.size") while it0.index < it0.size: # We don't need a cast here, because it0.dataptr[0] is always # big enough to contain the result. @@ -423,7 +423,7 @@ #______________________________________________________________________________ def ll_array_inplace_binop(ITEM, it0, it1, binop): - debug_assert(it0.size == it1.size, "it0.size == it1.size") + ll_assert(it0.size == it1.size, "it0.size == it1.size") while it0.index < it0.size: it0.dataptr[0] = cast_primitive(ITEM, binop(it0.dataptr[0], it1.dataptr[0])) it0.ll_next() @@ -538,7 +538,7 @@ array.strides[tgt_i] = ao.strides[src_i] tgt_i += 1 src_i += 1 - debug_assert(tgt_i == ndim, "tgt_i == ndim") + ll_assert(tgt_i == ndim, "tgt_i == ndim") array.dataptr = dataptr array.data = ao.data # keep a ref return array Modified: pypy/dist/pypy/rpython/rlist.py ============================================================================== --- pypy/dist/pypy/rpython/rlist.py (original) +++ pypy/dist/pypy/rpython/rlist.py Tue Dec 4 17:24:36 2007 @@ -8,7 +8,8 @@ from pypy.rpython.lltypesystem.lltype import typeOf, Ptr, Void, Signed, Bool from pypy.rpython.lltypesystem.lltype import nullptr, Char, UniChar from pypy.rpython import robject -from pypy.rlib.objectmodel import malloc_zero_filled, debug_assert +from pypy.rlib.objectmodel import malloc_zero_filled +from pypy.rlib.debug import ll_assert from pypy.rlib.rarithmetic import ovfcheck from pypy.rpython.annlowlevel import ADTInterface @@ -582,8 +583,8 @@ def ll_insert_nonneg(l, index, newitem): length = l.ll_length() - debug_assert(0 <= index, "negative list insertion index") - debug_assert(index <= length, "list insertion index out of bound") + ll_assert(0 <= index, "negative list insertion index") + ll_assert(index <= length, "list insertion index out of bound") l._ll_resize_ge(length+1) # see "a note about overflows" above dst = length while dst > index: @@ -594,12 +595,12 @@ ll_insert_nonneg.oopspec = 'list.insert(l, index, newitem)' def ll_pop_nonneg(func, l, index): - debug_assert(index >= 0, "unexpectedly negative list pop index") + ll_assert(index >= 0, "unexpectedly negative list pop index") if func is dum_checkidx: if index >= l.ll_length(): raise IndexError else: - debug_assert(index < l.ll_length(), "list pop index out of bound") + ll_assert(index < l.ll_length(), "list pop index out of bound") res = l.ll_getitem_fast(index) ll_delitem_nonneg(dum_nocheck, l, index) return res @@ -609,7 +610,7 @@ length = l.ll_length() if func is dum_checkidx and (length == 0): raise IndexError - debug_assert(length > 0, "pop from empty list") + ll_assert(length > 0, "pop from empty list") index = length - 1 newlength = index res = l.ll_getitem_fast(index) @@ -624,7 +625,7 @@ length = l.ll_length() if func is dum_checkidx and (length == 0): raise IndexError - debug_assert(length > 0, "pop(0) from empty list") + ll_assert(length > 0, "pop(0) from empty list") newlength = length - 1 res = l.ll_getitem_fast(0) j = 0 @@ -648,8 +649,8 @@ if index < 0 or index >= length: raise IndexError else: - debug_assert(index >= 0, "negative list pop index out of bound") - debug_assert(index < length, "list pop index out of bound") + ll_assert(index >= 0, "negative list pop index out of bound") + ll_assert(index < length, "list pop index out of bound") res = l.ll_getitem_fast(index) ll_delitem_nonneg(dum_nocheck, l, index) return res @@ -668,12 +669,12 @@ ll_reverse.oopspec = 'list.reverse(l)' def ll_getitem_nonneg(func, l, index): - debug_assert(index >= 0, "unexpectedly negative list getitem index") + ll_assert(index >= 0, "unexpectedly negative list getitem index") if func is dum_checkidx: if index >= l.ll_length(): raise IndexError else: - debug_assert(index < l.ll_length(), "list getitem index out of bound") + ll_assert(index < l.ll_length(), "list getitem index out of bound") return l.ll_getitem_fast(index) ll_getitem_nonneg.oopspec = 'list.getitem(l, index)' ll_getitem_nonneg.oopargcheck = lambda l, index: (bool(l) and @@ -687,20 +688,20 @@ if index < 0 or index >= length: raise IndexError else: - debug_assert(index >= 0, "negative list getitem index out of bound") - debug_assert(index < length, "list getitem index out of bound") + ll_assert(index >= 0, "negative list getitem index out of bound") + ll_assert(index < length, "list getitem index out of bound") return l.ll_getitem_fast(index) ll_getitem.oopspec = 'list.getitem(l, index)' ll_getitem.oopargcheck = lambda l, index: (bool(l) and -l.ll_length() <= index < l.ll_length()) def ll_setitem_nonneg(func, l, index, newitem): - debug_assert(index >= 0, "unexpectedly negative list setitem index") + ll_assert(index >= 0, "unexpectedly negative list setitem index") if func is dum_checkidx: if index >= l.ll_length(): raise IndexError else: - debug_assert(index < l.ll_length(), "list setitem index out of bound") + ll_assert(index < l.ll_length(), "list setitem index out of bound") l.ll_setitem_fast(index, newitem) ll_setitem_nonneg.oopspec = 'list.setitem(l, index, newitem)' @@ -712,19 +713,19 @@ if index < 0 or index >= length: raise IndexError else: - debug_assert(index >= 0, "negative list setitem index out of bound") - debug_assert(index < length, "list setitem index out of bound") + ll_assert(index >= 0, "negative list setitem index out of bound") + ll_assert(index < length, "list setitem index out of bound") l.ll_setitem_fast(index, newitem) ll_setitem.oopspec = 'list.setitem(l, index, newitem)' def ll_delitem_nonneg(func, l, index): - debug_assert(index >= 0, "unexpectedly negative list delitem index") + ll_assert(index >= 0, "unexpectedly negative list delitem index") length = l.ll_length() if func is dum_checkidx: if index >= length: raise IndexError else: - debug_assert(index < length, "list delitem index out of bound") + ll_assert(index < length, "list delitem index out of bound") newlength = length - 1 j = index j1 = j+1 @@ -747,8 +748,8 @@ if i < 0 or i >= length: raise IndexError else: - debug_assert(i >= 0, "negative list delitem index out of bound") - debug_assert(i < length, "list delitem index out of bound") + ll_assert(i >= 0, "negative list delitem index out of bound") + ll_assert(i < length, "list delitem index out of bound") ll_delitem_nonneg(dum_nocheck, l, i) ll_delitem.oopspec = 'list.delitem(l, i)' @@ -775,7 +776,7 @@ len1 = lst.ll_length() len2 = getstrlen(s) count2 = len2 - start - debug_assert(start >= 0, "unexpectedly negative str slice start") + ll_assert(start >= 0, "unexpectedly negative str slice start") assert count2 >= 0, "str slice start larger than str length" try: newlength = ovfcheck(len1 + count2) @@ -797,8 +798,8 @@ stop = slice.stop len1 = lst.ll_length() len2 = getstrlen(s) - debug_assert(start >= 0, "unexpectedly negative str slice start") - debug_assert(start <= len2, "str slice start larger than str length") + ll_assert(start >= 0, "unexpectedly negative str slice start") + ll_assert(start <= len2, "str slice start larger than str length") if stop > len2: stop = len2 count2 = stop - start @@ -855,8 +856,8 @@ def ll_listslice_startonly(RESLIST, l1, start): len1 = l1.ll_length() - debug_assert(start >= 0, "unexpectedly negative list slice start") - debug_assert(start <= len1, "list slice start larger than list length") + ll_assert(start >= 0, "unexpectedly negative list slice start") + ll_assert(start <= len1, "list slice start larger than list length") newlength = len1 - start l = RESLIST.ll_newlist(newlength) j = 0 @@ -871,9 +872,9 @@ start = slice.start stop = slice.stop length = l1.ll_length() - debug_assert(start >= 0, "unexpectedly negative list slice start") - debug_assert(start <= length, "list slice start larger than list length") - debug_assert(stop >= start, "list slice stop smaller than start") + ll_assert(start >= 0, "unexpectedly negative list slice start") + ll_assert(start <= length, "list slice start larger than list length") + ll_assert(stop >= start, "list slice stop smaller than start") if stop > length: stop = length newlength = stop - start @@ -888,7 +889,7 @@ def ll_listslice_minusone(RESLIST, l1): newlength = l1.ll_length() - 1 - debug_assert(newlength >= 0, "empty list is sliced with [:-1]") + ll_assert(newlength >= 0, "empty list is sliced with [:-1]") l = RESLIST.ll_newlist(newlength) j = 0 while j < newlength: @@ -897,8 +898,8 @@ return l def ll_listdelslice_startonly(l, start): - debug_assert(start >= 0, "del l[start:] with unexpectedly negative start") - debug_assert(start <= l.ll_length(), "del l[start:] with start > len(l)") + ll_assert(start >= 0, "del l[start:] with unexpectedly negative start") + ll_assert(start <= l.ll_length(), "del l[start:] with start > len(l)") newlength = start null = ll_null_item(l) if null is not None: @@ -912,9 +913,9 @@ start = slice.start stop = slice.stop length = l.ll_length() - debug_assert(start >= 0, "del l[start:x] with unexpectedly negative start") - debug_assert(start <= length, "del l[start:x] with start > len(l)") - debug_assert(stop >= start, "del l[x:y] with x > y") + ll_assert(start >= 0, "del l[start:x] with unexpectedly negative start") + ll_assert(start <= length, "del l[start:x] with start > len(l)") + ll_assert(stop >= start, "del l[x:y] with x > y") if stop > length: stop = length newlength = length - (stop-start) @@ -935,9 +936,9 @@ def ll_listsetslice(l1, slice, l2): count = l2.ll_length() start = slice.start - debug_assert(start >= 0, "l[start:x] = l with unexpectedly negative start") - debug_assert(start <= l1.ll_length(), "l[start:x] = l with start > len(l)") - debug_assert(count == slice.stop - start, + ll_assert(start >= 0, "l[start:x] = l with unexpectedly negative start") + ll_assert(start <= l1.ll_length(), "l[start:x] = l with start > len(l)") + ll_assert(count == slice.stop - start, "setslice cannot resize lists in RPython") # XXX but it should be easy enough to support, soon j = start Modified: pypy/dist/pypy/rpython/test/test_rbuiltin.py ============================================================================== --- pypy/dist/pypy/rpython/test/test_rbuiltin.py (original) +++ pypy/dist/pypy/rpython/test/test_rbuiltin.py Tue Dec 4 17:24:36 2007 @@ -1,7 +1,8 @@ from pypy.translator.translator import graphof from pypy.rpython.test import test_llinterp from pypy.rlib.objectmodel import instantiate, we_are_translated -from pypy.rlib.objectmodel import running_on_llinterp, debug_llinterpcall +from pypy.rlib.objectmodel import running_on_llinterp +from pypy.rlib.debug import llinterpcall from pypy.rpython.lltypesystem import lltype from pypy.tool import udir from pypy.rlib.rarithmetic import r_uint, intmask, r_longlong @@ -422,7 +423,7 @@ return s def fn(n): if running_on_llinterp: - return debug_llinterpcall(SPTR, foo, n).m + return llinterpcall(SPTR, foo, n).m else: return 321 res = self.interpret(fn, [7]) _______________________________________________ pypy-svn mailing list pypy-svn@codespeak.net http://codespeak.net/mailman/listinfo/pypy-svn