Skip to main content

byteflow/bytecode/
mod.rs

1//! Instruction set, `.bf` (BFV0) wire format, assembler and verifier.
2//!
3//! Pure data plane — no threads, no mailboxes. The scheduler and VM consume
4//! [`Chunk`] values produced here.
5//!
6//! | Piece | Purpose |
7//! |-------|---------|
8//! | [`Opcode`] / [`Instruction`] | ISA (opcodes are **append-only**) |
9//! | [`Value`] / [`Message`] | Runtime / constant-pool tags (ABI versioned) |
10//! | [`Program`] / [`Fn`] | Host-side assembler with named registers |
11//! | [`encode`] / [`decode`] | `.bf` module bytes (`MAGIC` + [`ABI_VERSION`]) |
12//! | [`verify`] | Structural checks before a [`crate::Runtime`] starts |
13//!
14//! Current ABI: see [`ABI_VERSION`]. Lists use [`ABI_VERSION_LISTS`].
15
16pub(crate) mod builder;
17mod cap;
18mod chunk;
19mod disasm;
20mod format;
21mod instruction;
22mod opcode;
23mod pattern;
24mod program;
25mod restart;
26mod value;
27mod verify;
28
29pub use cap::{
30    Cap, CapId, CapIdError, CapRights, CapTarget, NativeIdx, NativeMask, RevocationCell,
31};
32pub use chunk::{Chunk, FunctionDef, ABI_VERSION, ABI_VERSION_LISTS, MAGIC};
33pub use disasm::disassemble;
34pub(crate) use format::MAX_VALUE_DEPTH;
35pub use format::{decode, decode_with, encode, FormatError};
36pub use instruction::Instruction;
37pub use opcode::Opcode;
38pub use pattern::payload_matches;
39pub use program::{Fn, FuncId, Label, Program, Reg, RegWindow};
40pub use restart::RestartPolicy;
41pub use value::{Message, Value, MAX_LIST_LEN, TAG_SYS_DOWN, TAG_SYS_EXIT};
42pub use verify::{verify, verify_with, ConstantKind, TrustLevel, VerifyConfig, VerifyError};