def setraw(value): if we_are_translated(): _threadlocalref_seeme(self) addr = llop.threadlocalref_addr(llmemory.Address) llop.raw_store(lltype.Void, addr, offset, value) else: self.local.rawvalue = value
def write_int_at_mem(self, gcref, ofs, size, newvalue): for TYPE, _, itemsize in unroll_basic_sizes: if size == itemsize: newvalue = rffi.cast(TYPE, newvalue) llop.raw_store(lltype.Void, gcref, ofs, newvalue) return else: raise NotImplementedError("size = %d" % size)
def _do_ffi_call_singlefloat(cif_description, func_addr, exchange_buffer): # a separate function in case the backend doesn't support singlefloats result = jit_ffi_call_impl_singlefloat(cif_description, func_addr, exchange_buffer) llop.raw_store(lltype.Void, llmemory.cast_ptr_to_adr(exchange_buffer), cif_description.exchange_result, result)
def _do_ffi_call_sint(cif_description, func_addr, exchange_buffer): result = jit_ffi_call_impl_int(cif_description, func_addr, exchange_buffer) size = types.getsize(cif_description.rtype) for TP in _short_sint_types: # short **signed** types if size == rffi.sizeof(TP): llop.raw_store(lltype.Void, llmemory.cast_ptr_to_adr(exchange_buffer), cif_description.exchange_result, rffi.cast(TP, result)) break else: # default case: expect a full signed number llop.raw_store(lltype.Void, llmemory.cast_ptr_to_adr(exchange_buffer), cif_description.exchange_result, result)
def _do_ffi_call_uint(cif_description, func_addr, exchange_buffer): result = jit_ffi_call_impl_int(cif_description, func_addr, exchange_buffer) size = types.getsize(cif_description.rtype) for TP in _short_uint_types: # short **unsigned** types if size == rffi.sizeof(TP): llop.raw_store(lltype.Void, llmemory.cast_ptr_to_adr(exchange_buffer), cif_description.exchange_result, rffi.cast(TP, result)) break else: # default case: expect a full unsigned number llop.raw_store(lltype.Void, llmemory.cast_ptr_to_adr(exchange_buffer), cif_description.exchange_result, rffi.cast(lltype.Unsigned, result))
def typed_write(self, TP, byte_offset, value): """ Write the value of type TP at byte_offset. No bounds checks """ if self.readonly or not is_alignment_correct(TP, byte_offset): raise CannotWrite ptr = self.get_raw_address() value = lltype.cast_primitive(TP, value) return llop.raw_store(lltype.Void, ptr, byte_offset, value)
def write_float_at_mem(self, gcref, ofs, newvalue): llop.raw_store(lltype.Void, gcref, ofs, newvalue)