pub struct VM {
pub arena: Arena,
/* private fields */
}Expand description
The Aver bytecode virtual machine.
Fields§
§arena: ArenaImplementations§
Source§impl VM
impl VM
pub fn new(code: CodeStore, globals: Vec<NanValue>, arena: Arena) -> Self
pub fn start_profiling(&mut self)
pub fn clear_profile(&mut self)
pub fn profile_report(&self) -> Option<VmProfileReport>
pub fn profile_top_bigrams(&self, n: usize) -> Vec<((u8, u8), u64)>
Sourcepub fn set_cli_args(&mut self, args: Vec<String>)
pub fn set_cli_args(&mut self, args: Vec<String>)
Set CLI arguments for Args.get().
pub fn set_silent_console(&mut self, silent: bool)
Sourcepub fn set_runtime_policy(&mut self, config: ProjectConfig)
pub fn set_runtime_policy(&mut self, config: ProjectConfig)
Set the runtime policy loaded from aver.toml.
Sourcepub fn start_recording(&mut self)
pub fn start_recording(&mut self)
Start recording effectful calls.
Sourcepub fn set_record_cap(&mut self, cap: Option<usize>)
pub fn set_record_cap(&mut self, cap: Option<usize>)
Cap the recorder at cap events. Useful for browser record
runs where a game with no quit path would otherwise hang the
wasm main thread. None (default) = unlimited, matching CLI.
Sourcepub fn start_replay(&mut self, effects: Vec<EffectRecord>, validate_args: bool)
pub fn start_replay(&mut self, effects: Vec<EffectRecord>, validate_args: bool)
Start replaying from recorded effects.
pub fn set_allowed_effects(&mut self, effects: Vec<u32>)
Sourcepub fn install_oracle_stubs(&mut self, stubs: HashMap<String, u32>)
pub fn install_oracle_stubs(&mut self, stubs: HashMap<String, u32>)
Oracle v1: install the oracle-stub map for a verify-law case.
Maps classified effect method names (e.g. "Random.int") to the
fn_id of an Aver stub function with signature
(BranchPath, Int, orig_args...) -> T. Counter resets to 0.
Sourcepub fn clear_oracle_stubs(&mut self)
pub fn clear_oracle_stubs(&mut self)
Clear the oracle-stub map and reset the counter. Always call this at the end of the verify-law case so the next case (or normal evaluation) doesn’t see stale substitutions.
Sourcepub fn find_fn_id(&self, name: &str) -> Option<u32>
pub fn find_fn_id(&self, name: &str) -> Option<u32>
Resolve an Aver top-level function name to its VM fn_id. Used by
the verify runner when wiring stubs from a given clause.
Sourcepub fn start_trace_collection(&mut self)
pub fn start_trace_collection(&mut self)
Oracle v1: start collecting classified-effect emissions into a
per-case trace buffer. Call before evaluating a verify-trace
case’s LHS; pair with take_trace_events after.
Sourcepub fn set_trace_root_fn_id(&mut self, fn_id: Option<u32>)
pub fn set_trace_root_fn_id(&mut self, fn_id: Option<u32>)
Oracle v1: set (or clear) the root fn_id used by the helper-
boundary filter — only emissions whose immediate caller fn_id
matches the root count towards .trace.* projections. Pass
None (or don’t call it) to disable filtering, so every
classified effect lands in the trace.
Sourcepub fn stop_trace_collection(&mut self)
pub fn stop_trace_collection(&mut self)
Oracle v1: stop collection without consuming the buffer.
Sourcepub fn take_trace_events(&mut self) -> Vec<Value>
pub fn take_trace_events(&mut self) -> Vec<Value>
Oracle v1: take the collected trace events, stopping collection
and clearing the buffer. The returned list is what
fn.trace.contains(...) / .event(k) / .length() operate on.
Sourcepub fn take_trace_events_with_coords(&mut self) -> (Vec<Value>, Vec<TraceCoord>)
pub fn take_trace_events_with_coords(&mut self) -> (Vec<Value>, Vec<TraceCoord>)
Oracle v1: take both events and structural coordinates
together. Used by tree-navigation projections like
.trace.group(N).event(k) — the coords identify which
!/?! group each event came from in source order.