Exemplo n.º 1
0
 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
Exemplo n.º 2
0
 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