pub struct Machine<'a, H: Host> { /* private fields */ }Expand description
The production bytecode interpreter.
Implementations§
Source§impl<'a, H: Host> Machine<'a, H>
impl<'a, H: Host> Machine<'a, H>
pub fn ordinary_number_to_string(number: f64) -> String
pub fn same_value_zero(&self, left: Value, right: Value) -> bool
Source§impl<'a, H: Host> Machine<'a, H>
impl<'a, H: Host> Machine<'a, H>
pub fn new( program: &'a Program<Verified>, host: &'a mut H, limits: Limits, ) -> Self
pub fn run(self) -> Result<Execution, RuntimeError>
Sourcepub fn evaluate(&mut self) -> Result<Execution, RuntimeError>
pub fn evaluate(&mut self) -> Result<Execution, RuntimeError>
Evaluates the program without draining queued microtasks.
The machine remains available for an explicit Self::drain_microtasks
checkpoint.
Sourcepub fn run_one_expired_timer(&mut self) -> Result<TimerRun, RuntimeError>
pub fn run_one_expired_timer(&mut self) -> Result<TimerRun, RuntimeError>
Runs at most one expired live timer callback.
This explicit checkpoint never drains microtasks. Expiry reports only
advance a monotonic watermark; visible delivery is ordered by the
machine-owned (deadline, sequence) key.
Sourcepub fn wait_for_timer_expiry(&mut self) -> Result<bool, RuntimeError>
pub fn wait_for_timer_expiry(&mut self) -> Result<bool, RuntimeError>
Blocks in the host provider until an expiry report is available. Returns whether at least one live timer became ready.
Sourcepub fn has_pending_timers(&self) -> bool
pub fn has_pending_timers(&self) -> bool
Returns whether any machine-owned live timer remains.
Sourcepub fn run_to_quiescence(&mut self) -> Result<(), RuntimeError>
pub fn run_to_quiescence(&mut self) -> Result<(), RuntimeError>
Runs queued microtasks and expired timers until both are idle.
Sourcepub fn drain_microtasks(&mut self) -> Result<MicrotaskDrain, RuntimeError>
pub fn drain_microtasks(&mut self) -> Result<MicrotaskDrain, RuntimeError>
Runs queued microtasks in FIFO order until the queue is empty.
Jobs queued by another job run in the same checkpoint. Promise callback
throws settle their derived promises. Throws from queueMicrotask
callbacks are returned in MicrotaskDrain::uncaught.