pub enum Instruction {
Show 197 variants BrLabel(u32), Unreachable, Nop, Block(BlockArgs, usize), Loop(BlockArgs, usize), If(BlockArgs, Option<usize>, usize), Else(usize), EndBlockFrame, EndFunc, Br(u32), BrIf(u32), BrTable(u32, usize), Return, Call(u32), CallIndirect(u32, u32), Drop, Select(Option<ValType>), LocalGet(u32), LocalSet(u32), LocalTee(u32), GlobalGet(u32), GlobalSet(u32), I32Load(MemoryArg), I64Load(MemoryArg), F32Load(MemoryArg), F64Load(MemoryArg), I32Load8S(MemoryArg), I32Load8U(MemoryArg), I32Load16S(MemoryArg), I32Load16U(MemoryArg), I64Load8S(MemoryArg), I64Load8U(MemoryArg), I64Load16S(MemoryArg), I64Load16U(MemoryArg), I64Load32S(MemoryArg), I64Load32U(MemoryArg), I32Store(MemoryArg), I64Store(MemoryArg), F32Store(MemoryArg), F64Store(MemoryArg), I32Store8(MemoryArg), I32Store16(MemoryArg), I64Store8(MemoryArg), I64Store16(MemoryArg), I64Store32(MemoryArg), MemorySize(u32, u8), MemoryGrow(u32, u8), I32Const(i32), I64Const(i64), F32Const(f32), F64Const(f64), RefNull(ValType), RefFunc(u32), RefIsNull, I32Eqz, I32Eq, I32Ne, I32LtS, I32LtU, I32GtS, I32GtU, I32LeS, I32LeU, I32GeS, I32GeU, I64Eqz, I64Eq, I64Ne, I64LtS, I64LtU, I64GtS, I64GtU, I64LeS, I64LeU, I64GeS, I64GeU, F32Eq, F32Ne, F32Lt, F32Gt, F32Le, F32Ge, F64Eq, F64Ne, F64Lt, F64Gt, F64Le, F64Ge, I32Clz, I32Ctz, I32Popcnt, I32Add, I32Sub, I32Mul, I32DivS, I32DivU, I32RemS, I32RemU, I32And, I32Or, I32Xor, I32Shl, I32ShrS, I32ShrU, I32Rotl, I32Rotr, I64Clz, I64Ctz, I64Popcnt, I64Add, I64Sub, I64Mul, I64DivS, I64DivU, I64RemS, I64RemU, I64And, I64Or, I64Xor, I64Shl, I64ShrS, I64ShrU, I64Rotl, I64Rotr, F32Abs, F32Neg, F32Ceil, F32Floor, F32Trunc, F32Nearest, F32Sqrt, F32Add, F32Sub, F32Mul, F32Div, F32Min, F32Max, F32Copysign, F64Abs, F64Neg, F64Ceil, F64Floor, F64Trunc, F64Nearest, F64Sqrt, F64Add, F64Sub, F64Mul, F64Div, F64Min, F64Max, F64Copysign, I32WrapI64, I32TruncF32S, I32TruncF32U, I32TruncF64S, I32TruncF64U, I32Extend8S, I32Extend16S, I64Extend8S, I64Extend16S, I64Extend32S, I64ExtendI32S, I64ExtendI32U, I64TruncF32S, I64TruncF32U, I64TruncF64S, I64TruncF64U, F32ConvertI32S, F32ConvertI32U, F32ConvertI64S, F32ConvertI64U, F32DemoteF64, F64ConvertI32S, F64ConvertI32U, F64ConvertI64S, F64ConvertI64U, F64PromoteF32, I32ReinterpretF32, I64ReinterpretF64, F32ReinterpretI32, F64ReinterpretI64, I32TruncSatF32S, I32TruncSatF32U, I32TruncSatF64S, I32TruncSatF64U, I64TruncSatF32S, I64TruncSatF32U, I64TruncSatF64S, I64TruncSatF64U, TableInit(u32, u32), TableGet(u32), TableSet(u32), TableCopy { from: u32, to: u32, }, TableGrow(u32), TableSize(u32), TableFill(u32),
}
Expand description

A WebAssembly Instruction

These are our own internal bytecode instructions so they may not match the spec exactly. Wasm Bytecode can map to multiple of these instructions.

§Differences to the spec

  • br_table stores the jump lables in the following br_label instructions to keep this enum small.
  • Lables/Blocks: we store the label end offset in the instruction itself and have seperate EndBlockFrame and EndFunc instructions to mark the end of a block or function. This makes it easier to implement the label stack (we call it BlockFrameStack) iteratively.

See https://webassembly.github.io/spec/core/binary/instructions.html

Variants§

§

BrLabel(u32)

§

Unreachable

§

Nop

§

Block(BlockArgs, usize)

§

Loop(BlockArgs, usize)

§

If(BlockArgs, Option<usize>, usize)

§

Else(usize)

§

EndBlockFrame

§

EndFunc

§

Br(u32)

§

BrIf(u32)

§

BrTable(u32, usize)

§

Return

§

Call(u32)

§

CallIndirect(u32, u32)

§

Drop

§

Select(Option<ValType>)

§

LocalGet(u32)

§

LocalSet(u32)

§

LocalTee(u32)

§

GlobalGet(u32)

§

GlobalSet(u32)

§

I32Load(MemoryArg)

§

I64Load(MemoryArg)

§

F32Load(MemoryArg)

§

F64Load(MemoryArg)

§

I32Load8S(MemoryArg)

§

I32Load8U(MemoryArg)

§

I32Load16S(MemoryArg)

§

I32Load16U(MemoryArg)

§

I64Load8S(MemoryArg)

§

I64Load8U(MemoryArg)

§

I64Load16S(MemoryArg)

§

I64Load16U(MemoryArg)

§

I64Load32S(MemoryArg)

§

I64Load32U(MemoryArg)

§

I32Store(MemoryArg)

§

I64Store(MemoryArg)

§

F32Store(MemoryArg)

§

F64Store(MemoryArg)

§

I32Store8(MemoryArg)

§

I32Store16(MemoryArg)

§

I64Store8(MemoryArg)

§

I64Store16(MemoryArg)

§

I64Store32(MemoryArg)

§

MemorySize(u32, u8)

§

MemoryGrow(u32, u8)

§

I32Const(i32)

§

I64Const(i64)

§

F32Const(f32)

§

F64Const(f64)

§

RefNull(ValType)

§

RefFunc(u32)

§

RefIsNull

§

I32Eqz

§

I32Eq

§

I32Ne

§

I32LtS

§

I32LtU

§

I32GtS

§

I32GtU

§

I32LeS

§

I32LeU

§

I32GeS

§

I32GeU

§

I64Eqz

§

I64Eq

§

I64Ne

§

I64LtS

§

I64LtU

§

I64GtS

§

I64GtU

§

I64LeS

§

I64LeU

§

I64GeS

§

I64GeU

§

F32Eq

§

F32Ne

§

F32Lt

§

F32Gt

§

F32Le

§

F32Ge

§

F64Eq

§

F64Ne

§

F64Lt

§

F64Gt

§

F64Le

§

F64Ge

§

I32Clz

§

I32Ctz

§

I32Popcnt

§

I32Add

§

I32Sub

§

I32Mul

§

I32DivS

§

I32DivU

§

I32RemS

§

I32RemU

§

I32And

§

I32Or

§

I32Xor

§

I32Shl

§

I32ShrS

§

I32ShrU

§

I32Rotl

§

I32Rotr

§

I64Clz

§

I64Ctz

§

I64Popcnt

§

I64Add

§

I64Sub

§

I64Mul

§

I64DivS

§

I64DivU

§

I64RemS

§

I64RemU

§

I64And

§

I64Or

§

I64Xor

§

I64Shl

§

I64ShrS

§

I64ShrU

§

I64Rotl

§

I64Rotr

§

F32Abs

§

F32Neg

§

F32Ceil

§

F32Floor

§

F32Trunc

§

F32Nearest

§

F32Sqrt

§

F32Add

§

F32Sub

§

F32Mul

§

F32Div

§

F32Min

§

F32Max

§

F32Copysign

§

F64Abs

§

F64Neg

§

F64Ceil

§

F64Floor

§

F64Trunc

§

F64Nearest

§

F64Sqrt

§

F64Add

§

F64Sub

§

F64Mul

§

F64Div

§

F64Min

§

F64Max

§

F64Copysign

§

I32WrapI64

§

I32TruncF32S

§

I32TruncF32U

§

I32TruncF64S

§

I32TruncF64U

§

I32Extend8S

§

I32Extend16S

§

I64Extend8S

§

I64Extend16S

§

I64Extend32S

§

I64ExtendI32S

§

I64ExtendI32U

§

I64TruncF32S

§

I64TruncF32U

§

I64TruncF64S

§

I64TruncF64U

§

F32ConvertI32S

§

F32ConvertI32U

§

F32ConvertI64S

§

F32ConvertI64U

§

F32DemoteF64

§

F64ConvertI32S

§

F64ConvertI32U

§

F64ConvertI64S

§

F64ConvertI64U

§

F64PromoteF32

§

I32ReinterpretF32

§

I64ReinterpretF64

§

F32ReinterpretI32

§

F64ReinterpretI64

§

I32TruncSatF32S

§

I32TruncSatF32U

§

I32TruncSatF64S

§

I32TruncSatF64U

§

I64TruncSatF32S

§

I64TruncSatF32U

§

I64TruncSatF64S

§

I64TruncSatF64U

§

TableInit(u32, u32)

§

TableGet(u32)

§

TableSet(u32)

§

TableCopy

Fields

§from: u32
§to: u32
§

TableGrow(u32)

§

TableSize(u32)

§

TableFill(u32)

Trait Implementations§

source§

impl Clone for Instruction

source§

fn clone(&self) -> Instruction

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Instruction

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl PartialEq for Instruction

source§

fn eq(&self, other: &Instruction) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Instruction

source§

impl StructuralPartialEq for Instruction

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.