package instruction
import "github.com/open-policy-agent/opa/internal/wasm/instruction"
Package instruction defines WASM instruction types.
Index ¶
- type Block
- func (i Block) BlockType() *types.ValueType
- func (i Block) Instructions() []Instruction
- func (Block) Op() opcode.Opcode
- type BrIf
- type Call
- type End
- type GetLocal
- type I32Const
- type I32Eqz
- type I32GeS
- type I32GtS
- type I32LeS
- type I32LtS
- type I32Ne
- type I64Const
- type Instruction
- type Loop
- func (i Loop) BlockType() *types.ValueType
- func (i Loop) Instructions() []Instruction
- func (Loop) Op() opcode.Opcode
- type NoImmediateArgs
- type Nop
- type Return
- type SetLocal
- type StructuredInstruction
- type Unreachable
Types ¶
type Block ¶
type Block struct { NoImmediateArgs Type *types.ValueType Instrs []Instruction }
Block represents a WASM block instruction.
func (Block) BlockType ¶
BlockType returns the type of the block's return value.
func (Block) Instructions ¶
func (i Block) Instructions() []Instruction
Instructions returns the instructions contained in the block.
func (Block) Op ¶
Op returns the opcode of the instruction
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.
func (BrIf) Op ¶
Op returns the opcode of the instruction.
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.
func (Call) Op ¶
Op returns the opcode of the instruction.
type End ¶
type End struct { NoImmediateArgs }
End represents the special WASM end instruction.
func (End) Op ¶
Op returns the opcode of the instruction.
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.
func (GetLocal) Op ¶
Op returns the opcode of the instruction.
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.
func (I32Const) Op ¶
Op returns the opcode of the instruction.
type I32Eqz ¶
type I32Eqz struct { NoImmediateArgs }
I32Eqz represents the WASM i32.eqz instruction.
func (I32Eqz) Op ¶
Op returns the opcode of the instruction.
type I32GeS ¶
type I32GeS struct { NoImmediateArgs }
I32GeS represents the WASM i32.ge_s instruction.
func (I32GeS) Op ¶
Op returns the opcode of the instruction.
type I32GtS ¶
type I32GtS struct { NoImmediateArgs }
I32GtS represents the WASM i32.gt_s instruction.
func (I32GtS) Op ¶
Op returns the opcode of the instruction.
type I32LeS ¶
type I32LeS struct { NoImmediateArgs }
I32LeS represents the WASM i32.le_s instruction.
func (I32LeS) Op ¶
Op returns the opcode of the instruction.
type I32LtS ¶
type I32LtS struct { NoImmediateArgs }
I32LtS represents the WASM i32.lt_s instruction.
func (I32LtS) Op ¶
Op returns the opcode of the instruction.
type I32Ne ¶
type I32Ne struct { NoImmediateArgs }
I32Ne represents the WASM i32.ne instruction.
func (I32Ne) Op ¶
Op returns the opcode of the instruction.
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.
func (I64Const) Op ¶
Op returns the opcode of the instruction.
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) BlockType ¶
BlockType returns the type of the loop's return value.
func (Loop) Instructions ¶
func (i Loop) Instructions() []Instruction
Instructions represents the instructions contained in the loop.
func (Loop) Op ¶
Op returns the opcode of the instruction.
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 Nop ¶
type Nop struct { NoImmediateArgs }
Nop represents a WASM no-op instruction.
func (Nop) Op ¶
Op returns the opcode of the instruction.
type Return ¶
type Return struct { NoImmediateArgs }
Return represents a WASM return instruction.
func (Return) Op ¶
Op returns the opcode of the 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.
func (SetLocal) Op ¶
Op returns the opcode of the instruction.
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.
Source Files ¶
control.go instruction.go numeric.go variable.go
- Version
- v0.10.4
- Published
- Feb 19, 2019
- Platform
- js/wasm
- Imports
- 2 packages
- Last checked
- 1 hour ago –
Tools for package owners.