pub enum Instruction {
Show 42 variants
Span(u32, u32, u32),
Label,
FunctionStart,
FunctionEnd,
Breakpoint,
Branch(u32),
ConditionalBranch(u32, u32),
Return(u32),
IndirectCall,
Call(u32, u32),
Halt,
Print,
Load(Type, u32),
Store(Type, u32),
Dup,
HeapAlloc(u32),
GetItem,
HeapDealloc,
Const(Value),
Add(Type),
Sub(Type),
Mul(Type),
Div(Type),
Rem(Type),
Neg(Type),
Shl(Type),
Shr(Type),
Rol(Type),
Ror(Type),
BitAnd(Type),
BitOr(Type),
BitXor(Type),
Not,
And,
Or,
Xor,
Eq(Type),
Ne(Type),
Lt(Type),
Gt(Type),
Le(Type),
Ge(Type),
}Expand description
#[derive(Parse)] notes:
- Real
.sstsyntax uses dot-suffixed types (add.i64,load.i64 0). Theparse_helpers::cpu_type/cpu_const_valuehelpers consume the leading.; that’s why the typed variants setdelimiters(open = "", close = "", separator = "")and use#[parse_with]on theTypefield. Const(Value::String/FunctionRef/HeapRef),Branch(_),ConditionalBranch(_, _),Call(_, _), and bareretuse symbolic operands that need a shared interner / symbol table not available to a statelessParseimpl. Theirparse_withhelpers returnnever_u32soInstruction::parser()errors on those mnemonics — the Module orchestrator (Item 4 of the migration plan) intercepts them first.- Variant order is preserved from the pre-migration layout so derived
opcodes stay stable. The single exception:
IndirectCallis moved ahead ofCallso the prefix-ordering check (call⊂call_indirect) passes.
Variants§
Span(u32, u32, u32)
span file:file_id start:u32 end:u32
span 0 1 2 — three space-separated u32s.
Label
Label definition.
FunctionStart
func_start <name> — marks function entry. <name> is symbolic and
orchestrator-resolved; the unit variant carries no payload.
FunctionEnd
func_end <name> — marks function exit (debug only).
Breakpoint
breakpoint. Must precede Branch (whose token br would be a
prefix of breakpoint).
Branch(u32)
br <target> — symbolic. Deferred to orchestrator.
ConditionalBranch(u32, u32)
cond_br <true_target>, <false_target> — symbolic. Deferred.
Return(u32)
ret (bare) is the form real .sst uses; numeric ret <n> has no
precedent so we defer. Orchestrator emits Return(0) for bare ret.
IndirectCall
call_indirect. Must precede Call for the prefix check.
Call(u32, u32)
call <arity>, <addr> — symbolic addr. Deferred.
Halt
halt — stop execution.
print — write top-of-stack to stdout.
Load(Type, u32)
load.<type> <address> — two fields with single-space separator.
Store(Type, u32)
store.<type> <address>.
Dup
dup.
HeapAlloc(u32)
heap_alloc <n>.
GetItem
get_item. Must precede Ge (token ge ⊂ get_item).
HeapDealloc
heap_dealloc — pops a HeapRef and marks the slot dead, returning it
to the free list for reuse by the next heap_alloc.
Const(Value)
const.<type> <literal> — numeric/bool only here. .str/.fn_ref/
.heap_ref are orchestrator-handled.
Add(Type)
Sub(Type)
Mul(Type)
Div(Type)
Rem(Type)
Neg(Type)
Shl(Type)
Shr(Type)
Rol(Type)
Ror(Type)
BitAnd(Type)
BitOr(Type)
BitXor(Type)
Not
And
Or
Xor
Eq(Type)
Ne(Type)
Lt(Type)
Gt(Type)
Le(Type)
Ge(Type)
Trait Implementations§
Source§impl CanonicalInstructionSyntax for Instruction
impl CanonicalInstructionSyntax for Instruction
Source§impl Clone for Instruction
impl Clone for Instruction
Source§fn clone(&self) -> Instruction
fn clone(&self) -> Instruction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Instruction
impl Debug for Instruction
Source§impl Display for Instruction
impl Display for Instruction
Source§impl<T: Into<Value>> From<T> for Instruction
impl<T: Into<Value>> From<T> for Instruction
Source§impl FromBytesWithOpcode for Instruction
impl FromBytesWithOpcode for Instruction
Source§impl<'src> Parse<'src> for Instruction
impl<'src> Parse<'src> for Instruction
Source§impl PartialEq for Instruction
impl PartialEq for Instruction
Source§impl WriteBytes for Instruction
impl WriteBytes for Instruction
impl StructuralPartialEq for Instruction
Auto Trait Implementations§
impl Freeze for Instruction
impl RefUnwindSafe for Instruction
impl Send for Instruction
impl Sync for Instruction
impl Unpin for Instruction
impl UnsafeUnpin for Instruction
impl UnwindSafe for Instruction
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FromBytes for Twhere
T: FromBytesWithOpcode,
impl<T> FromBytes for Twhere
T: FromBytesWithOpcode,
§impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
§fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
MaybeRef].