Skip to main content

VM

Struct VM 

Source
pub struct VM {
    pub arena: Arena,
    /* private fields */
}
Expand description

The Aver bytecode virtual machine.

Fields§

§arena: Arena

Implementations§

Source§

impl VM

Source

pub fn new(code: CodeStore, globals: Vec<NanValue>, arena: Arena) -> Self

Source

pub fn start_profiling(&mut self)

Source

pub fn clear_profile(&mut self)

Source

pub fn profile_report(&self) -> Option<VmProfileReport>

Source

pub fn profile_top_bigrams(&self, n: usize) -> Vec<((u8, u8), u64)>

Source

pub fn set_cli_args(&mut self, args: Vec<String>)

Set CLI arguments for Args.get().

Source

pub fn set_silent_console(&mut self, silent: bool)

Source

pub fn set_runtime_policy(&mut self, config: ProjectConfig)

Set the runtime policy loaded from aver.toml.

Source

pub fn start_recording(&mut self)

Start recording effectful calls.

Source

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.

Source

pub fn start_replay(&mut self, effects: Vec<EffectRecord>, validate_args: bool)

Start replaying from recorded effects.

Source

pub fn set_allowed_effects(&mut self, effects: Vec<u32>)

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn stop_trace_collection(&mut self)

Oracle v1: stop collection without consuming the buffer.

Source

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.

Source

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.

Source

pub fn set_cancelled(&mut self, flag: Arc<AtomicBool>)

Source

pub fn recorded_effects(&self) -> &[EffectRecord]

Source

pub fn replay_progress(&self) -> (usize, usize)

Source

pub fn args_diff_count(&self) -> usize

Source

pub fn ensure_replay_consumed(&self) -> Result<(), VmError>

Source

pub fn run(&mut self) -> Result<NanValue, VmError>

Source

pub fn run_top_level(&mut self) -> Result<(), VmError>

Source

pub fn run_named_function( &mut self, name: &str, args: &[NanValue], ) -> Result<NanValue, VmError>

Source

pub fn call_function( &mut self, fn_id: u32, args: &[NanValue], ) -> Result<NanValue, VmError>

Auto Trait Implementations§

§

impl Freeze for VM

§

impl RefUnwindSafe for VM

§

impl Send for VM

§

impl Sync for VM

§

impl Unpin for VM

§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V