binding

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package binding contains import and export utilities.

Index

Constants

View Source
const (
	VectorIndexLastImport    = -4
	VectorIndexCurrentMemory = -3
	VectorIndexGrowMemory    = -2
	VectorIndexTrapHandler   = -1
)

Well-known indexes of the import vector. Import function addresses precede the current memory size.

Variables

This section is empty.

Functions

func BindImports

func BindImports(mod *compile.Module, reso ImportResolver) (err error)

func BindLibraryImports added in v0.21.0

func BindLibraryImports(lib *compile.Library, reso LibraryImportResolver) (err error)

func GetMainFunc

func GetMainFunc(mod compile.Module, name string) (funcIndex uint32, sig wa.FuncType, err error)

GetMainFunc, the result type of which is void or i32. Parameter count or types are not checked.

Types

type ImportResolver

type ImportResolver interface {
	ResolveFunc(module, field string, sig wa.FuncType) (funcIndex uint32, err error)
	ResolveGlobal(module, field string, t wa.Type) (init uint64, err error)
}

ImportResolver maps symbols to library function indexes and constant values.

ResolveFunc returns a non-negative library function index.

ResolveGlobal returns a bit pattern the interpretation of which depends on the scalar type.

type LibraryImportResolver added in v0.21.0

type LibraryImportResolver interface {
	ResolveFunc(module, field string, sig wa.FuncType) (vectorIndex int, err error)
}

LibraryImportResolver maps symbols to vector indexes.

ResolveFunc returns a negative vector index. The vector is addressed from the end. VectorIndexLastImport is the largest valid index which ResolveFunc can return.

Jump to

Keyboard shortcuts

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