pub struct Vm {
pub registers: [u32; 256],
pub debug: Debug,
pub debug_stats_enabled: bool,
pub debug_opcodes_enabled: bool,
pub debug_operations_enabled: bool,
pub state: VmState,
/* private fields */
}Fields§
§registers: [u32; 256]§debug: Debug§debug_stats_enabled: bool§debug_opcodes_enabled: bool§debug_operations_enabled: bool§state: VmStateImplementations§
Source§impl Vm
impl Vm
pub const ELEMENT_COUNT_FACTOR: f32 = 1.5f32
pub fn get_map_header(&self, header_reg: u8) -> *mut MapHeader
pub fn get_map_header_mut(&self, addr: u32) -> *mut MapHeader
pub fn get_map_header_const(&self, addr: u32) -> *const MapHeader
pub fn read_map_header(&self, header_reg: u8) -> (MapHeader, u32)
pub fn read_map_header_from_heap( map_header_heap_addr: u32, heap: &Memory, ) -> MapHeader
pub fn execute_map_open_addressing_get_entry_location( &mut self, dst_entry_address: u8, self_map_header_reg: u8, key_source: u8, )
pub fn execute_map_open_addressing_init( &mut self, self_map_header_reg: u8, logical_limit_immediate_lower: u8, logical_limit_immediate_upper: u8, key_size_reg: u8, key_alignment: u8, value_size_reg: u8, value_alignment: u8, )
pub fn execute_map_open_addressing_get_or_reserve_entry( &mut self, dst_entry_address: u8, self_map_header_reg: u8, key_source_ptr_reg: u8, )
pub fn execute_map_open_addressing_has( &mut self, dest_reg: u8, self_const_map_header_reg: u8, key_source_reg: u8, )
pub fn execute_map_overwrite( &mut self, target_map_header_reg: u8, source_map_header_reg: u8, )
pub fn execute_map_open_addressing_remove( &mut self, self_map_header_reg: u8, key_source_reg: u8, )
pub fn get_map_iterator_header_ptr_from_reg( &self, map_iterator_reg: u8, ) -> *mut MapIterator
pub fn execute_map_iter_next_pair( &mut self, map_iterator_header_reg: u8, target_key_reg: u8, target_value_reg: u8, branch_offset_lower: u8, branch_offset_upper: u8, )
pub fn execute_map_iter_next( &mut self, map_iterator_header_reg: u8, target_value_reg: u8, branch_offset_lower: u8, branch_offset_upper: u8, )
Source§impl Vm
impl Vm
pub fn get_range_header_ptr_from_reg(&self, range_reg: u8) -> *mut RangeHeader
pub fn range_header_from_reg(&self, range_reg: u8) -> RangeHeader
pub fn range_iterator_ptr_from_reg( &self, range_iterator_reg: u8, ) -> *mut RangeIterator
pub fn execute_range_init( &mut self, range_target_reg: u8, min_reg: u8, max_reg: u8, is_inclusive: u8, )
pub fn execute_range_iter_init( &mut self, target_iterator_reg: u8, range_header_reg: u8, )
pub fn execute_range_iter_next( &mut self, target_iterator_reg: u8, target_int_reg: u8, jmp_offset_lower: u8, jmp_offset_upper: u8, )
Source§impl Vm
impl Vm
pub fn execute_sparse_init( &mut self, dest_reg: u8, element_size_0: u8, element_size_1: u8, element_size_2: u8, element_size_3: u8, capacity_0: u8, capacity_1: u8, )
pub fn execute_sparse_add_get_entry_addr( &mut self, dest_entry_addr_reg: u8, dest_handle_reg: u8, sparse_ptr_reg: u8, memory_size_0: u8, memory_size_1: u8, memory_size_2: u8, memory_size_3: u8, )
pub fn execute_sparse_get_entry_addr( &mut self, dest_entry_addr_reg: u8, sparse_ptr_reg: u8, int_handle_reg: u8, memory_size_lower: u8, memory_size_upper: u8, )
pub fn execute_sparse_remove(&mut self, sparse_ptr_reg: u8, int_handle_reg: u8)
pub fn execute_sparse_is_alive( &mut self, dest_reg_bool: u8, sparse_ptr_reg: u8, int_handle_reg: u8, )
pub fn get_sparse_iterator_header_ptr_from_reg( &self, map_iterator_reg: u8, ) -> *mut SparseIterator
pub fn execute_sparse_iter_next_pair( &mut self, sparse_iterator_header_reg: u8, target_key_reg: u8, target_value_reg: u8, branch_offset_lower: u8, branch_offset_upper: u8, )
pub fn execute_sparse_iter_next( &mut self, sparse_iterator_header_reg: u8, target_entry_address_reg: u8, branch_offset_lower: u8, branch_offset_upper: u8, )
Source§impl Vm
impl Vm
pub fn get_string_iterator_header_ptr_from_reg( &self, vec_iterator_reg: u8, ) -> *mut StringIterator
pub fn verify_string(&mut self, raw_bytes: &[u8])
pub fn verify_string_without_mut(&self, raw_bytes: &[u8])
pub fn execute_string_from_bytes( &mut self, target_string_view_reg: u8, bytes_vec_reg: u8, )
pub fn execute_string_storage_from_bytes( &mut self, target_string_storage_reg: u8, bytes_vec_reg: u8, )
pub fn execute_string_duplicate( &mut self, target_string_view_reg: u8, string_storage: u8, )
pub fn execute_string_append( &mut self, target_string_reg: u8, string_a: u8, string_b: u8, )
pub fn execute_string_repeat( &mut self, target_string_reg: u8, string_a: u8, repeat_reg: u8, )
pub fn execute_string_cmp(&mut self, dest_reg: u8, string_a: u8, string_b: u8)
Sourcepub fn execute_string_starts_with(
&mut self,
dest_reg: u8,
source_string: u8,
other_string_reg: u8,
)
pub fn execute_string_starts_with( &mut self, dest_reg: u8, source_string: u8, other_string_reg: u8, )
Return the same string but with quotes.
Sourcepub fn execute_string_to_float(&mut self, dest_tuple_reg: u8, source_string: u8)
pub fn execute_string_to_float(&mut self, dest_tuple_reg: u8, source_string: u8)
Parses the string to float and returns the tuple with result
pub fn execute_string_to_int(&mut self, dest_tuple_reg: u8, source_string: u8)
Sourcepub fn execute_string_to_string(&mut self, dest_reg: u8, source_string: u8)
pub fn execute_string_to_string(&mut self, dest_reg: u8, source_string: u8)
Return the same string but with quotes.
pub fn read_string(&self, heap_addr: u32, heap: &Memory) -> &str
pub fn execute_string_iter_init( &mut self, target_string_iterator_header_reg: u8, string_header_reg: u8, )
pub fn execute_string_iter_next( &mut self, string_iterator_header_reg: u8, target_variable: u8, branch_offset_lower: u8, branch_offset_upper: u8, )
pub fn execute_string_iter_next_pair( &mut self, string_iterator_header_reg: u8, target_key_reg: u8, target_value_reg: u8, branch_offset_lower: u8, branch_offset_upper: u8, )
Source§impl Vm
impl Vm
pub fn get_vec_iterator_header_ptr_from_reg( &self, vec_iterator_reg: u8, ) -> *mut VecIterator
pub fn execute_array_init( &mut self, target_vec_ptr_reg: u8, capacity_lower: u8, capacity_upper: u8, element_size_0: u8, element_size_1: u8, element_size_2: u8, element_size_3: u8, )
pub fn execute_vec_cmp( &mut self, bool_target_reg: u8, left_vec_ptr_reg: u8, right_vec_ptr_reg: u8, )
pub fn execute_vec_copy( &mut self, target_vec_ptr_reg: u8, source_vec_ptr_reg: u8, )
pub fn execute_vec_copy_range( &mut self, target_vec_ptr_reg: u8, source_vec_ptr_reg: u8, range_reg: u8, )
pub fn execute_vec_init( &mut self, target_vec_ptr_reg: u8, capacity_lower: u8, capacity_upper: u8, element_size_0: u8, element_size_1: u8, element_size_2: u8, element_size_3: u8, )
pub fn execute_vec_iter_init( &mut self, target_vec_iterator_header_reg: u8, vec_header_reg: u8, )
pub fn execute_vec_iter_next( &mut self, vec_iterator_header_reg: u8, target_variable: u8, branch_offset_lower: u8, branch_offset_upper: u8, )
pub fn execute_vec_iter_next_pair( &mut self, vec_iterator_header_reg: u8, target_key_reg: u8, target_value_reg: u8, branch_offset_lower: u8, branch_offset_upper: u8, )
pub fn vec_header_from_heap(heap: &Memory, heap_offset: u32) -> VecHeader
pub fn read_vec_header_from_ptr_reg(&self, vec_header_ptr_reg: u8) -> VecHeader
pub fn get_vec_header_ptr_from_reg( &self, vec_header_ptr_reg: u8, ) -> *mut VecHeader
pub fn execute_vec_get( &mut self, element_target_reg: u8, vec_header_ptr_reg: u8, int_reg: u8, )
pub fn execute_vec_set( &mut self, vec_header_ptr_reg: u8, int_index_reg: u8, item_ptr_reg: u8, )
pub fn execute_vec_extend(&mut self, destination_vec_reg: u8, src_other_vec: u8)
pub fn execute_vec_push_addr( &mut self, destination_entry_addr_reg: u8, src_vec_header_ptr_reg: u8, )
pub fn execute_vec_pop(&mut self, dst_reg: u8, vec_header_ptr_reg: u8)
pub fn execute_vec_remove_index( &mut self, vec_header_ptr_reg: u8, remove_index_reg: u8, )
Source§impl Vm
impl Vm
pub fn new(instructions: Vec<BinaryInstruction>, setup: VmSetup) -> Self
pub const fn memory(&self) -> &Memory
pub fn memory_mut(&mut self) -> &mut Memory
pub fn step( &mut self, host_function_callback: &mut dyn HostFunctionCallback, ) -> bool
pub fn execute_internal( &mut self, host_function_callback: &mut dyn HostFunctionCallback, )
pub const fn set_return_register_address(&mut self, r0_addr: u32)
pub fn set_register_pointer_addr_for_parameter( &mut self, register: u8, addr: u32, )
pub fn set_stack_start(&mut self, addr: usize)
pub fn resume(&mut self, host_function_callback: &mut dyn HostFunctionCallback)
pub fn execute_from_ip( &mut self, ip: &InstructionPosition, host_function_callback: &mut dyn HostFunctionCallback, )
pub const fn set_pc(&mut self, pc: &InstructionPosition)
pub const fn pc(&self) -> usize
pub fn fp(&self) -> usize
pub fn sp(&self) -> usize
pub fn call_stack(&self) -> &[CallFrame]
pub fn frame_memory(&self) -> &[u8] ⓘ
pub fn heap_memory(&self) -> &[u8] ⓘ
pub fn constant_memory(&self) -> &[u8] ⓘ
pub fn all_memory_up_to(&self, offset: usize) -> &[u8] ⓘ
pub fn constant_size(&self) -> usize
pub fn instructions(&self) -> &[BinaryInstruction]
pub fn reset(&mut self)
pub fn reset_heap_allocator(&mut self)
pub fn reset_minimal_stack_and_fp(&mut self)
pub fn reset_call_stack(&mut self)
pub fn reset_debug(&mut self)
pub fn frame_offset(&self) -> usize
pub fn load_bytecode(&mut self, instructions: Vec<BinaryInstruction>)
pub fn internal_trap(&mut self, trap_code: TrapCode)
pub fn execute_ldb_from_base_ptr_and_offset( &mut self, dst_reg: u8, base_ptr_reg: u8, offset_0: u8, offset_1: u8, offset_2: u8, offset_3: u8, )
pub fn execute_ldw_from_base_ptr_and_offset( &mut self, dst_reg: u8, base_ptr_reg: u8, offset_0: u8, offset_1: u8, offset_2: u8, offset_3: u8, )
pub fn execute_ldh_from_base_ptr_and_offset( &mut self, dst_reg: u8, base_ptr_reg: u8, offset_0: u8, offset_1: u8, offset_2: u8, offset_3: u8, )
pub fn execute_ld_regs_from_frame( &mut self, start_reg: u8, offset_0: u8, offset_1: u8, offset_2: u8, offset_3: u8, count: u8, )
pub fn execute_ld_regs_from_frame_using_mask( &mut self, reg_mask: u8, offset_0: u8, offset_1: u8, offset_2: u8, offset_3: u8, )
pub fn execute_frame_memory_clear( &mut self, dst_pointer_0: u8, dst_pointer_1: u8, dst_pointer_2: u8, dst_pointer_3: u8, memory_size_0: u8, memory_size_1: u8, memory_size_2: u8, memory_size_3: u8, )
pub fn get_const_ptr_from_reg(&self, reg: u8) -> *const u8
pub fn get_const_ptr_from_reg_with_offset( &self, reg: u8, offset: u32, ) -> *const u8
pub fn get_ptr_from_reg(&self, reg: u8) -> *mut u8
pub fn get_ptr_and_addr_from_reg(&self, reg: u8) -> (*mut u8, u32)
pub fn get_ptr_from_reg_with_offset(&self, reg: u8, offset: u32) -> *mut u8
Auto Trait Implementations§
impl Freeze for Vm
impl RefUnwindSafe for Vm
impl !Send for Vm
impl !Sync for Vm
impl Unpin for Vm
impl UnwindSafe for Vm
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more