binaryencoding

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func EncodeFunctionSection(typeIndices []wasm.Index) []byte

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

func EncodeImport(i *wasm.Import) []byte

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

func EncodeLimitsType(min uint32, max *uint32, shared bool) []byte

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

func EncodeMemory(i *wasm.Memory) []byte

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

func EncodeModule(m *wasm.Module) (bytes []byte)

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

func EncodeStartSection(funcidx wasm.Index) []byte

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

func EncodeTable(i *wasm.Table) []byte

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

func EncodeValTypes(vt []wasm.ValueType) []byte

EncodeValTypes fast paths binary encoding of common value type lengths

Types

This section is empty.

Jump to

Keyboard shortcuts

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