types

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2018 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package types defines wasm low level types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataSegment

type DataSegment struct {
	Index  uint32 // The index into the global linear memory space, should always be 0 in the MVP.
	Offset []byte // initializer expression for computing the offset for placing elements, should return an i32 value
	Data   []byte
}

DataSegment an entry in data section.

type ElementSegment

type ElementSegment struct {
	Index  uint32 // The index into the global table space, should always be 0 in the MVP.
	Offset []byte // initializer expression for computing the offset for placing elements, should return an i32 value
	Elems  []uint32
}

ElementSegment is an element.

type ExportEntry

type ExportEntry struct {
	Name  string
	Kind  External
	Index uint32
}

ExportEntry is an export entry.

type External

type External byte

External is a type of external object.

const (
	ExternalFunction External = 0
	ExternalTable    External = 1
	ExternalMemory   External = 2
	ExternalGlobal   External = 3
)

External entries types

type FunctionBody

type FunctionBody struct {
	Locals []LocalEntry
	Code   []byte
}

FunctionBody is an bytes and args of a function.

type FunctionSig

type FunctionSig struct {
	Form    byte
	Params  []Value
	Returns []Value
}

FunctionSig is a signature of function.

type GlobalEntry

type GlobalEntry struct {
	Type *GlobalVar // Type holds information about the value type and mutability of the variable
	Init []byte     // Init is an initializer expression that computes the initial value of the variable
}

GlobalEntry is an entry in globals

type GlobalVar

type GlobalVar struct {
	Type    Value // Type of the value stored by the variable
	Mutable bool  // Whether the value of the variable can be changed by the set_global operator
}

GlobalVar represents a global var.

type Import

type Import struct {
	Module string
	Field  string
	Type   Importable
}

Import is an imported object

type ImportFunc

type ImportFunc struct {
	Type uint32
}

ImportFunc is an imported function.

type ImportGlobalVar

type ImportGlobalVar struct {
	Type GlobalVar
}

ImportGlobalVar is an imported global var.

type ImportMemory

type ImportMemory struct {
	Type Memory
}

ImportMemory is an imported memory

type ImportTable

type ImportTable struct {
	Type Table
}

ImportTable is an imported table.

type Importable

type Importable interface{}

Importable is an interface of object that we want to import.

type LocalEntry

type LocalEntry struct {
	Count uint32 // The total number of local variables of the given Type used in the function body
	Type  Value  // The type of value stored by the variable
}

LocalEntry is an entry in locals.

type Memory

type Memory struct {
	Limits ResizableLimits
}

Memory represents a memory.

type ResizableLimits

type ResizableLimits struct {
	Flags   uint32 // 1 if the Maximum field is valid
	Initial uint32 // initial length (in units of table elements or wasm pages)
	Maximum uint32 // If flags is 1, it describes the maximum size of the table or memory
}

ResizableLimits is a limit boundaries of other objects

type Table

type Table struct {
	ElementType byte
	Limits      ResizableLimits
}

Table represents a table.

type Value

type Value byte

Value is a type of simple value.

const (
	I32 Value = 0x7F
	I64 Value = 0x7E
	F32 Value = 0x7C
	F64 Value = 0x7D
)

simple value types.

Jump to

Keyboard shortcuts

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