module

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package module represents wasm module

Index

Constants

View Source
const (
	Magic   uint32 = 0x6d736100
	Version uint32 = 0x1
)

Misc constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

type Module struct {
	Version uint32

	Types    *SectionTypes
	Import   *SectionImports
	Function *SectionFunctions
	Table    *SectionTables
	Memory   *SectionMemories
	Global   *SectionGlobals
	Export   *SectionExports
	Start    *SectionStartFunction
	Elements *SectionElements
	Code     *SectionCode
	Data     *SectionData
}

Module is a struct ...

func NewModule

func NewModule() *Module

NewModule creates empty module

func Read

func Read(input io.Reader) (*Module, error)

Read reads module from stream

type Section

type Section struct {
	Begin uint64
	End   uint64
	ID    SectionID
	// Size of this section in bytes
	Len   uint32
	Bytes []byte
}

Section is a basic info about section

type SectionCode

type SectionCode struct {
	Section
	Bodies []types.FunctionBody
}

SectionCode SectionCode

type SectionCustom

type SectionCustom struct {
	Section
}

SectionCustom SectionCustom

type SectionData

type SectionData struct {
	Section
	Entries []types.DataSegment
}

SectionData SectionData

type SectionElements

type SectionElements struct {
	Section
	Entries []types.ElementSegment
}

SectionElements SectionElements

type SectionExports

type SectionExports struct {
	Section
	Entries map[string]types.ExportEntry
}

SectionExports SectionExports

type SectionFunctions

type SectionFunctions struct {
	Section
	Types []uint32
}

SectionFunctions SectionImports

type SectionGlobals

type SectionGlobals struct {
	Section
	Globals []types.GlobalEntry
}

SectionGlobals SectionGlobals

type SectionID

type SectionID byte

SectionID is a type of binary section

const (
	SectionIDCustom   SectionID = 0
	SectionIDType     SectionID = 1
	SectionIDImport   SectionID = 2
	SectionIDFunction SectionID = 3
	SectionIDTable    SectionID = 4
	SectionIDMemory   SectionID = 5
	SectionIDGlobal   SectionID = 6
	SectionIDExport   SectionID = 7
	SectionIDStart    SectionID = 8
	SectionIDElement  SectionID = 9
	SectionIDCode     SectionID = 10
	SectionIDData     SectionID = 11
)

Exported constants for sections

type SectionImports

type SectionImports struct {
	Section
	Entries []types.Import
}

SectionImports SectionImports

type SectionMemories

type SectionMemories struct {
	Section
	Entries []types.Memory
}

SectionMemories SectionMemories

type SectionStartFunction

type SectionStartFunction struct {
	Section
	Index uint32
}

SectionStartFunction SectionStartFunction

type SectionTables

type SectionTables struct {
	Section
	Entries []types.Table
}

SectionTables SectionTables

type SectionTypes

type SectionTypes struct {
	Section
	Entries []types.FunctionSig
}

SectionTypes SectionTypes

Jump to

Keyboard shortcuts

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