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//! Maps use [`ABI_VERSION_MAPS`].
16
17pub(crate) mod builder;
18mod cap;
19mod chunk;
20mod disasm;
21mod format;
22mod instruction;
23mod opcode;
24mod pattern;
25mod program;
26mod restart;
27mod value;
28mod verify;
29
30pub use cap::{
31    Cap, CapId, CapIdError, CapRights, CapTarget, NativeIdx, NativeMask, RevocationCell,
32};
33pub use chunk::{Chunk, FunctionDef, ABI_VERSION, ABI_VERSION_LISTS, ABI_VERSION_MAPS, MAGIC};
34pub use disasm::disassemble;
35pub use format::{decode, decode_with, encode, FormatError};
36pub(crate) use format::{decode_value, encode_value, MAX_VALUE_DEPTH};
37pub use instruction::Instruction;
38pub use opcode::{IntCmp, Opcode};
39pub use pattern::payload_matches;
40pub use program::{Fn, FuncId, Label, Program, Reg, RegWindow};
41pub use restart::RestartPolicy;
42pub use value::{
43    MapKey, Message, Value, MAX_LIST_LEN, MAX_MAP_LEN, TAG_SYS_AWAIT, TAG_SYS_DOWN, TAG_SYS_EXIT,
44};
45pub use verify::{verify, verify_with, ConstantKind, TrustLevel, VerifyConfig, VerifyError};