opa: github.com/open-policy-agent/opa/internal/wasm/instruction Index | Files

package instruction

import "github.com/open-policy-agent/opa/internal/wasm/instruction"

Package instruction defines WASM instruction types.

Index

Package Files

control.go instruction.go memory.go numeric.go variable.go

type Block Uses

type Block struct {
    NoImmediateArgs
    Type   *types.ValueType
    Instrs []Instruction
}

Block represents a WASM block instruction.

func (Block) BlockType Uses

func (i Block) BlockType() *types.ValueType

BlockType returns the type of the block's return value.

func (Block) Instructions Uses

func (i Block) Instructions() []Instruction

Instructions returns the instructions contained in the block.

func (Block) Op Uses

func (Block) Op() opcode.Opcode

Op returns the opcode of the instruction

type Br Uses

type Br struct {
    Index uint32
}

Br represents a WASM br instruction.

func (Br) ImmediateArgs Uses

func (i Br) ImmediateArgs() []interface{}

ImmediateArgs returns the block index to break to.

func (Br) Op Uses

func (Br) Op() opcode.Opcode

Op returns the opcode of the instruction.

type BrIf Uses

type BrIf struct {
    Index uint32
}

BrIf represents a WASM br_if instruction.

func (BrIf) ImmediateArgs Uses

func (i BrIf) ImmediateArgs() []interface{}

ImmediateArgs returns the block index to break to.

func (BrIf) Op Uses

func (BrIf) Op() opcode.Opcode

Op returns the opcode of the instruction.

type Call Uses

type Call struct {
    Index uint32
}

Call represents a WASM call instruction.

func (Call) ImmediateArgs Uses

func (i Call) ImmediateArgs() []interface{}

ImmediateArgs returns the function index.

func (Call) Op Uses

func (Call) Op() opcode.Opcode

Op returns the opcode of the instruction.

type End Uses

type End struct {
    NoImmediateArgs
}

End represents the special WASM end instruction.

func (End) Op Uses

func (End) Op() opcode.Opcode

Op returns the opcode of the instruction.

type F32Const Uses

type F32Const struct {
    Value int32
}

F32Const represents the WASM f32.const instruction.

func (F32Const) ImmediateArgs Uses

func (i F32Const) ImmediateArgs() []interface{}

ImmediateArgs returns the f32 value to push onto the stack.

func (F32Const) Op Uses

func (F32Const) Op() opcode.Opcode

Op returns the opcode of the instruction.

type F64Const Uses

type F64Const struct {
    Value float64
}

F64Const represents the WASM f64.const instruction.

func (F64Const) ImmediateArgs Uses

func (i F64Const) ImmediateArgs() []interface{}

ImmediateArgs returns the f64 value to push onto the stack.

func (F64Const) Op Uses

func (F64Const) Op() opcode.Opcode

Op returns the opcode of the instruction.

type GetLocal Uses

type GetLocal struct {
    Index uint32
}

GetLocal represents the WASM get_local instruction.

func (GetLocal) ImmediateArgs Uses

func (i GetLocal) ImmediateArgs() []interface{}

ImmediateArgs returns the index of the local variable to push onto the stack.

func (GetLocal) Op Uses

func (GetLocal) Op() opcode.Opcode

Op returns the opcode of the instruction.

type I32Const Uses

type I32Const struct {
    Value int32
}

I32Const represents the WASM i32.const instruction.

func (I32Const) ImmediateArgs Uses

func (i I32Const) ImmediateArgs() []interface{}

ImmediateArgs returns the i32 value to push onto the stack.

func (I32Const) Op Uses

func (I32Const) Op() opcode.Opcode

Op returns the opcode of the instruction.

type I32Eq Uses

type I32Eq struct {
    NoImmediateArgs
}

I32Eq represents the WASM i32.eq instruction.

func (I32Eq) Op Uses

func (I32Eq) Op() opcode.Opcode

Op returns the opcode of the instruction.

type I32Eqz Uses

type I32Eqz struct {
    NoImmediateArgs
}

I32Eqz represents the WASM i32.eqz instruction.

func (I32Eqz) Op Uses

func (I32Eqz) Op() opcode.Opcode

Op returns the opcode of the instruction.

type I32GeS Uses

type I32GeS struct {
    NoImmediateArgs
}

I32GeS represents the WASM i32.ge_s instruction.

func (I32GeS) Op Uses

func (I32GeS) Op() opcode.Opcode

Op returns the opcode of the instruction.

type I32GtS Uses

type I32GtS struct {
    NoImmediateArgs
}

I32GtS represents the WASM i32.gt_s instruction.

func (I32GtS) Op Uses

func (I32GtS) Op() opcode.Opcode

Op returns the opcode of the instruction.

type I32LeS Uses

type I32LeS struct {
    NoImmediateArgs
}

I32LeS represents the WASM i32.le_s instruction.

func (I32LeS) Op Uses

func (I32LeS) Op() opcode.Opcode

Op returns the opcode of the instruction.

type I32Load Uses

type I32Load struct {
    Offset int32
    Align  int32 // expressed as a power of two
}

I32Load represents the WASM i32.load instruction.

func (I32Load) ImmediateArgs Uses

func (i I32Load) ImmediateArgs() []interface{}

ImmediateArgs returns the static offset and alignment operands.

func (I32Load) Op Uses

func (I32Load) Op() opcode.Opcode

Op returns the opcode of the instruction.

type I32LtS Uses

type I32LtS struct {
    NoImmediateArgs
}

I32LtS represents the WASM i32.lt_s instruction.

func (I32LtS) Op Uses

func (I32LtS) Op() opcode.Opcode

Op returns the opcode of the instruction.

type I32Ne Uses

type I32Ne struct {
    NoImmediateArgs
}

I32Ne represents the WASM i32.ne instruction.

func (I32Ne) Op Uses

func (I32Ne) Op() opcode.Opcode

Op returns the opcode of the instruction.

type I32Store Uses

type I32Store struct {
    Offset int32
    Align  int32 // expressed as a power of two
}

I32Store represents the WASM i32.store instruction.

func (I32Store) ImmediateArgs Uses

func (i I32Store) ImmediateArgs() []interface{}

ImmediateArgs returns the static offset and alignment operands.

func (I32Store) Op Uses

func (I32Store) Op() opcode.Opcode

Op returns the opcode of the instruction.

type I64Const Uses

type I64Const struct {
    Value int64
}

I64Const represents the WASM i64.const instruction.

func (I64Const) ImmediateArgs Uses

func (i I64Const) ImmediateArgs() []interface{}

ImmediateArgs returns the i64 value to push onto the stack.

func (I64Const) Op Uses

func (I64Const) Op() opcode.Opcode

Op returns the opcode of the instruction.

type Instruction Uses

type Instruction interface {
    Op() opcode.Opcode
    ImmediateArgs() []interface{}
}

Instruction represents a single WASM instruction.

type Loop Uses

type Loop struct {
    NoImmediateArgs
    Type   *types.ValueType
    Instrs []Instruction
}

Loop represents a WASM loop instruction.

func (Loop) BlockType Uses

func (i Loop) BlockType() *types.ValueType

BlockType returns the type of the loop's return value.

func (Loop) Instructions Uses

func (i Loop) Instructions() []Instruction

Instructions represents the instructions contained in the loop.

func (Loop) Op Uses

func (Loop) Op() opcode.Opcode

Op returns the opcode of the instruction.

type NoImmediateArgs Uses

type NoImmediateArgs struct {
}

NoImmediateArgs indicates the instruction has no immediate arguments.

func (NoImmediateArgs) ImmediateArgs Uses

func (NoImmediateArgs) ImmediateArgs() []interface{}

ImmediateArgs returns the immedate arguments of an instruction.

type Nop Uses

type Nop struct {
    NoImmediateArgs
}

Nop represents a WASM no-op instruction.

func (Nop) Op Uses

func (Nop) Op() opcode.Opcode

Op returns the opcode of the instruction.

type Return Uses

type Return struct {
    NoImmediateArgs
}

Return represents a WASM return instruction.

func (Return) Op Uses

func (Return) Op() opcode.Opcode

Op returns the opcode of the instruction.

type SetLocal Uses

type SetLocal struct {
    Index uint32
}

SetLocal represents the WASM set_local instruction.

func (SetLocal) ImmediateArgs Uses

func (i SetLocal) ImmediateArgs() []interface{}

ImmediateArgs returns the index of the local variable to set with the top of the stack.

func (SetLocal) Op Uses

func (SetLocal) Op() opcode.Opcode

Op returns the opcode of the instruction.

type StructuredInstruction Uses

type StructuredInstruction interface {
    Instruction
    BlockType() *types.ValueType
    Instructions() []Instruction
}

StructuredInstruction represents a structured control instruction like br_if.

type Unreachable Uses

type Unreachable struct {
    NoImmediateArgs
}

Unreachable reprsents an unreachable opcode.

func (Unreachable) Op Uses

func (Unreachable) Op() opcode.Opcode

Op returns the opcode of the instruction.

Package instruction imports 2 packages (graph) and is imported by 3 packages. Updated 2020-01-07. Refresh now. Tools for package owners.