Closure Manipulation Opcodes
This section documents the closures instructions available in CandleVM.
For operand encodings, see the executable format reference.
Closures
| Opcode byte | Opcode | Operand bytes | Behavior |
|---|---|---|---|
| 68 | NewClosure | destination: register, function: register, capture_count: u8, then capture_count capture-register bytes | Reads the listed capture registers, resolves the FunctionRef, and requires its declared capture count to match. The count is limited to 8. On success, allocates a Closure containing the target function reference and a copy of each captured value, then stores its ObjectRef. A mismatch raises InvalidInput. |