def new(self, thrd, callback, arg): self.newthrd = thrd._thrd self.runfn = callback self.arg = arg # make a fresh new clean SUSPSTACK newsuspstack = lltype.malloc(SUSPSTACK) newsuspstack.handle = _c.null_handle self.suspstack = newsuspstack # Invoke '_new_callback' by closing the stack # callback_pieces = llop.gc_detach_callback_pieces(llmemory.Address) newsuspstack.callback_pieces = callback_pieces # h = pypy_asm_stackwalk2(llhelper(FUNCNOARG_P, _new_callback), alternateanchor) # llop.gc_reattach_callback_pieces(lltype.Void, callback_pieces) return self.get_result_suspstack(h)
def new(self, thrd, callback, arg): self.newthrd = thrd._thrd self.runfn = callback self.arg = arg # make a fresh new clean SUSPSTACK rgc.register_custom_trace_hook(SUSPSTACK, lambda_customtrace) newsuspstack = lltype.malloc(SUSPSTACK) newsuspstack.handle = _c.null_handle self.suspstack = newsuspstack # Invoke '_new_callback' by closing the stack # callback_pieces = llop.gc_detach_callback_pieces(llmemory.Address) newsuspstack.callback_pieces = callback_pieces # h = pypy_asm_stackwalk2(llhelper(FUNCNOARG_P, _new_callback), alternateanchor) h = rffi.cast(_c.handle, h) # llop.gc_reattach_callback_pieces(lltype.Void, callback_pieces) return self.get_result_suspstack(h)
def switch(self, suspstack): # Immediately before the switch, 'suspstack' describes the suspended # state of the *target* of the switch. Then it is theoretically # freed. In fact what occurs is that we reuse the same 'suspstack' # object in the target, just after the switch, to store the # description of where we came from. Then that "other" 'suspstack' # object is returned. self.suspstack = suspstack # callback_pieces = llop.gc_detach_callback_pieces(llmemory.Address) old_callback_pieces = suspstack.callback_pieces suspstack.callback_pieces = callback_pieces # h = pypy_asm_stackwalk2(llhelper(FUNCNOARG_P, _switch_callback), alternateanchor) # llop.gc_reattach_callback_pieces(lltype.Void, callback_pieces) if not h: self.suspstack.callback_pieces = old_callback_pieces # return self.get_result_suspstack(h)
def switch(self, suspstack): # Immediately before the switch, 'suspstack' describes the suspended # state of the *target* of the switch. Then it is theoretically # freed. In fact what occurs is that we reuse the same 'suspstack' # object in the target, just after the switch, to store the # description of where we came from. Then that "other" 'suspstack' # object is returned. self.suspstack = suspstack # callback_pieces = llop.gc_detach_callback_pieces(llmemory.Address) old_callback_pieces = suspstack.callback_pieces suspstack.callback_pieces = callback_pieces # h = pypy_asm_stackwalk2(llhelper(FUNCNOARG_P, _switch_callback), alternateanchor) h = rffi.cast(_c.handle, h) # llop.gc_reattach_callback_pieces(lltype.Void, callback_pieces) if not h: self.suspstack.callback_pieces = old_callback_pieces # return self.get_result_suspstack(h)