Skip to content

Closure Manipulation Opcodes ​

This section documents the closures instructions available in CandleVM.

For operand encodings, see the executable format reference.

Closures ​

Opcode byteOpcodeOperand bytesBehavior
68NewClosuredestination: register, function: register, capture_count: u8, then capture_count capture-register bytesReads 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.

Built for the Candle ecosystem · Powered by VitePress.