Documentation
¶
Index ¶
- Constants
- func LoadCodeSection(config *CodeConfig, r Reader, mod *Module) (err error)
- func LoadDataSection(config *DataConfig, r Reader, mod *Module) (err error)
- func LoadUnknownSections(unknownLoader func(r Reader, payloadLen uint32) error, r Reader) (err error)
- type CodeBuffer
- type CodeConfig
- type DataBuffer
- type DataConfig
- type ImportResolver
- type Module
- func (m *Module) CopyGlobalsData(dest []byte)
- func (m *Module) DefineImportFunc(i int, addr uint64)
- func (m *Module) DefineImportGlobal(i int, init uint64)
- func (m *Module) DefineImports(res ImportResolver) (err error)
- func (m *Module) FuncTypes() []wa.FuncType
- func (m *Module) GlobalsSize() int
- func (m *Module) ImportFunc(i int) (module, field string, sig wa.FuncType)
- func (m *Module) ImportGlobal(i int) (module, field string, t wa.Type)
- func (m *Module) LoadInitialSections(r Reader) (err error)
- func (m *Module) MemoryLimits() (initial, maximum wa.MemorySize)
- func (m *Module) NumImportFunc() int
- func (m *Module) NumImportGlobal() int
- func (m *Module) Types() []wa.FuncType
- type ObjectMap
- type Reader
Constants ¶
const ObjectVersion = 0
ABI version of generated machine code.
Variables ¶
This section is empty.
Functions ¶
func LoadCodeSection ¶ added in v0.5.0
func LoadCodeSection(config *CodeConfig, r Reader, mod *Module) (err error)
LoadCodeSection reads a WebAssembly module's code section and generates machine code and read-only data.
func LoadDataSection ¶ added in v0.5.0
func LoadDataSection(config *DataConfig, r Reader, mod *Module) (err error)
LoadDataSection reads a WebAssembly module's data section and generates initial contents of mutable program state (globals and linear memory).
Types ¶
type CodeBuffer ¶ added in v0.5.0
type CodeConfig ¶ added in v0.5.0
type CodeConfig struct {
Text CodeBuffer // Initialized with default implementation if nil.
ROData DataBuffer // Initialized with default implementation if nil.
RODataAddr uintptr
ObjectMapper ObjectMap
EventHandler func(event.Event)
UnknownSectionLoader func(r Reader, payloadLen uint32) error
}
CodeConfig for a single compiler invocation.
type DataBuffer ¶
type DataConfig ¶ added in v0.5.0
type DataConfig struct {
GlobalsMemory DataBuffer // Initialized with default implementation if nil.
MemoryAlignment int // Initialized with minimal value if zero.
UnknownSectionLoader func(r Reader, payloadLen uint32) error
}
DataConfig for a single compiler invocation.
type ImportResolver ¶ added in v0.5.0
type ImportResolver interface {
ResolveFunc(module, field string, sig wa.FuncType) (addr uint64, err error)
ResolveGlobal(module, field string, t wa.Type) (init uint64, err error)
}
ImportResolver maps symbols to function addresses and constant values.
type Module ¶
type Module struct {
EntrySymbol string // Used to resolve the entry function during
EntryArgs []uint64 // initial section loading.
UnknownSectionLoader func(r Reader, payloadLen uint32) error
// contains filtered or unexported fields
}
Module contains a WebAssembly module's metadata.
func (*Module) CopyGlobalsData ¶ added in v0.5.0
CopyGlobalsData copies globals' initial values into dest, aligning them against its end. len(dest) must be at least m.GlobalsSize().
func (*Module) DefineImportFunc ¶ added in v0.5.0
func (*Module) DefineImportGlobal ¶ added in v0.5.0
func (*Module) DefineImports ¶ added in v0.5.0
func (m *Module) DefineImports(res ImportResolver) (err error)
func (*Module) GlobalsSize ¶
func (*Module) ImportFunc ¶ added in v0.5.0
func (*Module) ImportGlobal ¶ added in v0.5.0
func (*Module) LoadInitialSections ¶ added in v0.5.0
LoadInitialSections reads all sections preceding code and data, initializing the Module instance.
func (*Module) MemoryLimits ¶
func (m *Module) MemoryLimits() (initial, maximum wa.MemorySize)