Documentation ¶
Index ¶
- Constants
- func LastErrorString() string
- type CallbackFunction
- type Config
- type Environment
- type EnvironmentT
- type FuncTypeT
- type Function
- func (f *Function) Call(args ...interface{}) (interface{}, error)
- func (f *Function) GetArgType(index int) uint8
- func (f *Function) GetImportField() *string
- func (f *Function) GetImportModule() *string
- func (f *Function) GetModule() *Module
- func (f *Function) GetNumArgs() uint32
- func (f *Function) GetReturnType() uint8
- func (f *Function) GetSignature() string
- func (f *Function) Ptr() C.IM3Function
- type FunctionT
- type FunctionWrapper
- type Module
- func (m *Module) FunctionNames() []string
- func (m *Module) GetFunction(index uint) (*Function, error)
- func (m *Module) GetFunctionByName(lookupName string) (*Function, error)
- func (m *Module) LinkRawFunction(moduleName, functionName, signature string, fn unsafe.Pointer) error
- func (m *Module) Name() string
- func (m *Module) NumFunctions() int
- func (m *Module) NumImports() int
- func (m *Module) Ptr() C.IM3Module
- type ModuleT
- type ResultT
- type Runtime
- func (r *Runtime) AttachFunction(moduleName string, functionName string, signature string, ...)
- func (r *Runtime) Destroy()
- func (r *Runtime) FindFunction(funcName string) (FunctionWrapper, error)
- func (r *Runtime) FindFunctionByModule(moduleName string, funcName string) (FunctionWrapper, error)
- func (r *Runtime) GetAllocatedMemoryLength() int
- func (r *Runtime) Load(wasmBytes []byte) (*Module, error)
- func (r *Runtime) LoadModule(module *Module) (*Module, error)
- func (r *Runtime) Memory() []byte
- func (r *Runtime) ParseModule(wasmBytes []byte) (*Module, error)
- func (r *Runtime) PrintRuntimeInfo()
- func (r *Runtime) Ptr() C.IM3Runtime
- func (r *Runtime) ResizeMemory(numPages int32) error
- type RuntimeT
- type WasiIoVec
Constants ¶
const (
PageSize uint32 = 0x10000
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CallbackFunction ¶
CallbackFunction is the signature for callbacks
type Config ¶
type Config struct { Environment *Environment StackSize uint // EnableWASI bool EnableSpecTest bool }
Config holds the runtime and environment configuration
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
Environment wraps a WASM3 environment
func NewEnvironment ¶
func NewEnvironment() *Environment
NewEnvironment initializes a new environment
func (*Environment) ParseModule ¶
func (e *Environment) ParseModule(wasmBytes []byte) (*Module, error)
ParseModule wraps m3_ParseModule
func (*Environment) Ptr ¶
func (e *Environment) Ptr() C.IM3Environment
Ptr returns a pointer to IM3Environment
type Function ¶
type Function struct { // fnWrapper FunctionWrapper Name string // contains filtered or unexported fields }
Function is a function wrapper
func (*Function) GetArgType ¶
func (*Function) GetImportField ¶
func (*Function) GetImportModule ¶
func (*Function) GetNumArgs ¶
func (*Function) GetReturnType ¶
func (*Function) GetSignature ¶
type FunctionWrapper ¶
type FunctionWrapper func(args ...interface{}) (interface{}, error)
FunctionWrapper is used to wrap WASM3 call methods and make the calls more idiomatic
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module wraps a WASM3 module.
func (*Module) FunctionNames ¶
func (*Module) GetFunction ¶
GetFunction provides access to IM3Function->functions
func (*Module) GetFunctionByName ¶
GetFunctionByName is a helper to lookup functions by name TODO: could be optimized by caching function names and pointer on the Go side, right after the load call.
func (*Module) LinkRawFunction ¶
func (m *Module) LinkRawFunction(moduleName, functionName, signature string, fn unsafe.Pointer) error
TODO: Store the CStrings to later free them!
func (*Module) NumFunctions ¶
NumFunctions provides access to numFunctions.
func (*Module) NumImports ¶
NumImports provides access to numImports
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime wraps a WASM3 runtime
func NewRuntime ¶
NewRuntime initializes a new runtime TODO: nativeStackInfo is passed as NULL
func (*Runtime) AttachFunction ¶
func (r *Runtime) AttachFunction(moduleName string, functionName string, signature string, callback CallbackFunction)
AttachFunction binds a callable function to a module+func
func (*Runtime) FindFunction ¶
func (r *Runtime) FindFunction(funcName string) (FunctionWrapper, error)
FindFunction calls m3_FindFunction and returns a call function
func (*Runtime) FindFunctionByModule ¶
func (r *Runtime) FindFunctionByModule(moduleName string, funcName string) (FunctionWrapper, error)
FindFunction does thins
func (*Runtime) GetAllocatedMemoryLength ¶
GetAllocatedMemoryLength returns the amount of allocated runtime memory
func (*Runtime) Load ¶
Load wraps the parse and load module calls. This will be replaced by env.ParseModule and Runtime.LoadModule.
func (*Runtime) LoadModule ¶
LoadModule wraps m3_LoadModule and returns a module object
func (*Runtime) Memory ¶
Memory allows access to runtime Memory. Taken from Wasmer extension: https://github.com/wasmerio/go-ext-wasm
func (*Runtime) ParseModule ¶
ParseModule is a helper that calls the same function in env.
func (*Runtime) PrintRuntimeInfo ¶
func (r *Runtime) PrintRuntimeInfo()