Skip to main content

ExecutionState

Struct ExecutionState 

Source
pub struct ExecutionState<S = NoCustomState> { /* private fields */ }
Expand description

Frames, locals, operands, and private execution state for one invocation.

The module is supplied by reference at entry and is never stored here.

Implementations§

Source§

impl<S> ExecutionState<S>

Source

pub fn run_state(&self) -> &RunState<S>

Inspect the running state without changing it.

Source

pub fn stack(&self) -> &[Word] ⓘ

Materialized locals and operands, or results after the outermost return.

Source

pub fn frames(&self) -> &[Frame]

Active call frames, from main to the current function.

Source

pub fn is_halted(&self) -> bool

True before entry, after Halt, or after the outermost return.

Source

pub fn start<I, V, Ty, Info>( &mut self, module: &LocalModule<I, V, Ty, Info>, arguments: &[Word], ) -> Result<()>

Enter main using its module metadata and host-supplied arguments.

Entry creates the outermost frame, zeroes non-argument locals, selects the function’s first instruction, and sets the run state to runnable. A halted invocation can be replaced while reusing allocated storage.

§Errors

Rejects an active invocation, invalid metadata/target, a wrong argument count, or allocation failure, preserving the preceding logical state.

Source

pub fn pc(&self) -> u32

Current continuation, or the fault/terminal position after execution stops.

Source

pub fn resume_at(&mut self, pc: u32)

Select a continuation and make the invocation runnable.

Intended for custom runners resuming a suspended invocation. This does not create a frame or validate pc; the caller must retain the active invocation and choose a position in its original module. The next super::execute_instruction call checks the frame and fetch position.

Source

pub fn suspend(&mut self, state: S)

Suspend the invocation with component-specific state.

A component’s effect handler can use this to stop the shared runner. During dispatch, the runner restores the PC to the current instruction; save any desired continuation in state before suspending. A custom runner can later inspect Self::run_state and call Self::resume_at.

Source§

impl ExecutionState

Source

pub fn new() -> Self

Trait Implementations§

Source§

impl Apply<Break> for ExecutionState<DebuggerState>

Source§

fn apply(&mut self, _: Break)

Apply a single effect to this destination.
Source§

impl<S> Capabilities for ExecutionState<S>

Source§

const DESCRIPTION: &'static Description

Raw generated data. Internal reporting uses the validated capabilities.
Source§

impl<S: Clone> Clone for ExecutionState<S>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S> Component for ExecutionState<S>

Source§

impl<S: Debug> Debug for ExecutionState<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S> Default for ExecutionState<S>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<S> Execute<Branch> for ExecutionState<S>

Source§

type Message = BranchMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, _: &Branch, message: BranchMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<Call> for ExecutionState<S>

Source§

type Message = CallMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, _: &Call, message: CallMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<ConditionalBranch> for ExecutionState<S>

Source§

type Message = BranchMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute( &mut self, _: &ConditionalBranch, message: BranchMessage, ) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<ConstBool> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, instruction: &ConstBool, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<ConstF32> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, instruction: &ConstF32, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<ConstF64> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, instruction: &ConstF64, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<ConstFunctionRef> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute( &mut self, instruction: &ConstFunctionRef, _: NoMessage, ) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<ConstHeapRef> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, instruction: &ConstHeapRef, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<ConstI32> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, instruction: &ConstI32, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<ConstI64> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, instruction: &ConstI64, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<ConstString> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, instruction: &ConstString, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<ConstU32> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, instruction: &ConstU32, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<ConstU64> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, instruction: &ConstU64, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<Dup> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, _instruction: &Dup, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<Halt> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, _instruction: &Halt, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<IndirectCall> for ExecutionState<S>

Source§

type Message = CallMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, _: &IndirectCall, message: CallMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<LoadBool> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, instruction: &LoadBool, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<LoadF32> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, instruction: &LoadF32, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<LoadF64> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, instruction: &LoadF64, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<LoadI32> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, instruction: &LoadI32, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<LoadI64> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, instruction: &LoadI64, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<LoadU32> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, instruction: &LoadU32, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<LoadU64> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, instruction: &LoadU64, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<Return> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, instruction: &Return, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<StoreBool> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, instruction: &StoreBool, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<StoreF32> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, instruction: &StoreF32, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<StoreF64> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, instruction: &StoreF64, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<StoreI32> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, instruction: &StoreI32, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<StoreI64> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, instruction: &StoreI64, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<StoreU32> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, instruction: &StoreU32, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> Execute<StoreU64> for ExecutionState<S>

Source§

type Message = NoMessage

Input supplied by the runtime, rather than encoded in the instruction.
Source§

type Effect = ()

The successful result.
Source§

type Error = Report

The component’s execution error, usually eyre::Report.
Source§

fn execute(&mut self, instruction: &StoreU64, _: NoMessage) -> Result<()>

Execute a borrowed instruction without consuming its payload. Read more
Source§

impl<S> HasInventory for ExecutionState<S>

Source§

type Provider = Provider

Source§

impl<S> PopStack<f32> for ExecutionState<S>

Source§

fn pop(&mut self) -> Result<f32>

Consume exactly one logical operand as T. Read more
Source§

impl<S> PopStack<f64> for ExecutionState<S>

Source§

fn pop(&mut self) -> Result<f64>

Consume exactly one logical operand as T. Read more
Source§

impl<S> PopStack<u64> for ExecutionState<S>

Source§

fn pop(&mut self) -> Result<Word>

Consume exactly one logical operand as T. Read more
Source§

impl<S> PushStack<f32> for ExecutionState<S>

Source§

fn push(&mut self, value: f32)

Insert one value in this representation.
Source§

impl<S> PushStack<f64> for ExecutionState<S>

Source§

fn push(&mut self, value: f64)

Insert one value in this representation.
Source§

impl<S> PushStack<u64> for ExecutionState<S>

Source§

fn push(&mut self, value: Word)

Insert one value in this representation.
Source§

impl<S> Reset for ExecutionState<S>

Source§

fn reset(&mut self)

reset the component state into initial state

Auto Trait Implementations§

§

impl<S> Freeze for ExecutionState<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for ExecutionState<S>
where S: RefUnwindSafe,

§

impl<S> Send for ExecutionState<S>
where S: Send,

§

impl<S> Sync for ExecutionState<S>
where S: Sync,

§

impl<S> Unpin for ExecutionState<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for ExecutionState<S>
where S: UnsafeUnpin,

§

impl<S> UnwindSafe for ExecutionState<S>
where S: UnwindSafe,

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<D> Apply<PushToStack<()>> for D

Source§

fn apply(&mut self, _: PushToStack<()>)

Apply a single effect to this destination.
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.

§

impl<'src, T> IntoMaybe<'src, T> for T
where T: 'src,

§

type Proj<U: 'src> = U

§

fn map_maybe<R>( self, _f: impl FnOnce(&'src T) -> &'src R, g: impl FnOnce(T) -> R, ) -> <T as IntoMaybe<'src, T>>::Proj<R>
where R: 'src,

§

impl<T> OrderedSeq<'_, T> for T
where T: Clone,

§

impl<'p, T> Seq<'p, T> for T
where T: Clone,

§

type Item<'a> = &'a T where T: 'a

The item yielded by the iterator.
§

type Iter<'a> = Once<&'a T> where T: 'a

An iterator over the items within this container, by reference.
§

fn seq_iter(&self) -> <T as Seq<'p, T>>::Iter<'_>

Iterate over the elements of the container.
§

fn contains(&self, val: &T) -> bool
where T: PartialEq,

Check whether an item is contained within this sequence.
§

fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>
where 'p: 'b,

Convert an item of the sequence into a [MaybeRef].
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.