Skip to main content

VmResult

Enum VmResult 

Source
pub enum VmResult {
    Complete(Value),
    Yield,
    Sleep(Duration),
    Spawn {
        function: u32,
        args: Vec<Value>,
        dest_reg: u8,
    },
    SelfPid {
        dest_reg: u8,
    },
    Send {
        target_cap: u64,
        message: Value,
    },
    Receive {
        dest_reg: u8,
        timeout: Option<Duration>,
        match_tag: Option<u16>,
    },
    Ask {
        dest_reg: u8,
        target_cap: u64,
        request: Value,
    },
    Trap(Fault),
}
Expand description

What happened at the end of a crate::Vm::run slice.

This is the entire interface between byteflow-vm and the scheduler: the VM never touches threads, mailboxes or timers directly. It runs bytecode until it either finishes, needs an effect only the scheduler can perform, or exhausts its instruction budget — then hands one of these back and stops. That separation is what lets byteflow-scheduler move a suspended Vm between worker threads freely: it’s just a value sitting in a Flow.

Variants§

§

Complete(Value)

The outermost frame returned/exited. The Flow should terminate with this value delivered to FlowHandle::join.

§

Yield

Cooperative yield or instruction-budget exhaustion. Re-enqueue as Ready on any worker; resuming picks up at the saved pc with no register writeback needed.

§

Sleep(Duration)

Sleep opcode. Register the Flow on the timer wheel; resume with a plain run() call (no writeback) once it elapses.

§

Spawn

Spawn — create a child flow; parent receives a Cap (SEND|ASK).

Fields

§function: u32
§args: Vec<Value>
§dest_reg: u8
§

SelfPid

SelfPid — write a self Cap (SEND|ASK) into dest_reg.

Fields

§dest_reg: u8
§

Send

Send — Atomic Hop to a capability target (requires SEND).

Fields

§target_cap: u64
§message: Value
§

Receive

Receive / ReceiveTimeout / ReceiveMatch / ReceiveMatchImm.

Fields

§dest_reg: u8
§timeout: Option<Duration>
§match_tag: Option<u16>
§

Ask

Ask — RPC hop to a capability target (requires ASK).

Fields

§dest_reg: u8
§target_cap: u64
§request: Value
§

Trap(Fault)

A fault occurred; the Flow fails. See Fault.

Trait Implementations§

Source§

impl Debug for VmResult

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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.