Skip to content

Map Manipulation Opcodes ​

This section documents the maps instructions available in CandleVM.

For operand encodings, see the executable format reference.

Maps ​

All map instructions require an ObjectRef value to a Map. Map keys and values can be of all types.

Opcode byteOpcodeOperand bytesBehavior
44NewMapdestination: registerAllocates an empty map and stores its ObjectRef value.
45MapLendestination: register, map: registerStores the number of key/value pairs as a numeric value (Byte for lengths 0–255, otherwise Number).
46MapContainsdestination: register, map: register, key: registerStores whether the map contains the key. For ObjectRef values this is reference-ID equality.
47MapGetdestination: register, map: register, key: registerLoads the mapped value; a missing key raises MapKeyNotFound.
48MapSetmap: register, key: register, value: registerInserts or replaces the key's value.
49MapRemovemap: register, key: registerRemoves the key and discards its value; a missing key raises MapKeyNotFound.

Built for the Candle ecosystem · Powered by VitePress.