def setup(): rgc.register_custom_trace_hook(S, lambda_customtrace) tx = lltype.malloc(T) tx.z = 4243 s1 = lltype.malloc(S) s1.x = llmemory.cast_ptr_to_adr(tx) return s1
def new(thrd, callback, arg): rgc.register_custom_trace_hook(STACKLET, lambda_customtrace) result_stacklet = alloc_stacklet() gcrootfinder.fresh_stacklet = alloc_stacklet() gcrootfinder.runfn = callback thread_handle = thrd._thrd h = _new(thread_handle, arg) return attach_handle_on_stacklet(result_stacklet, h)
def set(value): assert isinstance(value, Cls) or value is None if we_are_translated(): from rpython.rtyper.annlowlevel import cast_instance_to_gcref gcref = cast_instance_to_gcref(value) value = lltype.cast_ptr_to_int(gcref) setraw(value) rgc.register_custom_trace_hook(TRACETLREF, _lambda_trace_tlref) rgc.ll_writebarrier(_tracetlref_obj) else: self.local.value = value
def set(value): assert isinstance(value, Cls) or value is None if we_are_translated(): from rpython.rtyper.annlowlevel import cast_instance_to_base_ptr ptr = cast_instance_to_base_ptr(value) _threadlocalref_seeme(self) llop.threadlocalref_store(lltype.Void, offset, ptr) rgc.register_custom_trace_hook(TRACETLREF, _lambda_trace_tlref) rgc.ll_writebarrier(_tracetlref_obj) else: self.local.value = value
def make_framework_tracer(array_base_addr, gcrefs): # careful about the order here: the allocation of the GCREFTRACER # can trigger a GC. So we must write the gcrefs into the raw # array only afterwards... rgc.register_custom_trace_hook(GCREFTRACER, lambda_gcrefs_trace) length = len(gcrefs) tr = lltype.malloc(GCREFTRACER) # --no GC from here-- tr.array_base_addr = array_base_addr tr.array_length = length i = 0 while i < length: p = rffi.cast(rffi.SIGNEDP, array_base_addr + i * WORD) p[0] = rffi.cast(lltype.Signed, gcrefs[i]) i += 1 llop.gc_writebarrier(lltype.Void, tr) # --no GC until here-- return tr
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 f(): rgc.register_custom_trace_hook(TP, lambda_trace_func)
def entrypoint(argv): lltype.malloc(S) rgc.register_custom_trace_hook(S, lambda_trace_func) return 0
def _setup(): rgc.register_custom_trace_hook(OBJECTSTORE, lambda_customtrace)
def f(): rgc.register_custom_trace_hook(S, lambda_trace_hook) s = lltype.malloc(S) rgc.collect() keepalive_until_here(s)
def jitframe_allocate(frame_info): rgc.register_custom_trace_hook(JITFRAME, lambda_jitframe_trace) frame = lltype.malloc(JITFRAME, frame_info.jfi_frame_depth) frame.jf_frame_info = frame_info return frame
def jitframe_allocate(frame_info): rgc.register_custom_trace_hook(JITFRAME, lambda_jitframe_trace) frame = lltype.malloc(JITFRAME, frame_info.jfi_frame_depth) frame.jf_frame_info = frame_info frame.jf_extra_stack_depth = 0 return frame