Comparison Opcodes
This section documents the comparison instructions available in CandleVM.
For operand encodings, see the executable format reference.
Comparisons
| Opcode byte | Opcode | Operand bytes | Behavior |
|---|---|---|---|
| 25 | Eq | destination: register, left: register, right: register | Stores Value equality. Null, Bool, and Char values compare within their type. Byte and Number values compare numerically, including mixed pairs. ObjectRef values compare heap IDs, not object contents. ModuleRef and FunctionRef values always compare false. |
| 26 | Ne | destination: register, left: register, right: register | Logical inverse of Eq. |
| 27 | ObjectEq | destination: register, left: register, right: register | Requires two valid ObjectRef values and compares the referenced heap objects by their object equality. Array, Map, String, Error and Buffer objects use their type-specific equality; nested ObjectRef values inside arrays/maps compare by heap ID through Value equality. Native objects use the equality behavior provided by the host runtime. |
| 28 | ObjectNe | destination: register, left: register, right: register | Logical inverse of ObjectEq. |
| 29 | Lt | destination: register, left: register, right: register | Stores Value partial less-than. Ordering is defined for numeric pairs (Byte and/or Number), two Bool values, or two Null values; unsupported pairs yield false. |
| 30 | Lte | destination: register, left: register, right: register | Stores partial less-than-or-equal. Incomparable pairs yield false. |
| 31 | Gt | destination: register, left: register, right: register | Stores partial greater-than. Incomparable pairs yield false. |
| 32 | Gte | destination: register, left: register, right: register | Stores partial greater-than-or-equal. Incomparable pairs yield false. |