segments

package
v0.0.0-...-4c44063 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CodeSegment

type CodeSegment struct {
	NumLocals uint32
	Body      []byte
}

CodeSegment is one unit in the wasman.Module's CodeSection

func ReadCodeSegment

func ReadCodeSegment(r utils.Reader) (*CodeSegment, error)

ReadCodeSegment reads one CodeSegment from the io.Reader

type DataSegment

type DataSegment struct {
	MemoryIndex      uint32 // supposed to be zero
	OffsetExpression *expr.Expression
	Init             []byte
}

DataSegment is one unit of the wasman.Module's DataSection, initializing a range of memory, at a given offset, with a static vector of bytes

https://www.w3.org/TR/wasm-core-1/#data-segments%E2%91%A0

func ReadDataSegment

func ReadDataSegment(r utils.Reader) (*DataSegment, error)

ReadDataSegment reads one DataSegment from the io.Reader

type ElemSegment

type ElemSegment struct {
	TableIndex uint32
	OffsetExpr *expr.Expression
	Init       []uint32
}

ElemSegment is one unit of the wasm.Module's ElementsSection, initializing a subrange of a table, at a given offset, from a static vector of elements.

https://www.w3.org/TR/wasm-core-1/#element-segments%E2%91%A0

func ReadElemSegment

func ReadElemSegment(r utils.Reader) (*ElemSegment, error)

ReadElemSegment reads one ElemSegment from the io.Reader

type ExportDesc

type ExportDesc struct {
	Kind  byte
	Index uint32
}

ExportDesc means export descriptions, which describe an export in one wasman.Module

func ReadExportDesc

func ReadExportDesc(r utils.Reader) (*ExportDesc, error)

ReadExportDesc reads one ExportDesc from the io.Reader

type ExportSegment

type ExportSegment struct {
	Name string
	Desc *ExportDesc
}

ExportSegment is one unit of the wasm.Module's ExportSection

func ReadExportSegment

func ReadExportSegment(r utils.Reader) (*ExportSegment, error)

ReadExportSegment reads one ExportSegment from the io.Reader

type GlobalSegment

type GlobalSegment struct {
	Type *types.GlobalType
	Init *expr.Expression
}

GlobalSegment is one unit of the wasm.Module's GlobalSection

func ReadGlobalSegment

func ReadGlobalSegment(r utils.Reader) (*GlobalSegment, error)

ReadGlobalSegment reads one GlobalSegment from the io.Reader

type ImportDesc

type ImportDesc struct {
	Kind byte

	TypeIndexPtr  *uint32           // => func x
	TableTypePtr  *types.TableType  // => table tt
	MemTypePtr    *types.MemoryType // => mem mt
	GlobalTypePtr *types.GlobalType // => global gt
}

ImportDesc means import descriptions, which describe an import in one wasman.Module

func ReadImportDesc

func ReadImportDesc(r utils.Reader) (*ImportDesc, error)

ReadImportDesc reads one ImportDesc from the io.Reader

type ImportSegment

type ImportSegment struct {
	Module string
	Name   string
	Desc   *ImportDesc
}

ImportSegment is one unit of the wasm.Module's ImportSection

func ReadImportSegment

func ReadImportSegment(r utils.Reader) (*ImportSegment, error)

ReadImportSegment reads one ImportSegment from the io.Reader

type Kind

type Kind = byte

Kind means the types of ​the extern values https://www.w3.org/TR/wasm-core-1/#external-values%E2%91%A0 https://www.w3.org/TR/wasm-core-1/#external-typing%E2%91%A0

const (
	KindFunction Kind = 0x00
	KindTable    Kind = 0x01
	KindMem      Kind = 0x02
	KindGlobal   Kind = 0x03
)

available export kinds

Jump to

Keyboard shortcuts

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