Skip to main content

Module encode

Module encode 

Source
Expand description

Inst to sixteen bytes.

The encoder is total: ADR 0041’s audit covers all forty-nine variants, so there is no instruction it can refuse and no fallback to enum execution to design around. The one thing it can answer Err about is an operand that does not fit — a slot past 65,535, which the compiler’s own frame limit already refuses at the declaration, and a branch displacement that overflows, which no pair of u32 program counters can produce. Both are checked anyway, because “the encoder rejects overflow” should be a line of code rather than an argument.

It is deterministic: encoding is a pure function of the instruction and its program counter, every field an opcode does not use is written zero, and two encodings of one program are byte-identical.

Structs§

Encoded
A whole program’s instructions, encoded, one run per function.

Enums§

TooWide
An operand that does not fit the field ADR 0041 gives it.

Functions§

encode
Encodes one instruction.
encode_function
Encodes one function’s code.
encode_program
Encodes every function of a program.