sections

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package wasm contains all the Plain Old Go Objects (POGO) that make up the module tree. These objects only use basic go types or refer to other module tree objects. The few methods defined here are operating strictly within their own type.

The purpose of keeping these types simple and clean is to be able to use them as communication objects between modules thereby preventing many occasions for Go's dreaded circular module reference error

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Custom

type Custom struct {
	Identifier
	Data      []byte
	SectionId byte
}

func NewCustom

func NewCustom() *Custom

type Data

type Data struct {
	Identifier
	Bytes       []byte
	MemoryIndex uint32
	Offset      []helper.Instruction
}

func NewData

func NewData() *Data

type Element

type Element struct {
	Identifier
	FuncIndexes []uint32
	Offset      []helper.Instruction
	TableIndex  uint32
}

func NewElement

func NewElement() *Element

type Export

type Export struct {
	Identifier
	Index        uint32
	ExternalType desc.ExternalType
}

func NewExport

func NewExport() *Export

type FuncType

type FuncType struct {
	Identifier
	ParamTypes  []value.DataType
	ResultTypes []value.DataType
}

func NewFuncType

func NewFuncType() *FuncType

func (*FuncType) CheckTypes

func (ft *FuncType) CheckTypes() error

func (*FuncType) IsSameAs

func (ft *FuncType) IsSameAs(rhs *FuncType) bool

type Function

type Function struct {
	Identifier
	Body      []helper.Instruction
	FrameSize uint32
	FuncType  *FuncType
	HostCall  HostCall
	Locals    []*Local
	Module    *Module
}

func NewFunction

func NewFunction() *Function

func (*Function) MaxLocalIndex

func (f *Function) MaxLocalIndex() uint32

type Global

type Global struct {
	Identifier
	Init     []helper.Instruction
	Mutable  bool
	DataType value.DataType
}

func NewGlobal

func NewGlobal() *Global

type HostCall added in v0.0.12

type HostCall func(ctx *HostContext) error

type HostContext added in v0.0.10

type HostContext struct {
	Frame    []Variable
	Function *Function
	Host     interfaces.HostInterface
	Module   *Module
	SP       int
}

type Identifier

type Identifier struct {
	ImportName string
	ModuleName string
	Nr         uint32
}

type Local

type Local struct {
	Identifier
	DataType value.DataType
}

func NewLocal

func NewLocal() *Local

type Memory

type Memory struct {
	Identifier
	Pool []byte
	Max  uint32
	Min  uint32
}

func NewMemory

func NewMemory() *Memory

type Module

type Module struct {
	Identifier
	Analyzed          bool
	Customs           []*Custom
	Datas             []*Data
	Debug             bool
	Elements          []*Element
	Exports           []*Export
	ExternalFunctions uint32
	ExternalGlobals   uint32
	ExternalMemories  uint32
	ExternalTables    uint32
	Functions         []*Function
	FuncTypes         []*FuncType
	Globals           []*Global
	GlobalVars        []*Variable
	IsLinked          bool
	Memories          []*Memory
	Start             uint32
	Tables            []*Table
}

func NewModule

func NewModule() *Module

func (*Module) MaxFuncTypes

func (m *Module) MaxFuncTypes() uint32

func (*Module) MaxFunctions

func (m *Module) MaxFunctions() uint32

func (*Module) MaxGlobals

func (m *Module) MaxGlobals() uint32

func (*Module) MaxMemories

func (m *Module) MaxMemories() uint32

func (*Module) MaxTables

func (m *Module) MaxTables() uint32

type Table

type Table struct {
	Identifier
	FuncIndexes []uint32
	FuncModules []*Module
	ElemType    byte
	Max         uint32
	Min         uint32
}

func NewTable

func NewTable() *Table

type Variable

type Variable struct {
	I32 int32   `json:"i32"`
	F32 float32 `json:"f32"`
	I64 int64   `json:"i64"`
	F64 float64 `json:"f64"`
}

func (*Variable) Copy

func (v *Variable) Copy(src *Variable, dataType value.DataType)

func (*Variable) Field

func (v *Variable) Field(dataType value.DataType) string

func (*Variable) String

func (v *Variable) String() string

Jump to

Keyboard shortcuts

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