module

package
v0.10.7 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2019 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 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 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) 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 MemType

type MemType struct {
	Lim Limit
}

MemType defines the attributes of a memory import.

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 Module

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

Module represents a WASM module.

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. See CodeSection for the decoded version.

type RawCodeSegment

type RawCodeSegment struct {
	Code []byte
}

RawCodeSegment represents a binary-encoded WASM code segment.

func (RawCodeSegment) String

func (seg RawCodeSegment) String() string

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