Struct Vm

Source
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: VmState

Implementations§

Source§

impl Vm

Source

pub fn execute_grid_init( &mut self, dest_reg: u8, element_size_reg: u8, width_lower: u8, width_upper: u8, height_lower: u8, height_upper: u8, )

Source

pub fn execute_grid_get_entry_addr( &mut self, dest_reg: u8, self_addr_reg: u8, x_reg: u8, y_reg: u8, element_lower: u8, element_upper: u8, )

Source§

impl Vm

Source

pub const ELEMENT_COUNT_FACTOR: f32 = 1.5f32

Source

pub fn get_map_header(&self, header_reg: u8) -> *mut MapHeader

Source

pub fn get_map_header_mut(&self, addr: u32) -> *mut MapHeader

Source

pub fn get_map_header_const(&self, addr: u32) -> *const MapHeader

Source

pub fn read_map_header(&self, header_reg: u8) -> (MapHeader, u32)

Source

pub fn read_map_header_from_heap( map_header_heap_addr: u32, heap: &Memory, ) -> MapHeader

Source

pub fn execute_map_open_addressing_get_entry_location( &mut self, dst_entry_address: u8, self_map_header_reg: u8, key_source: u8, )

Source

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, )

Source

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, )

Source

pub fn execute_map_open_addressing_has( &mut self, dest_reg: u8, self_const_map_header_reg: u8, key_source_reg: u8, )

Source

pub fn execute_map_overwrite( &mut self, target_map_header_reg: u8, source_map_header_reg: u8, )

Source

pub fn execute_map_open_addressing_remove( &mut self, self_map_header_reg: u8, key_source_reg: u8, )

Source

pub fn get_map_iterator_header_ptr_from_reg( &self, map_iterator_reg: u8, ) -> *mut MapIterator

Source

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, )

Source

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

Source

pub fn get_range_header_ptr_from_reg(&self, range_reg: u8) -> *mut RangeHeader

Source

pub fn range_header_from_reg(&self, range_reg: u8) -> RangeHeader

Source

pub fn range_iterator_ptr_from_reg( &self, range_iterator_reg: u8, ) -> *mut RangeIterator

Source

pub fn execute_range_init( &mut self, range_target_reg: u8, min_reg: u8, max_reg: u8, is_inclusive: u8, )

Source

pub fn execute_range_iter_init( &mut self, target_iterator_reg: u8, range_header_reg: u8, )

Source

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

Source

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, )

Source

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, )

Source

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, )

Source

pub fn execute_sparse_remove(&mut self, sparse_ptr_reg: u8, int_handle_reg: u8)

Source

pub fn execute_sparse_is_alive( &mut self, dest_reg_bool: u8, sparse_ptr_reg: u8, int_handle_reg: u8, )

Source

pub fn get_sparse_iterator_header_ptr_from_reg( &self, map_iterator_reg: u8, ) -> *mut SparseIterator

Source

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, )

Source

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

Source

pub fn get_string_iterator_header_ptr_from_reg( &self, vec_iterator_reg: u8, ) -> *mut StringIterator

Source

pub fn verify_string(&mut self, raw_bytes: &[u8])

Source

pub fn verify_string_without_mut(&self, raw_bytes: &[u8])

Source

pub fn execute_string_from_bytes( &mut self, target_string_view_reg: u8, bytes_vec_reg: u8, )

Source

pub fn execute_string_storage_from_bytes( &mut self, target_string_storage_reg: u8, bytes_vec_reg: u8, )

Source

pub fn execute_string_duplicate( &mut self, target_string_view_reg: u8, string_storage: u8, )

Source

pub fn execute_string_append( &mut self, target_string_reg: u8, string_a: u8, string_b: u8, )

Source

pub fn execute_string_repeat( &mut self, target_string_reg: u8, string_a: u8, repeat_reg: u8, )

Source

pub fn execute_string_cmp(&mut self, dest_reg: u8, string_a: u8, string_b: u8)

Source

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.

Source

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

Source

pub fn execute_string_to_int(&mut self, dest_tuple_reg: u8, source_string: u8)

Source

pub fn execute_string_to_string(&mut self, dest_reg: u8, source_string: u8)

Return the same string but with quotes.

Source

pub fn read_string(&self, heap_addr: u32, heap: &Memory) -> &str

Source

pub fn execute_string_iter_init( &mut self, target_string_iterator_header_reg: u8, string_header_reg: u8, )

Source

pub fn execute_string_iter_next( &mut self, string_iterator_header_reg: u8, target_variable: u8, branch_offset_lower: u8, branch_offset_upper: u8, )

Source

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

Source

pub fn get_vec_iterator_header_ptr_from_reg( &self, vec_iterator_reg: u8, ) -> *mut VecIterator

Source

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, )

Source

pub fn execute_vec_cmp( &mut self, bool_target_reg: u8, left_vec_ptr_reg: u8, right_vec_ptr_reg: u8, )

Source

pub fn execute_vec_copy( &mut self, target_vec_ptr_reg: u8, source_vec_ptr_reg: u8, )

Source

pub fn execute_vec_copy_range( &mut self, target_vec_ptr_reg: u8, source_vec_ptr_reg: u8, range_reg: u8, )

Source

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, )

Source

pub fn execute_vec_iter_init( &mut self, target_vec_iterator_header_reg: u8, vec_header_reg: u8, )

Source

pub fn execute_vec_iter_next( &mut self, vec_iterator_header_reg: u8, target_variable: u8, branch_offset_lower: u8, branch_offset_upper: u8, )

Source

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, )

Source

pub fn vec_header_from_heap(heap: &Memory, heap_offset: u32) -> VecHeader

Source

pub fn read_vec_header_from_ptr_reg(&self, vec_header_ptr_reg: u8) -> VecHeader

Source

pub fn get_vec_header_ptr_from_reg( &self, vec_header_ptr_reg: u8, ) -> *mut VecHeader

Source

pub fn execute_vec_get( &mut self, element_target_reg: u8, vec_header_ptr_reg: u8, int_reg: u8, )

Source

pub fn execute_vec_set( &mut self, vec_header_ptr_reg: u8, int_index_reg: u8, item_ptr_reg: u8, )

Source

pub fn execute_vec_extend(&mut self, destination_vec_reg: u8, src_other_vec: u8)

Source

pub fn execute_vec_push_addr( &mut self, destination_entry_addr_reg: u8, src_vec_header_ptr_reg: u8, )

Source

pub fn execute_vec_pop(&mut self, dst_reg: u8, vec_header_ptr_reg: u8)

Source

pub fn execute_vec_remove_index( &mut self, vec_header_ptr_reg: u8, remove_index_reg: u8, )

Source§

impl Vm

Source

pub const fn is_execution_complete(&self) -> bool

Source§

impl Vm

Source

pub fn new(instructions: Vec<BinaryInstruction>, setup: VmSetup) -> Self

Source

pub const fn memory(&self) -> &Memory

Source

pub fn memory_mut(&mut self) -> &mut Memory

Source

pub fn step( &mut self, host_function_callback: &mut dyn HostFunctionCallback, ) -> bool

Source

pub fn execute_internal( &mut self, host_function_callback: &mut dyn HostFunctionCallback, )

Source

pub const fn set_return_register_address(&mut self, r0_addr: u32)

Source

pub fn set_register_pointer_addr_for_parameter( &mut self, register: u8, addr: u32, )

Source

pub fn set_stack_start(&mut self, addr: usize)

Source

pub fn resume(&mut self, host_function_callback: &mut dyn HostFunctionCallback)

Source

pub fn execute_from_ip( &mut self, ip: &InstructionPosition, host_function_callback: &mut dyn HostFunctionCallback, )

Source

pub const fn set_pc(&mut self, pc: &InstructionPosition)

Source

pub const fn pc(&self) -> usize

Source

pub fn fp(&self) -> usize

Source

pub fn sp(&self) -> usize

Source

pub fn call_stack(&self) -> &[CallFrame]

Source

pub fn frame_memory(&self) -> &[u8]

Source

pub fn heap_memory(&self) -> &[u8]

Source

pub fn constant_memory(&self) -> &[u8]

Source

pub fn all_memory_up_to(&self, offset: usize) -> &[u8]

Source

pub fn constant_size(&self) -> usize

Source

pub fn instructions(&self) -> &[BinaryInstruction]

Source

pub fn reset(&mut self)

Source

pub fn reset_heap_allocator(&mut self)

Source

pub fn reset_minimal_stack_and_fp(&mut self)

Source

pub fn reset_call_stack(&mut self)

Source

pub fn reset_debug(&mut self)

Source

pub fn frame_offset(&self) -> usize

Source

pub fn load_bytecode(&mut self, instructions: Vec<BinaryInstruction>)

Source

pub fn internal_trap(&mut self, trap_code: TrapCode)

Source

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, )

Source

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, )

Source

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, )

Source

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, )

Source

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, )

Source

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, )

Source

pub fn get_const_ptr_from_reg(&self, reg: u8) -> *const u8

Source

pub fn get_const_ptr_from_reg_with_offset( &self, reg: u8, offset: u32, ) -> *const u8

Source

pub fn get_ptr_from_reg(&self, reg: u8) -> *mut u8

Source

pub fn get_ptr_and_addr_from_reg(&self, reg: u8) -> (*mut u8, u32)

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.