Documentation
¶
Overview ¶
Package instruction defines WASM instruction types.
Index ¶
- type Block
- type Br
- type BrIf
- type Call
- type End
- type F32Const
- type F64Const
- type GetLocal
- type I32Const
- type I32Eq
- type I32Eqz
- type I32GeS
- type I32GtS
- type I32LeS
- type I32Load
- type I32LtS
- type I32Ne
- type I32Store
- type I64Const
- type Instruction
- type Loop
- type NoImmediateArgs
- type Nop
- type Return
- type SetLocal
- type StructuredInstruction
- type Unreachable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct { NoImmediateArgs Type *types.ValueType Instrs []Instruction }
Block represents a WASM block instruction.
func (Block) Instructions ¶
func (i Block) Instructions() []Instruction
Instructions returns the instructions contained in the block.
type Br ¶ added in v0.11.0
type Br struct {
Index uint32
}
Br represents a WASM br instruction.
func (Br) ImmediateArgs ¶ added in v0.11.0
func (i Br) ImmediateArgs() []interface{}
ImmediateArgs returns the block index to break to.
type BrIf ¶
type BrIf struct {
Index uint32
}
BrIf represents a WASM br_if instruction.
func (BrIf) ImmediateArgs ¶
func (i BrIf) ImmediateArgs() []interface{}
ImmediateArgs returns the block index to break to.
type Call ¶
type Call struct {
Index uint32
}
Call represents a WASM call instruction.
func (Call) ImmediateArgs ¶
func (i Call) ImmediateArgs() []interface{}
ImmediateArgs returns the function index.
type F32Const ¶ added in v0.15.0
type F32Const struct {
Value int32
}
F32Const represents the WASM f32.const instruction.
func (F32Const) ImmediateArgs ¶ added in v0.15.0
func (i F32Const) ImmediateArgs() []interface{}
ImmediateArgs returns the f32 value to push onto the stack.
type F64Const ¶ added in v0.15.0
type F64Const struct {
Value float64
}
F64Const represents the WASM f64.const instruction.
func (F64Const) ImmediateArgs ¶ added in v0.15.0
func (i F64Const) ImmediateArgs() []interface{}
ImmediateArgs returns the f64 value to push onto the stack.
type GetLocal ¶
type GetLocal struct {
Index uint32
}
GetLocal represents the WASM get_local instruction.
func (GetLocal) ImmediateArgs ¶
func (i GetLocal) ImmediateArgs() []interface{}
ImmediateArgs returns the index of the local variable to push onto the stack.
type I32Const ¶
type I32Const struct {
Value int32
}
I32Const represents the WASM i32.const instruction.
func (I32Const) ImmediateArgs ¶
func (i I32Const) ImmediateArgs() []interface{}
ImmediateArgs returns the i32 value to push onto the stack.
type I32Eq ¶ added in v0.15.1
type I32Eq struct {
NoImmediateArgs
}
I32Eq represents the WASM i32.eq instruction.
type I32Eqz ¶
type I32Eqz struct {
NoImmediateArgs
}
I32Eqz represents the WASM i32.eqz instruction.
type I32GeS ¶
type I32GeS struct {
NoImmediateArgs
}
I32GeS represents the WASM i32.ge_s instruction.
type I32GtS ¶
type I32GtS struct {
NoImmediateArgs
}
I32GtS represents the WASM i32.gt_s instruction.
type I32LeS ¶
type I32LeS struct {
NoImmediateArgs
}
I32LeS represents the WASM i32.le_s instruction.
type I32Load ¶ added in v0.15.1
I32Load represents the WASM i32.load instruction.
func (I32Load) ImmediateArgs ¶ added in v0.15.1
func (i I32Load) ImmediateArgs() []interface{}
ImmediateArgs returns the static offset and alignment operands.
type I32LtS ¶
type I32LtS struct {
NoImmediateArgs
}
I32LtS represents the WASM i32.lt_s instruction.
type I32Ne ¶ added in v0.10.3
type I32Ne struct {
NoImmediateArgs
}
I32Ne represents the WASM i32.ne instruction.
type I32Store ¶ added in v0.15.1
I32Store represents the WASM i32.store instruction.
func (I32Store) ImmediateArgs ¶ added in v0.15.1
func (i I32Store) ImmediateArgs() []interface{}
ImmediateArgs returns the static offset and alignment operands.
type I64Const ¶
type I64Const struct {
Value int64
}
I64Const represents the WASM i64.const instruction.
func (I64Const) ImmediateArgs ¶
func (i I64Const) ImmediateArgs() []interface{}
ImmediateArgs returns the i64 value to push onto the stack.
type Instruction ¶
Instruction represents a single WASM instruction.
type Loop ¶
type Loop struct { NoImmediateArgs Type *types.ValueType Instrs []Instruction }
Loop represents a WASM loop instruction.
func (Loop) Instructions ¶
func (i Loop) Instructions() []Instruction
Instructions represents the instructions contained in the loop.
type NoImmediateArgs ¶
type NoImmediateArgs struct { }
NoImmediateArgs indicates the instruction has no immediate arguments.
func (NoImmediateArgs) ImmediateArgs ¶
func (NoImmediateArgs) ImmediateArgs() []interface{}
ImmediateArgs returns the immedate arguments of an instruction.
type SetLocal ¶
type SetLocal struct {
Index uint32
}
SetLocal represents the WASM set_local instruction.
func (SetLocal) ImmediateArgs ¶
func (i SetLocal) ImmediateArgs() []interface{}
ImmediateArgs returns the index of the local variable to set with the top of the stack.
type StructuredInstruction ¶
type StructuredInstruction interface { Instruction BlockType() *types.ValueType Instructions() []Instruction }
StructuredInstruction represents a structured control instruction like br_if.
type Unreachable ¶
type Unreachable struct {
NoImmediateArgs
}
Unreachable reprsents an unreachable opcode.
func (Unreachable) Op ¶
func (Unreachable) Op() opcode.Opcode
Op returns the opcode of the instruction.