Documentation ¶
Index ¶
- Variables
- func EncodeFunctionSection(typeIndices []wasm.Index) []byte
- func EncodeFunctionType(t *wasm.FunctionType) []byte
- func EncodeImport(i *wasm.Import) []byte
- func EncodeLimitsType(min uint32, max *uint32, shared bool) []byte
- func EncodeMemory(i *wasm.Memory) []byte
- func EncodeModule(m *wasm.Module) (bytes []byte)
- func EncodeNameSectionData(n *wasm.NameSection) (data []byte)
- func EncodeStartSection(funcidx wasm.Index) []byte
- func EncodeTable(i *wasm.Table) []byte
- func EncodeValTypes(vt []wasm.ValueType) []byte
Constants ¶
This section is empty.
Variables ¶
var Magic = []byte{0x00, 0x61, 0x73, 0x6D}
Magic is the 4 byte preamble (literally "\0asm") of the binary format See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-magic
Functions ¶
func EncodeFunctionSection ¶
EncodeFunctionSection encodes a wasm.SectionIDFunction for the type indices associated with module-defined functions in WebAssembly 1.0 (20191205) Binary Format.
See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#function-section%E2%91%A0
func EncodeFunctionType ¶
func EncodeFunctionType(t *wasm.FunctionType) []byte
EncodeFunctionType returns the wasm.FunctionType encoded in WebAssembly 1.0 (20191205) Binary Format.
Note: Function types are encoded by the byte 0x60 followed by the respective vectors of parameter and result types. See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#function-types%E2%91%A4
func EncodeImport ¶
EncodeImport returns the wasm.Import encoded in WebAssembly 1.0 (20191205) Binary Format.
See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-import
func EncodeLimitsType ¶
EncodeLimitsType returns the `limitsType` (min, max) encoded in WebAssembly 1.0 (20191205) Binary Format.
See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#limits%E2%91%A6
Extended in threads proposal: https://webassembly.github.io/threads/core/binary/types.html#limits
func EncodeMemory ¶
EncodeMemory returns the wasm.Memory encoded in WebAssembly 1.0 (20191205) Binary Format.
See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-memory
func EncodeModule ¶
EncodeModule implements wasm.EncodeModule for the WebAssembly 1.0 (20191205) Binary Format. Note: If saving to a file, the conventional extension is wasm See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-format%E2%91%A0
func EncodeNameSectionData ¶
func EncodeNameSectionData(n *wasm.NameSection) (data []byte)
EncodeNameSectionData serializes the data for the "name" key in wasm.SectionIDCustom according to the standard:
Note: The result can be nil because this does not encode empty subsections
See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-namesec
func EncodeStartSection ¶
EncodeStartSection encodes a wasm.SectionIDStart for the given function index in WebAssembly 1.0 (20191205) Binary Format.
See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#start-section%E2%91%A0
func EncodeTable ¶
EncodeTable returns the wasm.Table encoded in WebAssembly 1.0 (20191205) Binary Format.
See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-table
func EncodeValTypes ¶
EncodeValTypes fast paths binary encoding of common value type lengths
Types ¶
This section is empty.