module

package
v0.63.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pretty

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

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

Types

type CodeEntry

type CodeEntry struct {
	Func Function
}

CodeEntry represents a code segment entry.

type CustomSection added in v0.26.0

type CustomSection struct {
	Name string
	Data []byte
}

CustomSection represents a WASM custom section.

type DataSection

type DataSection struct {
	Segments []DataSegment
}

DataSection represents a WASM data section.

type DataSegment

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

DataSegment represents a WASM data segment.

func (DataSegment) String

func (seg DataSegment) String() string

type ElementSection added in v0.15.0

type ElementSection struct {
	Segments []ElementSegment
}

ElementSection represents a WASM element section.

type ElementSegment added in v0.15.0

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

ElementSegment represents a WASM element segment.

type Export

type Export struct {
	Name       string
	Descriptor ExportDescriptor
}

Export represents a WASM export statement.

func (Export) String

func (exp Export) String() string

type ExportDescriptor

type ExportDescriptor struct {
	Type  ExportDescriptorType
	Index uint32
}

ExportDescriptor represents a WASM export descriptor.

type ExportDescriptorType

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

func (x ExportDescriptorType) String() string

type ExportSection

type ExportSection struct {
	Exports []Export
}

ExportSection represents a WASM export section.

type Expr

type Expr struct {
	Instrs []instruction.Instruction
}

Expr represents a WASM expression.

func (Expr) String

func (e Expr) String() string

type Function

type Function struct {
	Locals []LocalDeclaration
	Expr   Expr
}

Function represents a function in a code segment.

type FunctionImport

type FunctionImport struct {
	Func uint32
}

FunctionImport represents a WASM function import statement.

func (FunctionImport) Kind

Kind returns the function import type kind.

func (FunctionImport) String

func (i FunctionImport) String() string

type FunctionSection

type FunctionSection struct {
	TypeIndices []uint32
}

FunctionSection represents a WASM function section.

type FunctionType

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

FunctionType represents a WASM function type definition.

func (FunctionType) Equal added in v0.11.0

func (tpe FunctionType) Equal(other FunctionType) bool

Equal returns true if tpe equals other.

func (FunctionType) String

func (tpe FunctionType) String() string

type Global

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

Global represents a WASM global statement.

type GlobalImport

type GlobalImport struct {
	Type    types.ValueType
	Mutable bool
}

GlobalImport represents a WASM global variable import statement.

func (GlobalImport) Kind

Kind returns the global import type kind.

func (GlobalImport) String

func (i GlobalImport) String() string

type GlobalSection

type GlobalSection struct {
	Globals []Global
}

GlobalSection represents a WASM global section.

type Import

type Import struct {
	Module     string
	Name       string
	Descriptor ImportDescriptor
}

Import represents a WASM import statement.

func (Import) String

func (imp Import) String() string

type ImportDescriptor

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

ImportDescriptor represents a WASM import descriptor.

type ImportDescriptorType

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

func (x ImportDescriptorType) String() string

type ImportSection

type ImportSection struct {
	Imports []Import
}

ImportSection represents a WASM import section.

type Limit

type Limit struct {
	Min uint32
	Max *uint32
}

Limit represents a WASM limit.

func (Limit) String

func (lim Limit) String() string

type LocalDeclaration

type LocalDeclaration struct {
	Count uint32
	Type  types.ValueType
}

LocalDeclaration represents a local variable declaration.

type LocalNameMap added in v0.26.0

type LocalNameMap struct {
	FuncIndex uint32
	NameMap
}

LocalNameMap maps function indices, and argument indices for the args of the indexed function to their names.

type MemType

type MemType struct {
	Lim Limit
}

MemType defines the attributes of a memory import.

type Memory added in v0.34.0

type Memory struct {
	Lim Limit
}

Memory represents a Wasm memory statement.

type MemoryImport

type MemoryImport struct {
	Mem MemType
}

MemoryImport represents a WASM memory import statement.

func (MemoryImport) Kind

Kind returns the memory import type kind.

func (MemoryImport) String

func (i MemoryImport) String() string

type MemorySection added in v0.34.0

type MemorySection struct {
	Memories []Memory
}

MemorySection represents a Wasm memory section.

type Module

type Module struct {
	Version  uint32
	Start    StartSection
	Type     TypeSection
	Import   ImportSection
	Function FunctionSection
	Table    TableSection
	Memory   MemorySection
	Element  ElementSection
	Global   GlobalSection
	Export   ExportSection
	Code     RawCodeSection
	Data     DataSection
	Customs  []CustomSection
	Names    NameSection
}

Module represents a WASM module.

type NameMap added in v0.26.0

type NameMap struct {
	Index uint32
	Name  string
}

NameMap maps function or local arg indices to their names.

type NameSection added in v0.26.0

type NameSection struct {
	Module    string
	Functions []NameMap
	Locals    []LocalNameMap
}

NameSection represents the WASM custom section "name".

type PrettyOption

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

PrettyOption defines options for controlling pretty printing.

type RawCodeSection

type RawCodeSection struct {
	Segments []RawCodeSegment
}

RawCodeSection represents a WASM code section. The code section is left as a raw byte sequence.

type RawCodeSegment

type RawCodeSegment struct {
	Code []byte
}

RawCodeSegment represents a binary-encoded WASM code segment.

func (RawCodeSegment) String

func (seg RawCodeSegment) String() string

type StartSection added in v0.27.0

type StartSection struct {
	FuncIndex *uint32
}

StartSection represents a WASM start section.

type Table

type Table struct {
	Type types.ElementType
	Lim  Limit
}

Table represents a WASM table statement.

type TableImport

type TableImport struct {
	Type types.ElementType
	Lim  Limit
}

TableImport represents a WASM table import statement.

func (TableImport) Kind

Kind returns the table import type kind.

func (TableImport) String

func (i TableImport) String() string

type TableSection

type TableSection struct {
	Tables []Table
}

TableSection represents a WASM table section.

type TypeSection

type TypeSection struct {
	Functions []FunctionType
}

TypeSection represents a WASM type section.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL