Skip to main content

Vm

Struct Vm 

Source
pub struct Vm { /* private fields */ }

Implementations§

Source§

impl Vm

Source§

impl Vm

Source

pub fn compile_aot(&mut self) -> VmResult<()>

Source

pub fn clear_aot(&mut self)

Source

pub fn has_aot_program(&self) -> bool

Source

pub fn aot_exec_count(&self) -> u64

Source

pub fn aot_resume_ips(&self) -> Option<&[usize]>

Source

pub fn dump_aot_info(&self) -> String

Source§

impl Vm

Source

pub fn consume_epoch_tick(&mut self) -> VmResult<()>

Source

pub fn epoch_handle(&self) -> EpochHandle

Source

pub fn current_epoch(&self) -> u64

Source

pub fn increment_epoch(&self) -> u64

Source

pub fn increment_epoch_by(&self, delta: u64) -> u64

Source

pub fn set_epoch_deadline(&mut self, ticks_beyond_current: u64) -> VmResult<()>

Source

pub fn clear_epoch_deadline(&mut self)

Source

pub fn epoch_deadline(&self) -> Option<u64>

Source

pub fn epoch_deadline_delta(&self) -> Option<u64>

Source

pub fn set_epoch_check_interval(&mut self, interval: u32) -> VmResult<()>

Source

pub fn epoch_check_interval(&self) -> u32

Source

pub fn epoch_checkpoint(&self) -> EpochCheckpoint

Source

pub fn restore_epoch(&mut self, checkpoint: EpochCheckpoint)

Source

pub fn last_yield_reason(&self) -> Option<VmYieldReason>

Source§

impl Vm

Source

pub fn set_fuel(&mut self, fuel: u64)

Source

pub fn clear_fuel(&mut self)

Source

pub fn set_fuel_check_interval(&mut self, interval: u32) -> VmResult<()>

Source

pub fn fuel_check_interval(&self) -> u32

Source

pub fn get_fuel(&self) -> Option<u64>

Source

pub fn add_fuel(&mut self, fuel: u64) -> VmResult<()>

Source

pub fn recharge_fuel(&mut self, fuel: u64) -> VmResult<()>

Source

pub fn consume_fuel(&mut self, fuel: u64) -> VmResult<()>

Source

pub fn consume_fuel_tick(&mut self) -> VmResult<()>

Source

pub fn fuel_checkpoint(&self) -> FuelCheckpoint

Source

pub fn checkpoint(&self) -> FuelCheckpoint

Source

pub fn restore_fuel(&mut self, checkpoint: FuelCheckpoint)

Source

pub fn restore_checkpoint(&mut self, checkpoint: FuelCheckpoint)

Source§

impl Vm

Source

pub fn register_function(&mut self, function: Box<dyn HostFunction>) -> u16

Source

pub fn register_static_function(&mut self, function: StaticHostFunction) -> u16

Source

pub fn register_stack_function( &mut self, function: Box<dyn HostStackFunction>, ) -> u16

Source

pub fn register_static_stack_function( &mut self, function: StaticHostStackFunction, ) -> u16

Source

pub fn register_args_function( &mut self, function: Box<dyn HostArgsFunction>, ) -> u16

Source

pub fn register_static_args_function( &mut self, function: StaticHostArgsFunction, ) -> u16

Source

pub fn register_static_non_yielding_args_function( &mut self, function: StaticHostArgsFunction, ) -> u16

Registers a static args-only host function that always returns one value synchronously.

Returning no value, Halt, Yield, or Pending violates the contract and is a host error.

Source

pub fn bind_function( &mut self, name: impl Into<String>, function: Box<dyn HostFunction>, )

Source

pub fn bind_static_function( &mut self, name: impl Into<String>, function: StaticHostFunction, )

Source

pub fn bind_stack_function( &mut self, name: impl Into<String>, function: Box<dyn HostStackFunction>, )

Source

pub fn bind_static_stack_function( &mut self, name: impl Into<String>, function: StaticHostStackFunction, )

Source

pub fn bind_args_function( &mut self, name: impl Into<String>, function: Box<dyn HostArgsFunction>, )

Source

pub fn bind_static_args_function( &mut self, name: impl Into<String>, function: StaticHostArgsFunction, )

Source

pub fn bind_static_non_yielding_args_function( &mut self, name: impl Into<String>, function: StaticHostArgsFunction, )

Binds a static args-only host function that always returns one value synchronously.

This is equivalent to Vm::bind_static_args_function except that the VM may keep native JIT traces active across the call boundary. Returning no value, Halt, Yield, or Pending violates the contract and is reported as a host error.

Source

pub fn bind_builtin_override( &mut self, name: impl Into<String>, function: Box<dyn HostFunction>, ) -> VmResult<()>

Source

pub fn bind_builtin_static_override( &mut self, name: impl Into<String>, function: StaticHostFunction, ) -> VmResult<()>

Source

pub fn set_async_bridge(&mut self, bridge: Box<dyn HostAsyncBridge>)

Source

pub fn clear_async_bridge(&mut self)

Source

pub fn set_runtime_print_sink<F>(&mut self, sink: F)
where F: FnMut(String) + Send + 'static,

Source

pub fn clear_runtime_print_sink(&mut self)

Source

pub fn allocate_host_op_id(&mut self) -> HostOpId

Source

pub fn waiting_host_op_id(&self) -> Option<HostOpId>

Source

pub fn complete_host_op( &mut self, op_id: HostOpId, values: impl Into<CallReturn>, ) -> VmResult<()>

Source

pub fn poll_waiting_host_op( &mut self, cx: &mut Context<'_>, ) -> Poll<VmResult<()>>

Source

pub async fn await_waiting_host_op(&mut self) -> VmResult<()>

Source

pub fn wait_for_host_op_blocking(&mut self) -> VmResult<()>

Source§

impl Vm

Source

pub fn set_jit_config(&mut self, config: JitConfig)

Source

pub fn jit_config(&self) -> &JitConfig

Source

pub fn jit_snapshot(&self) -> JitSnapshot

Source

pub fn dump_jit_info(&self) -> String

Source

pub fn dump_jit_info_with_machine_code( &self, include_machine_code: bool, ) -> String

Source

pub fn jit_native_trace_count(&self) -> usize

Source

pub fn jit_native_exec_count(&self) -> u64

Source§

impl Vm

Source

pub fn new(program: Program) -> Self

Source

pub fn new_with_jit_config(program: Program, jit_config: JitConfig) -> Self

Source

pub fn new_shared(program: Arc<Program>) -> Self

Source

pub fn new_shared_with_jit_config( program: Arc<Program>, jit_config: JitConfig, ) -> Self

Source

pub fn regex_cache_capacity(&self) -> usize

Returns the maximum number of compiled regular expressions retained by this VM.

New VMs default to 512 entries. A capacity of zero disables caching.

Source

pub fn set_regex_cache_capacity(&mut self, capacity: usize)

Changes this VM’s compiled regular-expression cache capacity.

Shrinking evicts least-recently-used entries immediately. Setting zero clears all entries and disables caching until a positive capacity is configured.

Source

pub fn regex_cache_entry_count(&self) -> usize

Source

pub fn regex_cache_compile_count(&self) -> u64

Source

pub fn regex_cache_hit_count(&self) -> u64

Source

pub fn set_jit_native_bridge_stats_enabled(&mut self, enabled: bool)

Source

pub fn jit_native_bridge_stats_enabled(&self) -> bool

Source

pub fn clear_jit_native_bridge_stats(&mut self)

Source

pub fn interpreter_metrics_snapshot(&self) -> InterpreterMetrics

Source

pub fn clear_interpreter_metrics(&mut self)

Source

pub fn jit_native_bridge_stats_snapshot(&self) -> Vec<(&'static str, u64)>

Source

pub fn reset_for_reuse(&mut self)

Reset VM execution state to allow rerunning the same program instance while preserving JIT artifacts and registered host bindings.

Locals are reset to Null, stack is cleared, and instruction pointer is rewound to the program entry.

Source

pub fn drop_contract_event_count(&self) -> u64

Source

pub fn set_drop_contract_events_enabled(&mut self, enabled: bool)

Source

pub fn drop_contract_events_enabled(&self) -> bool

Source

pub fn run(&mut self) -> VmResult<VmStatus>

Source

pub fn run_with_debugger( &mut self, debugger: &mut Debugger, ) -> VmResult<VmStatus>

Source§

impl Vm

Source

pub fn resume(&mut self) -> VmResult<VmStatus>

Source

pub fn stack(&self) -> &[Value]

Source

pub fn locals(&self) -> &[Value]

Source

pub fn set_local(&mut self, index: u8, value: Value) -> VmResult<()>

Source

pub fn program(&self) -> &Program

Source

pub fn bound_function_count(&self) -> usize

Source

pub fn has_bound_function(&self, name: &str) -> bool

Source

pub fn ip(&self) -> usize

Source

pub fn debug_info(&self) -> Option<&DebugInfo>

Source

pub fn call_depth(&self) -> usize

Trait Implementations§

Source§

impl Drop for Vm

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Vm

§

impl !Sync for Vm

§

impl !UnwindSafe for Vm

§

impl Freeze for Vm

§

impl Send for Vm

§

impl Unpin for Vm

§

impl UnsafeUnpin 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.