Buffer Manipulation Opcodes
This section documents the buffers instructions available in CandleVM.
For operand encodings, see the executable format reference.
Buffers
| Opcode byte | Opcode | Operand bytes | Behavior |
|---|---|---|---|
| 64 | NewBuffer | destination: register, size: register | Converts size from byte or non-negative finite integer number to usize, allocates a zero-filled Buffer of that size and stores its ObjectRef value. |
| 65 | BufferLen | destination: register, buffer: register | Stores the byte count as a numeric value (Byte for lengths 0–255, otherwise Number). |
| 66 | BufferGet | destination: register, buffer: register, index: register | Reads one byte at the index and stores it as a Byte; out of range raises BufferIndexOutOfBounds. |
| 67 | BufferSet | buffer: register, index: register, value: register | Writes a byte at the index. Value accepts a byte or an integral finite number in 0..255; out of range raises BufferIndexOutOfBounds. |