#[repr(u8)]pub enum Op {
Show 55 variants
PushNull = 0,
PushBool = 1,
PushInt = 2,
PushUInt = 3,
PushFloat = 4,
PushString = 5,
PushIri = 6,
LoadVar = 7,
StoreVar = 8,
Pop = 9,
Dup = 10,
PushQuantity = 11,
Add = 16,
Sub = 17,
Mul = 18,
Div = 19,
Rem = 20,
Neg = 21,
Not = 22,
Eq = 23,
Ne = 24,
Lt = 25,
Le = 26,
Gt = 27,
Ge = 28,
And = 29,
Or = 30,
Jump = 32,
JumpIfFalse = 33,
JumpIfTrue = 34,
CallHost = 48,
CallUser = 49,
Return = 50,
ReturnNull = 51,
CallHostNamed = 52,
MakeList = 64,
MakeRecord = 65,
GetMember = 66,
GetIndex = 67,
TryUnwrap = 68,
Effect = 69,
IsOk = 70,
UnwrapOk = 71,
IsErr = 72,
UnwrapErr = 73,
IsVariant = 74,
GetVariantField = 75,
IsRecord = 76,
HasMember = 77,
IsListLen = 78,
TrapMatch = 79,
MakeVariant = 80,
MakeOk = 81,
MakeErr = 82,
Halt = 255,
}Expand description
A single bytecode opcode.
Variants§
PushNull = 0
Push null onto the stack.
PushBool = 1
Push a boolean. Operand: 1 byte (0 = false, 1 = true).
PushInt = 2
Push an i64. Operand: 8 bytes little-endian.
PushUInt = 3
Push a u64. Operand: 8 bytes little-endian.
PushFloat = 4
Push an f64. Operand: 8 bytes (f64 bits, little-endian).
PushString = 5
Push a string from the constant pool. Operand: u16 const index.
PushIri = 6
Push an IRI from the constant pool. Operand: u16 const index.
LoadVar = 7
Load a local variable. Operand: u16 slot index.
StoreVar = 8
Store top of stack to a local variable. Operand: u16 slot index.
Pop = 9
Pop and discard the top of stack.
Dup = 10
Duplicate the top of stack.
PushQuantity = 11
Push a quantity: f64 bits (8) then u16 constant-pool unit string.
Add = 16
Sub = 17
Mul = 18
Div = 19
Rem = 20
Neg = 21
Not = 22
Eq = 23
Ne = 24
Lt = 25
Le = 26
Gt = 27
Ge = 28
And = 29
Or = 30
Jump = 32
Unconditional jump. Operand: u16 code offset.
JumpIfFalse = 33
Jump if top of stack is falsy. Operand: u16 code offset. Pops the condition.
JumpIfTrue = 34
Jump if top of stack is truthy. Operand: u16 code offset. Pops the condition.
CallHost = 48
Call a host capability. Operands: u16 path const index, u8 arg count.
CallUser = 49
Call a user-defined function. Operands: u16 function index, u8 arg count.
Return = 50
Return from the current function. Pops the return value.
ReturnNull = 51
Return null (void) from the current function.
CallHostNamed = 52
Call a host capability with explicit positional and named args. Operands: u16 path const index, u8 positional count, u8 named pair count.
MakeList = 64
Create a list from N stack elements. Operand: u16 count.
MakeRecord = 65
Create a record from N key-value pairs. Operand: u16 pair count. Keys are string constants (u16 const index pushed before each value).
GetMember = 66
Get a named member from a record. Operand: u16 name const index.
GetIndex = 67
Get an indexed element from a list. Pops index then list.
TryUnwrap = 68
Unwrap a Try (Ok → value, Err → catch or diagnostic). Operand: u16 catch offset.
Effect = 69
Execute an effect expression (pop and discard, for side effects).
IsOk = 70
Pop top of stack, push Bool indicating whether it is Value::Ok(_).
UnwrapOk = 71
Pop Value::Ok(inner) and push *inner.
IsErr = 72
Pop top of stack, push Bool indicating whether it is Value::Err(_).
UnwrapErr = 73
Pop Value::Err(inner) and push *inner.
IsVariant = 74
Pop top of stack, push Bool matching enum/variant/arity. Operands: u16 enum name const, u16 variant name const, u8 field count.
GetVariantField = 75
Pop Value::Enum(e) and push e.payload[idx]. Operand: u8 field index.
IsRecord = 76
Pop top of stack, push Bool indicating Value::Record(_).
HasMember = 77
Pop Value::Record(r) and push Bool indicating r.contains_key(name). Operand: u16 key const.
IsListLen = 78
Pop top of stack, push Bool indicating Value::List(xs) of length len. Operand: u16 len.
TrapMatch = 79
Fail execution with a destructuring pattern mismatch diagnostic.
MakeVariant = 80
Construct a Value::Enum from N stack payload args.
Operands: u16 enum name const, u16 variant name const, u8 arg count.
MakeOk = 81
Pop value, push Value::Ok(Box::new(v)).
MakeErr = 82
Pop value, push Value::Err(Box::new(v)).
Halt = 255
Halt execution (end of code segment).
Implementations§
Trait Implementations§
impl Copy for Op
impl Eq for Op
impl StructuralPartialEq for Op
Auto Trait Implementations§
impl Freeze for Op
impl RefUnwindSafe for Op
impl Send for Op
impl Sync for Op
impl Unpin for Op
impl UnsafeUnpin for Op
impl UnwindSafe for Op
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.