def belongs_to_current_thread(framedata): # xxx obscure: the answer is Yes if, as a pointer, framedata # lies between the start of the current stack and the top of it. stack_start = gcdata.aid2stack.get(get_aid(), llmemory.NULL) ll_assert(stack_start != llmemory.NULL, "current thread not found in gcdata.aid2stack!") stack_stop = llop.stack_current(llmemory.Address) return (stack_start <= framedata <= stack_stop or stack_start >= framedata >= stack_stop)
def belongs_to_current_thread(framedata): # xxx obscure: the answer is Yes if, as a pointer, framedata # lies between the start of the current stack and the top of it. stack_start = gcdata.aid2stack.get(get_aid(), llmemory.NULL) ll_assert(stack_start != llmemory.NULL, "current thread not found in gcdata.aid2stack!") stack_stop = llmemory.cast_int_to_adr( llop.stack_current(lltype.Signed)) return (stack_start <= framedata <= stack_stop or stack_start >= framedata >= stack_stop)
def stack_almost_full(): """Return True if the stack is more than 15/16th full.""" if not we_are_translated(): return False # see stack_check() current = llop.stack_current(lltype.Signed) end = _stack_get_end() length = 15 * (r_uint(_stack_get_length()) >> 4) ofs = r_uint(end - current) if ofs <= length: return False # fine else: _stack_too_big_slowpath(current) # this might update the stack end end = _stack_get_end() ofs = r_uint(end - current) return ofs > length
def stack_check(): if not we_are_translated(): return # # Load the "current" stack position, or at least some address that # points close to the current stack head current = llop.stack_current(lltype.Signed) # # Load these variables from C code end = _stack_get_end() length = _stack_get_length() # # Common case: if 'current' is within [end-length:end], everything # is fine ofs = r_uint(end - current) if ofs <= r_uint(length): return # # Else call the slow path stack_check_slowpath(current)
def stack_check(): if not we_are_translated(): return # # Load the "current" stack position, or at least some address that # points close to the current stack head current = llop.stack_current(lltype.Signed) # # Load these variables from C code end = _stack_get_end() length = _stack_get_length() # # Common case: if 'current' is within [end-length:end], everything # is fine ofs = r_uint(end - current) if ofs <= r_uint(length): return # # Else call the slow path stack_check_slowpath(current)
def thread_start(): value = llmemory.cast_int_to_adr(llop.stack_current(lltype.Signed)) gcdata.aid2stack.setitem(get_aid(), value)
def thread_start(): value = llop.stack_current(llmemory.Address) gcdata.aid2stack.setitem(get_aid(), value)
def thread_start(): value = llmemory.cast_int_to_adr(llop.stack_current(lltype.Signed)) gcdata.aid2stack.setitem(get_aid(), value)