pub struct Vm<'p> { /* private fields */ }Implementations§
Source§impl<'p> Vm<'p>
impl<'p> Vm<'p>
pub fn new(program: &'p CompiledProgram) -> Self
Sourcepub fn install_warm_bytecode(&mut self, fi: usize, fnbc: &FnBytecode) -> bool
pub fn install_warm_bytecode(&mut self, fi: usize, fnbc: &FnBytecode) -> bool
Install a re-optimized body as function fi’s warm tier (HOTSWAP §7 / P11):
append it to warm_code after program.code, rebasing its 0-relative jumps
into that unified pc space, and point warm_entry[fi] at it. Subsequent calls
to fi run this body. The body shares the program’s constant pool (a
FnBytecode preserves constant indices), so only jumps are relocated.
Sourcepub fn with_native_tier(self, tier: &'p dyn NativeTier) -> Self
pub fn with_native_tier(self, tier: &'p dyn NativeTier) -> Self
Install a native tier: hot functions in the integer subset run as JIT-compiled machine code, guarded per call (non-Int args deopt to the bytecode path).
Sourcepub fn install_aot_native(&mut self, fi: usize, nf: Box<dyn NativeFn>)
pub fn install_aot_native(&mut self, fi: usize, nf: Box<dyn NativeFn>)
Pre-install an AOT-native function for fi (HOTSWAP §Axis-3): the VM dispatches
to it via the existing NativeSlot::Ready path from the first call (it is not
Untried, so it skips the hotness threshold and the forge compile). Requires a
native tier to be installed (the dispatch is gated on self.tier); on desktop
the forge tier is always present alongside. Absent ⇒ the function stays on
VM+JIT — the AOT artifact is strictly optional, no gap at the seam.
Sourcepub fn with_bg_native_tier(self, tier: &'static dyn NativeTier) -> Self
pub fn with_bg_native_tier(self, tier: &'static dyn NativeTier) -> Self
Install the process tier AND a background compiler (HOTSWAP §6): hot functions
are compiled on a worker thread instead of stalling the interpreter. The tier
must be &'static (the process-installed forge backend) so it can cross to the
worker — &'static dyn NativeTier is Send because NativeTier: Sync. The
interpreter still runs the chains and is the sole FnTable writer; the worker
only compiles. Falls back to Vm::with_native_tier (synchronous) for a
borrowed &'p tier, which cannot be shared with a thread.
Sourcepub fn drain_pending_compiles(&mut self)
pub fn drain_pending_compiles(&mut self)
Block until every outstanding background compile has come back and been published — the determinism hook the differential tests use so the native tier engages predictably regardless of thread scheduling. No-op without a background compiler.
Sourcepub fn with_program_args(self, args: Vec<String>) -> Self
pub fn with_program_args(self, args: Vec<String>) -> Self
Supply the program arguments read by the args() system native. The
vector is the full argv (index 0 is the program name), matching the
compiled binary’s env::args().
Sourcepub fn with_policy_ctx(
self,
registry: &'p PolicyRegistry,
interner: &'p Interner,
) -> Self
pub fn with_policy_ctx( self, registry: &'p PolicyRegistry, interner: &'p Interner, ) -> Self
Provide the policy registry (and the interner its symbols live in) for
Check statements.
Sourcepub fn into_lines(self) -> Vec<String>
pub fn into_lines(self) -> Vec<String>
Consume the VM, returning its output lines.
Auto Trait Implementations§
impl<'p> Freeze for Vm<'p>
impl<'p> !RefUnwindSafe for Vm<'p>
impl<'p> !Send for Vm<'p>
impl<'p> !Sync for Vm<'p>
impl<'p> Unpin for Vm<'p>
impl<'p> UnsafeUnpin for Vm<'p>
impl<'p> !UnwindSafe for Vm<'p>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.