wamr

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

type Instance struct {
	// contains filtered or unexported fields
}

Instance the instance struct

func NewInstance

func NewInstance(module *Module,
	stackSize uint, heapSize uint) (*Instance, error)

NewInstance Create instance from the module

func (Instance) AddrAppToNative

func (inst Instance) AddrAppToNative(appOffset uint32) *uint8

AddrAppToNative AddrAppToNative

func (Instance) AddrNativeToApp

func (inst Instance) AddrNativeToApp(nativePtr *uint8) uint32

AddrNativeToApp AddrNativeToApp

func (*Instance) CallFunc

func (inst *Instance) CallFunc(funcName string,
	argc uint32, args []uint32) error

CallFunc Call the wasm function with argument in the uint32 array, and store the return values back into the array

func (*Instance) CallFuncV

func (inst *Instance) CallFuncV(funcName string,
	numResults uint32, results []interface{},
	args ...interface{}) error

CallFuncV Call the wasm function with variant arguments, and store the return values back into the results array

func (*Instance) Destroy

func (inst *Instance) Destroy()

Destroy the instance

func (Instance) DumpCallStack

func (inst Instance) DumpCallStack()

DumpCallStack DumpCallStack

func (Instance) DumpMemoryConsumption

func (inst Instance) DumpMemoryConsumption()

DumpMemoryConsumption DumpMemoryConsumption

func (Instance) GetAppAddrRange

func (inst Instance) GetAppAddrRange(appOffset uint32) (bool,
	uint32,
	uint32)

GetAppAddrRange GetAppAddrRange

func (*Instance) GetException

func (inst *Instance) GetException() string

GetException Get exception info of the instance

func (Instance) GetNativeAddrRange

func (inst Instance) GetNativeAddrRange(nativePtr *uint8) (bool,
	*uint8,
	*uint8)

GetNativeAddrRange GetNativeAddrRange

func (Instance) ModuleFree

func (inst Instance) ModuleFree(offset uint32)

ModuleFree Free memory to the heap of the instance */

func (Instance) ModuleMalloc

func (inst Instance) ModuleMalloc(size uint32) (uint32, *uint8)

ModuleMalloc Allocate memory from the heap of the instance

func (Instance) ValidateAppAddr

func (inst Instance) ValidateAppAddr(appOffset uint32, size uint32) bool

ValidateAppAddr ValidateAppAddr

func (Instance) ValidateNativeAddr

func (inst Instance) ValidateNativeAddr(nativePtr *uint8, size uint32) bool

ValidateNativeAddr ValidateNativeAddr

func (Instance) ValidateStrAddr

func (inst Instance) ValidateStrAddr(appStrOffset uint32) bool

ValidateStrAddr ValidateStrAddr

type LogLevel

type LogLevel uint32

LogLevel alias uint32

const (
	// LogLevelFatal Fatal
	LogLevelFatal LogLevel = 0
	// LogLevelError error
	LogLevelError LogLevel = 1
	// LogLevelWarning warning
	LogLevelWarning LogLevel = 2
	// LogLevelDebug debug
	LogLevelDebug LogLevel = 3
	// LogLevelVerbose verbose
	LogLevelVerbose LogLevel = 4
)

type Module

type Module struct {
	// contains filtered or unexported fields
}

Module struct

func NewModule

func NewModule(wasmBytes []byte) (*Module, error)

NewModule Create WASM/AOT module from the memory buffer

func (*Module) Destroy

func (module *Module) Destroy()

Destroy the module

func (*Module) SetWasiAddrPool

func (module *Module) SetWasiAddrPool(addrPool [][]byte)

SetWasiAddrPool Set module's wasi network address pool

func (*Module) SetWasiArgs

func (module *Module) SetWasiArgs(dirList [][]byte, mapDirList [][]byte,
	env [][]byte, argv [][]byte)

SetWasiArgs Set module's wasi arguments

func (*Module) SetWasiArgsEx

func (module *Module) SetWasiArgsEx(dirList [][]byte, mapDirList [][]byte,
	env [][]byte, argv [][]byte,
	stdinfd int, stdoutfd int, stderrfd int)

SetWasiArgsEx Set module's wasi arguments

func (*Module) SetWasiNsLookupPool

func (module *Module) SetWasiNsLookupPool(nsLookupPool [][]byte)

SetWasiNsLookupPool Set module's wasi domain lookup pool

type RuntimeSingleton

type RuntimeSingleton struct {
	// contains filtered or unexported fields
}

RuntimeSingleton struct

func Runtime

func Runtime() *RuntimeSingleton

Runtime Return the runtime singleton

func (*RuntimeSingleton) Destroy

func (runtime *RuntimeSingleton) Destroy()

Destroy the WASM runtime environment

func (*RuntimeSingleton) DestroyThreadEnv

func (runtime *RuntimeSingleton) DestroyThreadEnv()

DestroyThreadEnv DestroyThreadEnv

func (*RuntimeSingleton) Free

func (runtime *RuntimeSingleton) Free(ptr *uint8)

Free Free memory to runtime memory environment

func (*RuntimeSingleton) FullInit

func (runtime *RuntimeSingleton) FullInit(allocWithPool bool, heapBuf []byte,
	maxThreadNum uint) error

FullInit Initialize the WASM runtime environment

func (*RuntimeSingleton) Init

func (runtime *RuntimeSingleton) Init() error

Init Initialize the WASM runtime environment

func (*RuntimeSingleton) InitThreadEnv

func (runtime *RuntimeSingleton) InitThreadEnv() bool

InitThreadEnv InitThreadEnv

func (*RuntimeSingleton) Malloc

func (runtime *RuntimeSingleton) Malloc(size uint32) *uint8

Malloc Allocate memory from runtime memory environment

func (*RuntimeSingleton) SetLogLevel

func (runtime *RuntimeSingleton) SetLogLevel(level LogLevel)

SetLogLevel Set log verbose level (0 to 5, default is 2), larger level with more log

func (*RuntimeSingleton) ThreadEnvInited

func (runtime *RuntimeSingleton) ThreadEnvInited() bool

ThreadEnvInited ThreadEnvInited

Directories

Path Synopsis
packaged
lib

Jump to

Keyboard shortcuts

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