Versions in this module Expand all Collapse all v0 v0.4.2 Feb 13, 2020 Changes in this version + type TableEntry struct + Index uint32 + Initialized bool + type UninitializedTableEntryError uint32 + func (e UninitializedTableEntryError) Error() string v0.4.1 Dec 25, 2019 Changes in this version + const CustomSectionName + const Magic + const MaxLocalEntryCount + const MaxMemorySize + const MaxPageNum + const MaxTableSize + const NameFunction + const NameLocal + const NameModule + const TypeFunc + const Version + const WasmPageSize + var ErrEmptyInitExpr = errors.New("wasm: Initializer expression produces no value") + var ErrFunctionNoEnd = errors.New("Function body does not end with 0x0b (end)") + var ErrImportMutGlobal = errors.New("wasm: cannot import global mutable variable") + var ErrInvalidMagic = errors.New("wasm: Invalid magic number") + var ErrNoExportsInImportedModule = errors.New("wasm: imported module has no exports") + var ErrUnsupportedSection = errors.New("wasm: unsupported section") + func EncodeModule(w io.Writer, m *Module) error + func ReadByte(r io.Reader) (byte, error) + func SetDebugMode(dbg bool) + func WasmCalibration(m *Module) error + type BlockType ValueType + const BlockTypeEmpty + func (b BlockType) String() string + type DataSegment struct + Data []byte + Index uint32 + Offset []byte + func (s *DataSegment) MarshalWASM(w io.Writer) error + func (s *DataSegment) UnmarshalWASM(r io.Reader) error + type DuplicateExportError string + func (e DuplicateExportError) Error() string + type ElemType uint8 + const ElemTypeAnyFunc + func (t *ElemType) UnmarshalWASM(r io.Reader) error + func (t ElemType) MarshalWASM(w io.Writer) error + func (t ElemType) String() string + type ElementSegment struct + Elems []uint32 + Index uint32 + Offset []byte + func (s *ElementSegment) MarshalWASM(w io.Writer) error + func (s *ElementSegment) UnmarshalWASM(r io.Reader) error + type ExportEntry struct + FieldStr string + Index uint32 + Kind External + func (e *ExportEntry) MarshalWASM(w io.Writer) error + func (e *ExportEntry) UnmarshalWASM(r io.Reader) error + type ExportNotFoundError struct + FieldName string + ModuleName string + func (e ExportNotFoundError) Error() string + type External uint8 + const ExternalFunction + const ExternalGlobal + const ExternalMemory + const ExternalTable + func (e *External) UnmarshalWASM(r io.Reader) error + func (e External) MarshalWASM(w io.Writer) error + func (e External) String() string + type FuncImport struct + Type uint32 + func (FuncImport) Kind() External + func (f FuncImport) MarshalWASM(w io.Writer) error + type Function struct + Body *FunctionBody + Host reflect.Value + Sig *FunctionSig + func (fct *Function) IsHost() bool + type FunctionBody struct + Code []byte + Locals []LocalEntry + Module *Module + func (f *FunctionBody) MarshalWASM(w io.Writer) error + func (f *FunctionBody) UnmarshalWASM(r io.Reader) error + type FunctionNames struct + Names NameMap + func (s *FunctionNames) MarshalWASM(w io.Writer) error + func (s *FunctionNames) UnmarshalWASM(r io.Reader) error + type FunctionSig struct + Form uint8 + ParamTypes []ValueType + ReturnTypes []ValueType + func (f *FunctionSig) MarshalWASM(w io.Writer) error + func (f *FunctionSig) UnmarshalWASM(r io.Reader) error + func (f FunctionSig) String() string + type GlobalEntry struct + Init []byte + Type GlobalVar + func (g *GlobalEntry) MarshalWASM(w io.Writer) error + func (g *GlobalEntry) UnmarshalWASM(r io.Reader) error + type GlobalVar struct + Mutable bool + Type ValueType + func (g *GlobalVar) MarshalWASM(w io.Writer) error + func (g *GlobalVar) UnmarshalWASM(r io.Reader) error + type GlobalVarImport struct + Type GlobalVar + func (GlobalVarImport) Kind() External + func (t GlobalVarImport) MarshalWASM(w io.Writer) error + type Import interface + Kind func() External + type ImportEntry struct + FieldName string + ModuleName string + Type Import + func (i *ImportEntry) UnmarshalWASM(r io.Reader) error + type InvalidCodeIndexError int + func (e InvalidCodeIndexError) Error() string + type InvalidExternalError uint8 + func (e InvalidExternalError) Error() string + type InvalidFunctionIndexError uint32 + func (e InvalidFunctionIndexError) Error() string + type InvalidGlobalIndexError uint32 + func (e InvalidGlobalIndexError) Error() string + type InvalidImportError struct + FieldName string + ModuleName string + TypeIndex uint32 + func (e InvalidImportError) Error() string + type InvalidInitExprOpError byte + func (e InvalidInitExprOpError) Error() string + type InvalidLinearMemoryIndexError uint32 + func (e InvalidLinearMemoryIndexError) Error() string + type InvalidSectionIDError SectionID + func (e InvalidSectionIDError) Error() string + type InvalidTableIndexError uint32 + func (e InvalidTableIndexError) Error() string + type InvalidTypeConstructorError struct + Got int + Wanted int + func (e InvalidTypeConstructorError) Error() string + type InvalidValueTypeInitExprError struct + Got reflect.Kind + Wanted reflect.Kind + func (e InvalidValueTypeInitExprError) Error() string + type KindMismatchError struct + Export External + FieldName string + Import External + ModuleName string + func (e KindMismatchError) Error() string + type LocalEntry struct + Count uint32 + Type ValueType + func (l *LocalEntry) MarshalWASM(w io.Writer) error + func (l *LocalEntry) UnmarshalWASM(r io.Reader) error + type LocalNames struct + Funcs map[uint32]NameMap + func (s *LocalNames) MarshalWASM(w io.Writer) error + func (s *LocalNames) UnmarshalWASM(r io.Reader) error + type Marshaler interface + MarshalWASM func(w io.Writer) error + type Memory struct + Limits ResizableLimits + func (m *Memory) MarshalWASM(w io.Writer) error + func (m *Memory) UnmarshalWASM(r io.Reader) error + type MemoryImport struct + Type Memory + func (MemoryImport) Kind() External + func (t MemoryImport) MarshalWASM(w io.Writer) error + type MissingSectionError SectionID + func (e MissingSectionError) Error() string + type Module struct + Code *SectionCode + Customs []*SectionCustom + Data *SectionData + Elements *SectionElements + Export *SectionExports + Function *SectionFunctions + FunctionIndexSpace []Function + Global *SectionGlobals + GlobalIndexSpace []GlobalEntry + Import *SectionImports + LinearMemoryIndexSpace [][]byte + Memory *SectionMemories + Sections []Section + Start *SectionStartFunction + Table *SectionTables + TableIndexSpace [][]uint32 + Types *SectionTypes + Version uint32 + func DecodeModule(r io.Reader) (*Module, error) + func NewModule() *Module + func ReadModule(r io.Reader, resolvePath ResolveFunc) (*Module, error) + func (m *Module) Custom(name string) *SectionCustom + func (m *Module) ExecInitExpr(expr []byte) (interface{}, error) + func (m *Module) GetFunction(i int) *Function + func (m *Module) GetGlobal(i int) *GlobalEntry + func (m *Module) GetLinearMemoryData(index int) (byte, error) + func (m *Module) GetTableElement(index int) (uint32, error) + type ModuleName struct + Name string + func (s *ModuleName) MarshalWASM(w io.Writer) error + func (s *ModuleName) UnmarshalWASM(r io.Reader) error + type NameMap map[uint32]string + func (m NameMap) MarshalWASM(w io.Writer) error + func (m NameMap) UnmarshalWASM(r io.Reader) error + type NameSection struct + Types map[NameType][]byte + func (s *NameSection) Decode(typ NameType) (NameSubsection, error) + func (s *NameSection) MarshalWASM(w io.Writer) error + func (s *NameSection) UnmarshalWASM(r io.Reader) error + type NameSubsection interface + type NameType byte + type OutsizeError struct + ImmType string + Max uint64 + Size uint64 + func (e OutsizeError) Error() string + type RawSection struct + Bytes []byte + End int64 + ID SectionID + Start int64 + func (s *RawSection) GetRawSection() *RawSection + func (s *RawSection) SectionID() SectionID + type ResizableLimits struct + Flags uint8 + Initial uint32 + Maximum uint32 + func (lim *ResizableLimits) MarshalWASM(w io.Writer) error + func (lim *ResizableLimits) UnmarshalWASM(r io.Reader) error + type ResolveFunc func(name string) (*Module, error) + type Section interface + GetRawSection func() *RawSection + ReadPayload func(r io.Reader) error + SectionID func() SectionID + WritePayload func(w io.Writer) error + type SectionCode struct + Bodies []FunctionBody + func (*SectionCode) SectionID() SectionID + func (s *SectionCode) ReadPayload(r io.Reader) error + func (s *SectionCode) WritePayload(w io.Writer) error + type SectionCustom struct + Data []byte + Name string + func (s *SectionCustom) ReadPayload(r io.Reader) error + func (s *SectionCustom) SectionID() SectionID + func (s *SectionCustom) WritePayload(w io.Writer) error + type SectionData struct + Entries []DataSegment + func (*SectionData) SectionID() SectionID + func (s *SectionData) ReadPayload(r io.Reader) error + func (s *SectionData) WritePayload(w io.Writer) error + type SectionElements struct + Entries []ElementSegment + func (*SectionElements) SectionID() SectionID + func (s *SectionElements) ReadPayload(r io.Reader) error + func (s *SectionElements) WritePayload(w io.Writer) error + type SectionExports struct + Entries map[string]ExportEntry + Names []string + func (*SectionExports) SectionID() SectionID + func (s *SectionExports) ReadPayload(r io.Reader) error + func (s *SectionExports) WritePayload(w io.Writer) error + type SectionFunctions struct + Types []uint32 + func (*SectionFunctions) SectionID() SectionID + func (s *SectionFunctions) ReadPayload(r io.Reader) error + func (s *SectionFunctions) WritePayload(w io.Writer) error + type SectionGlobals struct + Globals []GlobalEntry + func (*SectionGlobals) SectionID() SectionID + func (s *SectionGlobals) ReadPayload(r io.Reader) error + func (s *SectionGlobals) WritePayload(w io.Writer) error + type SectionID uint8 + const SectionIDCode + const SectionIDCustom + const SectionIDData + const SectionIDElement + const SectionIDExport + const SectionIDFunction + const SectionIDGlobal + const SectionIDImport + const SectionIDMemory + const SectionIDStart + const SectionIDTable + const SectionIDType + func (s SectionID) String() string + type SectionImports struct + Entries []ImportEntry + func (*SectionImports) SectionID() SectionID + func (s *SectionImports) ReadPayload(r io.Reader) error + func (s *SectionImports) WritePayload(w io.Writer) error + type SectionMemories struct + Entries []Memory + func (*SectionMemories) SectionID() SectionID + func (s *SectionMemories) ReadPayload(r io.Reader) error + func (s *SectionMemories) WritePayload(w io.Writer) error + type SectionStartFunction struct + Index uint32 + func (*SectionStartFunction) SectionID() SectionID + func (s *SectionStartFunction) ReadPayload(r io.Reader) error + func (s *SectionStartFunction) WritePayload(w io.Writer) error + type SectionTables struct + Entries []Table + func (*SectionTables) SectionID() SectionID + func (s *SectionTables) ReadPayload(r io.Reader) error + func (s *SectionTables) WritePayload(w io.Writer) error + type SectionTypes struct + Entries []FunctionSig + func (*SectionTypes) SectionID() SectionID + func (s *SectionTypes) ReadPayload(r io.Reader) error + func (s *SectionTypes) WritePayload(w io.Writer) error + type Table struct + ElementType ElemType + Limits ResizableLimits + func (t *Table) MarshalWASM(w io.Writer) error + func (t *Table) UnmarshalWASM(r io.Reader) error + type TableImport struct + Type Table + func (TableImport) Kind() External + func (t TableImport) MarshalWASM(w io.Writer) error + type Unmarshaler interface + UnmarshalWASM func(r io.Reader) error + type ValueType uint8 + const ValueTypeI32 + const ValueTypeI64 + func (t *ValueType) UnmarshalWASM(r io.Reader) error + func (t ValueType) MarshalWASM(w io.Writer) error + func (t ValueType) String() string