Skip to main content

Module bytecode

Module bytecode 

Source
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.

PiecePurpose
Opcode / InstructionISA (opcodes are append-only)
Value / MessageRuntime / constant-pool tags (ABI versioned)
ChunkBuilderHost-side assembler with label back-patching
encode / decode.bf module bytes (MAGIC + ABI_VERSION)
verifyStructural 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 Chunk can back many concurrently-running processes — it is immutable after construction, so it is shared behind an Arc rather than copied per Flow (see byteflow-vm::Vm::chunk).
ChunkBuilder
Fluent assembler for Chunks.
FunctionDef
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§

FormatError
Why a .bf buffer failed to decode.
Opcode
A single Byteflow opcode.
Value
A dynamically-tagged runtime value.
VerifyError
Why a Chunk failed 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 .bf module 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 by byteflow-cli disasm.
encode
Encode chunk as a BFV0 module (little-endian). Pure data — no I/O.
verify
Verify structural invariants of chunk. See VerifyError for 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).