pub enum VmResult {
Show 27 variants
Complete(Value),
Yield,
Sleep(Duration),
Spawn {
function: u32,
args: Vec<Value>,
dest_reg: u8,
requested_rights: CapRights,
},
SelfPid {
dest_reg: u8,
},
Send {
target_cap: CapId,
message: Value,
},
Receive {
dest_reg: u8,
timeout: Option<Duration>,
match_tag: Option<u16>,
match_request_id: Option<u64>,
match_payload_kind: Option<u8>,
match_payload_eq: Option<i64>,
match_payload_value: Option<Arc<Value>>,
match_payload_cmp: Option<(IntCmp, i64)>,
},
TableOpen {
dest_reg: u8,
name: Arc<str>,
},
TableGet {
dest_reg: u8,
cap: CapId,
key: Value,
},
TablePut {
cap: CapId,
key: Value,
value: Value,
},
SendRemote {
node: u64,
name: Arc<str>,
message: Value,
},
StartSupervisor {
strategy: u8,
},
Ask {
dest_reg: u8,
target_cap: CapId,
request: Value,
timeout: Option<Duration>,
},
Monitor {
dest_reg: u8,
target_cap: CapId,
},
Demonitor {
monitor_reg: u8,
},
Link {
dest_reg: u8,
target_cap: CapId,
},
Unlink {
link_reg: u8,
},
SetTrapExit {
enabled: bool,
},
SetRestartPolicy {
policy: u8,
},
HostAwait {
dest_reg: u8,
op: u32,
args: Value,
},
RegisterName {
name: Arc<str>,
},
Whereis {
dest_reg: u8,
name: Arc<str>,
},
IsAlive {
dest_reg: u8,
target_cap: CapId,
},
ExitSignal {
target_cap: CapId,
reason: u64,
},
StartChild {
dest_reg: u8,
function: u32,
policy: u8,
},
Delegate {
dest_reg: u8,
src_cap: CapId,
want_rights: CapRights,
want_native_cap: Option<CapId>,
},
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
(CapRights::ADDRESSING).
SelfPid
SelfPid — write a self Cap
(CapRights::ADDRESSING) into dest_reg.
Send
Send — Atomic Hop to a capability target (requires SEND).
Receive
Receive / ReceiveTimeout / ReceiveMatch* (including *Timeout).
Fields
match_payload_kind: Option<u8>When set, wait for a hop whose payload.wire_tag() equals this
BFV0 tag (0..=10). Independent of Self::Receive::match_tag.
match_payload_eq: Option<i64>When set together with Self::Receive::match_tag, the hop’s
payload must be that Int (term equality, not a full pattern).
match_payload_value: Option<Arc<Value>>When set together with Self::Receive::match_tag, the hop’s
payload must equal this value (ReceiveMatchValue).
match_payload_cmp: Option<(IntCmp, i64)>When set together with Self::Receive::match_tag, the payload
must be an Int that passes this comparison. Other hops stay queued.
TableOpen
TableOpen — this flow creates its one table and receives a Cap.
TableGet
TableGet — read one row. Missing key writes Unit.
TablePut
TablePut — write one row. Requires SEND on the table Cap.
SendRemote
SendRemote — authenticated hop for the host distribution bridge.
StartSupervisor
StartSupervisor — this flow starts its own supervisor.
strategy is 0 one-for-one, 1 one-for-all, 2 rest-for-one.
Ask
Ask / AskTimeout — RPC hop to a capability target (requires ASK).
Monitor
Monitor ra, rb — watch the flow addressed by Cap r[b].
Demonitor
Demonitor ra — drop monitor whose ref is r[a] (Int).
Link
Link ra, rb — bidirectional link with Cap r[b].
Unlink
Unlink ra — drop link whose id is r[a] (Int).
SetTrapExit
SetTrapExit ra — enable/disable link exit trapping from truthy r[a]
(including converting Normal linked exits into hops).
SetRestartPolicy
SetRestartPolicy imm — update this flow’s restart policy (0..=2).
HostAwait
HostAwait — register a host operation. The worker writes the ticket
id into dest_reg and keeps the flow running.
RegisterName
RegisterName ra — publish r[a] (Str) as this flow’s name.
Whereis
Whereis ra, rb — resolve r[b] (Str) to a SEND Cap or Unit.
IsAlive
IsAlive ra, rb — write Bool into r[a] for Cap target_cap.
ExitSignal
ExitSignal — BEAM exit/2. reason is a crate::FlowExitReason code.
StartChild
StartChild — spawn function under this flow’s supervisor.
Delegate
Delegate ra, rb — attenuate Cap r[b] into r[a].
Trap(Fault)
A fault occurred; the Flow fails. See Fault.