Skip to main contentModule opcode
Source - ADD
- Pop b, pop a, push a + b.
- CALL_BUILTIN
- Call a builtin service function.
- CALL_KNOWN
- Call a known function by id. Args already on stack.
- CALL_VALUE
- Call a function value on the stack (under args).
- CONCAT
- Pop b, pop a, push str(a) ++ str(b).
- DIV
- Pop b, pop a, push a / b.
- DUP
- Duplicate the top value.
- EQ
- Pop b, pop a, push a == b.
- EXTRACT_FIELD
- Peek top (record/variant), push
fields[field_idx] (non-destructive). - EXTRACT_TUPLE_ITEM
- Peek top tuple, push
items[item_idx] (non-destructive). - GT
- Pop b, pop a, push a > b.
- JUMP
- Unconditional relative jump: ip += offset.
- JUMP_IF_FALSE
- Pop top, if falsy: ip += offset.
- LIST_APPEND
- Pop value, pop list, push appended list.
- LIST_CONS
- Pop tail, pop head, push Cons(head, tail).
- LIST_GET
- Pop index, pop list, push Option.Some(value) or Option.None.
- LIST_GET_MATCH
- Pop index, pop list. If found, push value then true; otherwise push false.
- LIST_HEAD_TAIL
- Pop cons cell, push tail then push head.
- LIST_LEN
- Pop list, push its length as Int.
- LIST_NEW
- Pop
count items, build cons list from them (first item = head), push list. - LIST_NIL
- Push Nil (empty cons list).
- LIST_PREPEND
- Pop list, pop value, push prepended list.
- LOAD_CONST
- Push
constants[idx] onto the operand stack. - LOAD_FALSE
- Push
NanValue::FALSE. - LOAD_GLOBAL
- Push
globals[idx] onto the operand stack. - LOAD_LOCAL
- Push
stack[bp + slot] onto the operand stack. - LOAD_TRUE
- Push
NanValue::TRUE. - LOAD_UNIT
- Push
NanValue::UNIT. - LT
- Pop b, pop a, push a < b.
- MATCH_CONS
- Peek top: if Nil (not a cons), ip += fail_offset.
- MATCH_FAIL
- Non-exhaustive match error at source line.
- MATCH_NIL
- Peek top: if not Nil, ip += fail_offset.
- MATCH_TAG
- Peek top: if NaN tag != expected, ip += fail_offset.
- MATCH_TUPLE
- Peek top: if not a tuple of
count items, ip += fail_offset. - MATCH_UNWRAP
- Peek top: if not wrapper of
kind, ip += fail_offset.
If matches, replace top with inner value (unwrap in-place).
kind: 0=Ok, 1=Err, 2=Some. - MATCH_VARIANT
- Peek top (must be variant): if variant_id != expected, ip += fail_offset.
- MOD
- Pop b, pop a, push a % b.
- MUL
- Pop b, pop a, push a * b.
- NEG
- Pop a, push -a.
- NOT
- Pop a, push !a (boolean not).
- POP
- Discard the top value.
- PROPAGATE_ERR
- Propagate
Result.Err to caller or unwrap Result.Ok in place. - RECORD_GET
- Pop record, push
fields[field_idx] (compile-time resolved index). - RECORD_GET_NAMED
- Pop record, lookup field by name (constants[name_idx] is string), push value.
- RECORD_NEW
- Pop
count field values, push a new record with type_id. - RECORD_UPDATE
- Update selected fields on a record, preserving the rest from the base value.
Stack: […, base_record, update_0, …, update_n-1] -> […, updated_record]
- RETURN
- Return top of stack to caller.
- STORE_GLOBAL
- Pop top and store into
globals[idx]. - STORE_LOCAL
- Pop top and store into
stack[bp + slot]. - SUB
- Pop b, pop a, push a - b.
- TAIL_CALL_KNOWN
- Mutual tail-call to a known function: reuse frame, switch target.
- TAIL_CALL_SELF
- Self tail-call: reuse current frame with new args.
- TUPLE_NEW
- Pop
count items, build a tuple from them, push tuple. - VARIANT_NEW
- Pop
count field values, push a new variant. - WRAP
- Pop value, push wrapped value. kind: 0=Ok, 1=Err, 2=Some.
- opcode_name
- Opcode name for debug/disassembly.