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

package module

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

Index

Package Files

module.go pretty.go

func Pretty Uses

func Pretty(w io.Writer, m *Module, opts ...PrettyOption)

Pretty writes a human-readable representation of m to w.

type CodeEntry Uses

type CodeEntry struct {
    Func Function
}

CodeEntry represents a code segment entry.

type DataSection Uses

type DataSection struct {
    Segments []DataSegment
}

DataSection represents a WASM data section.

type DataSegment Uses

type DataSegment struct {
    Index  uint32
    Offset Expr
    Init   []byte
}

DataSegment represents a WASM data segment.

func (DataSegment) String Uses

func (seg DataSegment) String() string

type ElementSection Uses

type ElementSection struct {
    Segments []ElementSegment
}

ElementSection represents a WASM element section.

type ElementSegment Uses

type ElementSegment struct {
    Index   uint32
    Offset  Expr
    Indices []uint32
}

ElementSegment represents a WASM element segment.

type Export Uses

type Export struct {
    Name       string
    Descriptor ExportDescriptor
}

Export represents a WASM export statement.

func (Export) String Uses

func (exp Export) String() string

type ExportDescriptor Uses

type ExportDescriptor struct {
    Type  ExportDescriptorType
    Index uint32
}

ExportDescriptor represents a WASM export descriptor.

type ExportDescriptorType Uses

type ExportDescriptorType int

ExportDescriptorType defines the allowed kinds of export descriptors.

const (
    FunctionExportType ExportDescriptorType = iota
    TableExportType
    MemoryExportType
    GlobalExportType
)

Defines the allowed kinds of exports.

func (ExportDescriptorType) String Uses

func (x ExportDescriptorType) String() string

type ExportSection Uses

type ExportSection struct {
    Exports []Export
}

ExportSection represents a WASM export section.

type Expr Uses

type Expr struct {
    Instrs []instruction.Instruction
}

Expr represents a WASM expression.

func (Expr) String Uses

func (e Expr) String() string

type Function Uses

type Function struct {
    Locals []LocalDeclaration
    Expr   Expr
}

Function represents a function in a code segment.

type FunctionImport Uses

type FunctionImport struct {
    Func uint32
}

FunctionImport represents a WASM function import statement.

func (FunctionImport) Kind Uses

func (i FunctionImport) Kind() ImportDescriptorType

Kind returns the function import type kind.

func (FunctionImport) String Uses

func (i FunctionImport) String() string

type FunctionSection Uses

type FunctionSection struct {
    TypeIndices []uint32
}

FunctionSection represents a WASM function section.

type FunctionType Uses

type FunctionType struct {
    Params  []types.ValueType
    Results []types.ValueType
}

FunctionType represents a WASM function type definition.

func (FunctionType) Equal Uses

func (tpe FunctionType) Equal(other FunctionType) bool

Equal returns true if tpe equals other.

func (FunctionType) String Uses

func (tpe FunctionType) String() string

type Global Uses

type Global struct {
    Type    types.ValueType
    Mutable bool
    Init    Expr
}

Global represents a WASM global statement.

type GlobalImport Uses

type GlobalImport struct {
    Type    types.ValueType
    Mutable bool
}

GlobalImport represents a WASM global variable import statement.

func (GlobalImport) Kind Uses

func (i GlobalImport) Kind() ImportDescriptorType

Kind returns the global import type kind.

func (GlobalImport) String Uses

func (i GlobalImport) String() string

type GlobalSection Uses

type GlobalSection struct {
    Globals []Global
}

GlobalSection represents a WASM global section.

type Import Uses

type Import struct {
    Module     string
    Name       string
    Descriptor ImportDescriptor
}

Import represents a WASM import statement.

func (Import) String Uses

func (imp Import) String() string

type ImportDescriptor Uses

type ImportDescriptor interface {
    fmt.Stringer
    Kind() ImportDescriptorType
}

ImportDescriptor represents a WASM import descriptor.

type ImportDescriptorType Uses

type ImportDescriptorType int

ImportDescriptorType defines allowed kinds of import descriptors.

const (
    FunctionImportType ImportDescriptorType = iota
    TableImportType
    MemoryImportType
    GlobalImportType
)

Defines the allowed kinds of imports.

func (ImportDescriptorType) String Uses

func (x ImportDescriptorType) String() string

type ImportSection Uses

type ImportSection struct {
    Imports []Import
}

ImportSection represents a WASM import section.

type Limit Uses

type Limit struct {
    Min uint32
    Max *uint32
}

Limit represents a WASM limit.

func (Limit) String Uses

func (lim Limit) String() string

type LocalDeclaration Uses

type LocalDeclaration struct {
    Count uint32
    Type  types.ValueType
}

LocalDeclaration represents a local variable declaration.

type MemType Uses

type MemType struct {
    Lim Limit
}

MemType defines the attributes of a memory import.

type MemoryImport Uses

type MemoryImport struct {
    Mem MemType
}

MemoryImport represents a WASM memory import statement.

func (MemoryImport) Kind Uses

func (i MemoryImport) Kind() ImportDescriptorType

Kind returns the memory import type kind.

func (MemoryImport) String Uses

func (i MemoryImport) String() string

type Module Uses

type Module struct {
    Version  uint32
    Type     TypeSection
    Import   ImportSection
    Function FunctionSection
    Table    TableSection
    Element  ElementSection
    Global   GlobalSection
    Export   ExportSection
    Code     RawCodeSection
    Data     DataSection
}

Module represents a WASM module.

type PrettyOption Uses

type PrettyOption struct {
    Contents bool // show raw byte content of data+code sections.
}

PrettyOption defines options for controlling pretty printing.

type RawCodeSection Uses

type RawCodeSection struct {
    Segments []RawCodeSegment
}

RawCodeSection represents a WASM code section. The code section is left as a raw byte sequence. See CodeSection for the decoded version.

type RawCodeSegment Uses

type RawCodeSegment struct {
    Code []byte
}

RawCodeSegment represents a binary-encoded WASM code segment.

func (RawCodeSegment) String Uses

func (seg RawCodeSegment) String() string

type Table Uses

type Table struct {
    Type types.ElementType
    Lim  Limit
}

Table represents a WASM table statement.

type TableImport Uses

type TableImport struct {
    Type types.ElementType
    Lim  Limit
}

TableImport represents a WASM table import statement.

func (TableImport) Kind Uses

func (i TableImport) Kind() ImportDescriptorType

Kind returns the table import type kind.

func (TableImport) String Uses

func (i TableImport) String() string

type TableSection Uses

type TableSection struct {
    Tables []Table
}

TableSection represents a WASM table section.

type TypeSection Uses

type TypeSection struct {
    Functions []FunctionType
}

TypeSection represents a WASM type section.

Package module imports 6 packages (graph) and is imported by 2 packages. Updated 2019-11-25. Refresh now. Tools for package owners.