Expand description
Instruction set, .bf (BFV0) wire format, assembler and verifier.
Pure data plane — no threads, no mailboxes. The scheduler and VM consume
Chunk values produced here.
| Piece | Purpose |
|---|---|
Opcode / Instruction | ISA (opcodes are append-only) |
Value / Message | Runtime / constant-pool tags (ABI versioned) |
ChunkBuilder | Host-side assembler with label back-patching |
encode / decode | .bf module bytes (MAGIC + ABI_VERSION) |
verify | Structural checks before a crate::Runtime starts |
Current ABI: see ABI_VERSION (FlowCap + Str / Bytes).
Modules§
- asm_
macros - Namespaced re-exports (
byteflow::asm_macros::emit_native1_from!, …) for callers who prefer an explicit path over crate-root#[macro_export]placement.
Structs§
- Chunk
- A compiled unit of Byteflow bytecode: code, constants and the function
table. One
Chunkcan back many concurrently-running processes — it is immutable after construction, so it is shared behind anArcrather than copied per Flow (seebyteflow-vm::Vm::chunk). - Chunk
Builder - Fluent assembler for
Chunks. - Function
Def - A callable entry point inside a
Chunk: either bytecode-defined or a slot reserved for a native (Rust) function registered with the runtime via the FFI table (design notes §30-31). - Instruction
- A single packed instruction word.
- Label
- An unresolved jump target, patched to a relative offset once its address
is known (see
ChunkBuilder::bind_label). - Message
- Fixed-size envelope carried in mailboxes and registers (Atomic Hop).
Enums§
- Format
Error - Why a
.bfbuffer failed to decode. - Opcode
- A single Byteflow opcode.
- Value
- A dynamically-tagged runtime value.
- Verify
Error - Why a
Chunkfailed verification.
Constants§
- ABI_
VERSION - Current ABI version. Bump on any breaking change to instruction encoding, constant representation, or function-table layout.
- MAGIC
- On-disk magic for the
.bfmodule format (see design notes §32). Chosen so a corrupted/truncated file is rejected in the first 4 bytes rather than partway through decoding.
Functions§
- decode
- Decode a BFV0 module. Rejects unknown opcodes at decode time so a foreign file can never become a jump-table index.
- disassemble
- Human-readable listing of a
Chunk, used bybyteflow-cli disasm. - encode
- Encode
chunkas a BFV0 module (little-endian). Pure data — no I/O. - verify
- Verify structural invariants of
chunk. SeeVerifyErrorfor what is checked. This does not perform full dataflow/register-liveness verification (unlike, say, the JVM verifier) — v0 trades that off against implementation complexity, and instead the VM bounds-checks register indices at runtime (cheap: it’s an array index against a fixed small register file, not worth statically proving away yet).