pub struct Vm { /* private fields */ }Implementations§
Source§impl Vm
impl Vm
pub fn encode_aot_artifact(&mut self) -> Result<Vec<u8>, AotArtifactError>
pub fn save_aot_artifact_to_file<P: AsRef<Path>>( &mut self, path: P, ) -> Result<(), AotArtifactError>
pub fn load_aot_artifact( &mut self, bytes: &[u8], ) -> Result<(), AotArtifactError>
pub fn load_aot_artifact_from_file<P: AsRef<Path>>( &mut self, path: P, ) -> Result<(), AotArtifactError>
pub fn new_from_aot_artifact_with_jit_config( bytes: &[u8], jit_config: JitConfig, ) -> Result<Self, AotArtifactError>
pub fn new_from_aot_artifact_file_with_jit_config<P: AsRef<Path>>( path: P, jit_config: JitConfig, ) -> Result<Self, AotArtifactError>
Source§impl Vm
impl Vm
pub fn compile_aot(&mut self) -> VmResult<()>
pub fn clear_aot(&mut self)
pub fn has_aot_program(&self) -> bool
pub fn aot_exec_count(&self) -> u64
pub fn aot_resume_ips(&self) -> Option<&[usize]>
pub fn dump_aot_info(&self) -> String
Source§impl Vm
impl Vm
pub fn consume_epoch_tick(&mut self) -> VmResult<()>
pub fn epoch_handle(&self) -> EpochHandle
pub fn current_epoch(&self) -> u64
pub fn increment_epoch(&self) -> u64
pub fn increment_epoch_by(&self, delta: u64) -> u64
pub fn set_epoch_deadline(&mut self, ticks_beyond_current: u64) -> VmResult<()>
pub fn clear_epoch_deadline(&mut self)
pub fn epoch_deadline(&self) -> Option<u64>
pub fn epoch_deadline_delta(&self) -> Option<u64>
pub fn set_epoch_check_interval(&mut self, interval: u32) -> VmResult<()>
pub fn epoch_check_interval(&self) -> u32
pub fn epoch_checkpoint(&self) -> EpochCheckpoint
pub fn restore_epoch(&mut self, checkpoint: EpochCheckpoint)
pub fn last_yield_reason(&self) -> Option<VmYieldReason>
Source§impl Vm
impl Vm
pub fn set_fuel(&mut self, fuel: u64)
pub fn clear_fuel(&mut self)
pub fn set_fuel_check_interval(&mut self, interval: u32) -> VmResult<()>
pub fn fuel_check_interval(&self) -> u32
pub fn get_fuel(&self) -> Option<u64>
pub fn add_fuel(&mut self, fuel: u64) -> VmResult<()>
pub fn recharge_fuel(&mut self, fuel: u64) -> VmResult<()>
pub fn consume_fuel(&mut self, fuel: u64) -> VmResult<()>
pub fn consume_fuel_tick(&mut self) -> VmResult<()>
pub fn fuel_checkpoint(&self) -> FuelCheckpoint
pub fn checkpoint(&self) -> FuelCheckpoint
pub fn restore_fuel(&mut self, checkpoint: FuelCheckpoint)
pub fn restore_checkpoint(&mut self, checkpoint: FuelCheckpoint)
Source§impl Vm
impl Vm
pub fn register_function(&mut self, function: Box<dyn HostFunction>) -> u16
pub fn register_static_function(&mut self, function: StaticHostFunction) -> u16
pub fn register_stack_function( &mut self, function: Box<dyn HostStackFunction>, ) -> u16
pub fn register_static_stack_function( &mut self, function: StaticHostStackFunction, ) -> u16
pub fn register_args_function( &mut self, function: Box<dyn HostArgsFunction>, ) -> u16
pub fn register_static_args_function( &mut self, function: StaticHostArgsFunction, ) -> u16
Sourcepub fn register_static_non_yielding_args_function(
&mut self,
function: StaticHostArgsFunction,
) -> u16
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.
pub fn bind_function( &mut self, name: impl Into<String>, function: Box<dyn HostFunction>, )
pub fn bind_static_function( &mut self, name: impl Into<String>, function: StaticHostFunction, )
pub fn bind_stack_function( &mut self, name: impl Into<String>, function: Box<dyn HostStackFunction>, )
pub fn bind_static_stack_function( &mut self, name: impl Into<String>, function: StaticHostStackFunction, )
pub fn bind_args_function( &mut self, name: impl Into<String>, function: Box<dyn HostArgsFunction>, )
pub fn bind_static_args_function( &mut self, name: impl Into<String>, function: StaticHostArgsFunction, )
Sourcepub fn bind_static_non_yielding_args_function(
&mut self,
name: impl Into<String>,
function: StaticHostArgsFunction,
)
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.
pub fn bind_builtin_override( &mut self, name: impl Into<String>, function: Box<dyn HostFunction>, ) -> VmResult<()>
pub fn bind_builtin_static_override( &mut self, name: impl Into<String>, function: StaticHostFunction, ) -> VmResult<()>
pub fn set_async_bridge(&mut self, bridge: Box<dyn HostAsyncBridge>)
pub fn clear_async_bridge(&mut self)
pub fn set_runtime_print_sink<F>(&mut self, sink: F)
pub fn clear_runtime_print_sink(&mut self)
pub fn allocate_host_op_id(&mut self) -> HostOpId
pub fn waiting_host_op_id(&self) -> Option<HostOpId>
pub fn complete_host_op( &mut self, op_id: HostOpId, values: impl Into<CallReturn>, ) -> VmResult<()>
pub fn poll_waiting_host_op( &mut self, cx: &mut Context<'_>, ) -> Poll<VmResult<()>>
pub async fn await_waiting_host_op(&mut self) -> VmResult<()>
pub fn wait_for_host_op_blocking(&mut self) -> VmResult<()>
Source§impl Vm
impl Vm
pub fn set_jit_config(&mut self, config: JitConfig)
pub fn jit_config(&self) -> &JitConfig
pub fn jit_snapshot(&self) -> JitSnapshot
pub fn dump_jit_info(&self) -> String
pub fn dump_jit_info_with_machine_code( &self, include_machine_code: bool, ) -> String
pub fn jit_native_trace_count(&self) -> usize
pub fn jit_native_exec_count(&self) -> u64
pub fn jit_native_link_handoff_count(&self) -> u64
Source§impl Vm
impl Vm
pub fn new(program: Program) -> Self
pub fn new_with_jit_config(program: Program, jit_config: JitConfig) -> Self
Sourcepub fn regex_cache_capacity(&self) -> usize
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.
Sourcepub fn set_regex_cache_capacity(&mut self, capacity: usize)
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.
pub fn regex_cache_entry_count(&self) -> usize
pub fn regex_cache_compile_count(&self) -> u64
pub fn regex_cache_hit_count(&self) -> u64
pub fn set_jit_native_bridge_stats_enabled(&mut self, enabled: bool)
pub fn jit_native_bridge_stats_enabled(&self) -> bool
pub fn clear_jit_native_bridge_stats(&mut self)
pub fn interpreter_metrics_snapshot(&self) -> InterpreterMetrics
pub fn clear_interpreter_metrics(&mut self)
pub fn jit_native_bridge_stats_snapshot(&self) -> Vec<(&'static str, u64)>
Sourcepub fn reset_for_reuse(&mut self)
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.