byteflow/vm/mod.rs
1//! Register-based interpreter for **one** virtual flow.
2//!
3//! The VM never touches threads, mailboxes, timers or the Cap table. It runs
4//! until it finishes, hits an instruction budget, or needs a scheduler
5//! effect — then returns a [`VmResult`] and stops. That split is what lets
6//! the M:N scheduler move a suspended [`Vm`] between workers freely.
7//!
8//! | Type | Role |
9//! |------|------|
10//! | [`Vm`] | Per-flow machine state (frames, pc, natives handle) |
11//! | [`VmResult`] | Complete / Yield / Sleep / Spawn / Send / Receive / Ask / … |
12//! | [`Fault`] | Type errors, traps, native failures → flow failure |
13//! | [`NativeTable`] | Host FFI slots indexed by `CallNative` |
14
15mod fault;
16mod frame;
17mod machine;
18mod native;
19mod result;
20
21pub use fault::Fault;
22pub use machine::{Vm, MAX_CALL_DEPTH};
23pub use native::{
24 expect_arg, expect_bool, expect_int, expect_message, expect_u64, NativeFn, NativeResult,
25 NativeTable, NativeTableBuilder,
26};
27pub use result::VmResult;
28pub use crate::bytecode::Value;