wasmedge

package
v0.0.0-...-e864451 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Disable as many optimizations as possible.
	CompilerOptLevel_O0 = CompilerOptimizationLevel(C.WasmEdge_CompilerOptimizationLevel_O0)
	// Optimize quickly without destroying debuggability.
	CompilerOptLevel_O1 = CompilerOptimizationLevel(C.WasmEdge_CompilerOptimizationLevel_O1)
	// Optimize for fast execution as much as possible without triggering significant incremental compile time or code size growth.
	CompilerOptLevel_O2 = CompilerOptimizationLevel(C.WasmEdge_CompilerOptimizationLevel_O2)
	// Optimize for fast execution as much as possible.
	CompilerOptLevel_O3 = CompilerOptimizationLevel(C.WasmEdge_CompilerOptimizationLevel_O3)
	// Optimize for small code size as much as possible without triggering significant incremental compile time or execution time slowdowns.
	CompilerOptLevel_Os = CompilerOptimizationLevel(C.WasmEdge_CompilerOptimizationLevel_Os)
	/// Optimize for small code size as much as possible.
	CompilerOptLevel_Oz = CompilerOptimizationLevel(C.WasmEdge_CompilerOptimizationLevel_Oz)
)
View Source
const (
	/// Native dynamic library format.
	CompilerOutputFormat_Native = CompilerOutputFormat(C.WasmEdge_CompilerOutputFormat_Native)
	/// WebAssembly with AOT compiled codes in custom section.
	CompilerOutputFormat_Wasm = CompilerOutputFormat(C.WasmEdge_CompilerOutputFormat_Wasm)
)
View Source
const (
	ValType_I32       = ValType(C.WasmEdge_ValType_I32)
	ValType_I64       = ValType(C.WasmEdge_ValType_I64)
	ValType_F32       = ValType(C.WasmEdge_ValType_F32)
	ValType_F64       = ValType(C.WasmEdge_ValType_F64)
	ValType_V128      = ValType(C.WasmEdge_ValType_V128)
	ValType_FuncRef   = ValType(C.WasmEdge_ValType_FuncRef)
	ValType_ExternRef = ValType(C.WasmEdge_ValType_ExternRef)
)
View Source
const (
	RefType_FuncRef   = RefType(C.WasmEdge_ValType_FuncRef)
	RefType_ExternRef = RefType(C.WasmEdge_ValType_ExternRef)
)
View Source
const (
	Bindgen_return_void  bindgen = iota
	Bindgen_return_i32   bindgen = iota
	Bindgen_return_i64   bindgen = iota
	Bindgen_return_array bindgen = iota
)

Variables

View Source
var (
	Result_Success   = Result{/* contains filtered or unexported fields */}
	Result_Terminate = Result{/* contains filtered or unexported fields */}
	Result_Fail      = Result{/* contains filtered or unexported fields */}
)

Functions

func GetVersion

func GetVersion() string

func GetVersionMajor

func GetVersionMajor() uint

func GetVersionMinor

func GetVersionMinor() uint

func GetVersionPatch

func GetVersionPatch() uint

func LoadPluginDefaultPaths

func LoadPluginDefaultPaths()

func RunWasmEdgeAOTCompilerCLI

func RunWasmEdgeAOTCompilerCLI(argv []string) int

func RunWasmEdgeCLI

func RunWasmEdgeCLI(argv []string) int

func SetLogDebugLevel

func SetLogDebugLevel()

func SetLogErrorLevel

func SetLogErrorLevel()

Types

type AST

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

func (*AST) ListExports

func (self *AST) ListExports() []*ExportType

func (*AST) ListImports

func (self *AST) ListImports() []*ImportType

func (*AST) Release

func (self *AST) Release()

type Async

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

func (*Async) Cancel

func (self *Async) Cancel()

func (*Async) GetResult

func (self *Async) GetResult() ([]interface{}, error)

func (*Async) Release

func (self *Async) Release()

func (*Async) WaitFor

func (self *Async) WaitFor(millisec int) bool

type CallingFrame

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

func (*CallingFrame) GetExecutor

func (self *CallingFrame) GetExecutor() *Executor

func (*CallingFrame) GetMemoryByIndex

func (self *CallingFrame) GetMemoryByIndex(idx int) *Memory

func (*CallingFrame) GetModule

func (self *CallingFrame) GetModule() *Module

type Compiler

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

func NewCompiler

func NewCompiler() *Compiler

func NewCompilerWithConfig

func NewCompilerWithConfig(conf *Configure) *Compiler

func (*Compiler) Compile

func (self *Compiler) Compile(inpath string, outpath string) error

func (*Compiler) Release

func (self *Compiler) Release()

type Configure

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

func NewConfigure

func NewConfigure(params ...interface{}) *Configure

func (*Configure) AddConfig

func (self *Configure) AddConfig(conf interface{})

func (*Configure) GetCompilerOptimizationLevel

func (self *Configure) GetCompilerOptimizationLevel() CompilerOptimizationLevel

func (*Configure) GetCompilerOutputFormat

func (self *Configure) GetCompilerOutputFormat() CompilerOutputFormat

func (*Configure) GetMaxMemoryPage

func (self *Configure) GetMaxMemoryPage() uint

func (*Configure) HasConfig

func (self *Configure) HasConfig(conf interface{}) bool

func (*Configure) IsCompilerDumpIR

func (self *Configure) IsCompilerDumpIR() bool

func (*Configure) IsCompilerGenericBinary

func (self *Configure) IsCompilerGenericBinary() bool

func (*Configure) IsStatisticsCostMeasuring

func (self *Configure) IsStatisticsCostMeasuring() bool

func (*Configure) IsStatisticsInstructionCounting

func (self *Configure) IsStatisticsInstructionCounting() bool

func (*Configure) IsStatisticsTimeMeasuring

func (self *Configure) IsStatisticsTimeMeasuring() bool

func (*Configure) Release

func (self *Configure) Release()

func (*Configure) RemoveConfig

func (self *Configure) RemoveConfig(conf interface{})

func (*Configure) SetCompilerDumpIR

func (self *Configure) SetCompilerDumpIR(isdump bool)

func (*Configure) SetCompilerGenericBinary

func (self *Configure) SetCompilerGenericBinary(isgeneric bool)

func (*Configure) SetCompilerOptimizationLevel

func (self *Configure) SetCompilerOptimizationLevel(level CompilerOptimizationLevel)

func (*Configure) SetCompilerOutputFormat

func (self *Configure) SetCompilerOutputFormat(format CompilerOutputFormat)

func (*Configure) SetMaxMemoryPage

func (self *Configure) SetMaxMemoryPage(pagesize uint)

func (*Configure) SetStatisticsCostMeasuring

func (self *Configure) SetStatisticsCostMeasuring(ismeasure bool)

func (*Configure) SetStatisticsInstructionCounting

func (self *Configure) SetStatisticsInstructionCounting(iscount bool)

func (*Configure) SetStatisticsTimeMeasuring

func (self *Configure) SetStatisticsTimeMeasuring(ismeasure bool)

type ErrCategory

type ErrCategory C.enum_WasmEdge_ErrCategory

type Executor

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

func NewExecutor

func NewExecutor() *Executor

func NewExecutorWithConfig

func NewExecutorWithConfig(conf *Configure) *Executor

func NewExecutorWithConfigAndStatistics

func NewExecutorWithConfigAndStatistics(conf *Configure, stat *Statistics) *Executor

func NewExecutorWithStatistics

func NewExecutorWithStatistics(stat *Statistics) *Executor

func (*Executor) Instantiate

func (self *Executor) Instantiate(store *Store, ast *AST) (*Module, error)

func (*Executor) Invoke

func (self *Executor) Invoke(store *Store, funcinst *Function, params ...interface{}) ([]interface{}, error)

func (*Executor) Register

func (self *Executor) Register(store *Store, ast *AST, modname string) (*Module, error)

func (*Executor) RegisterImport

func (self *Executor) RegisterImport(store *Store, module *Module) error

func (*Executor) Release

func (self *Executor) Release()

type ExportType

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

func (*ExportType) GetExternalName

func (self *ExportType) GetExternalName() string

func (*ExportType) GetExternalType

func (self *ExportType) GetExternalType() ExternType

func (*ExportType) GetExternalValue

func (self *ExportType) GetExternalValue() interface{}

type ExternRef

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

func NewExternRef

func NewExternRef(ptr interface{}) ExternRef

func (ExternRef) GetRef

func (self ExternRef) GetRef() interface{}

func (ExternRef) Release

func (self ExternRef) Release()

type ExternType

type ExternType C.enum_WasmEdge_ExternalType

type FuncRef

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

func NewFuncRef

func NewFuncRef(funcinst *Function) FuncRef

func (FuncRef) GetRef

func (self FuncRef) GetRef() *Function

type Function

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

func NewFunction

func NewFunction(ftype *FunctionType, fn hostFunctionSignature, additional interface{}, cost uint) *Function

func (*Function) GetFunctionType

func (self *Function) GetFunctionType() *FunctionType

func (*Function) Release

func (self *Function) Release()

type FunctionType

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

func NewFunctionType

func NewFunctionType(params []ValType, returns []ValType) *FunctionType

func (*FunctionType) GetParameters

func (self *FunctionType) GetParameters() []ValType

func (*FunctionType) GetParametersLength

func (self *FunctionType) GetParametersLength() uint

func (*FunctionType) GetReturns

func (self *FunctionType) GetReturns() []ValType

func (*FunctionType) GetReturnsLength

func (self *FunctionType) GetReturnsLength() uint

func (*FunctionType) Release

func (self *FunctionType) Release()

type Global

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

func NewGlobal

func NewGlobal(gtype *GlobalType, val interface{}) *Global

func (*Global) GetGlobalType

func (self *Global) GetGlobalType() *GlobalType

func (*Global) GetValue

func (self *Global) GetValue() interface{}

func (*Global) Release

func (self *Global) Release()

func (*Global) SetValue

func (self *Global) SetValue(val interface{})

type GlobalType

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

func NewGlobalType

func NewGlobalType(vtype ValType, vmut ValMut) *GlobalType

func (*GlobalType) GetMutability

func (self *GlobalType) GetMutability() ValMut

func (*GlobalType) GetValType

func (self *GlobalType) GetValType() ValType

func (*GlobalType) Release

func (self *GlobalType) Release()

type ImportType

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

func (*ImportType) GetExternalName

func (self *ImportType) GetExternalName() string

func (*ImportType) GetExternalType

func (self *ImportType) GetExternalType() ExternType

func (*ImportType) GetExternalValue

func (self *ImportType) GetExternalValue() interface{}

func (*ImportType) GetModuleName

func (self *ImportType) GetModuleName() string

type Limit

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

func NewLimit

func NewLimit(minVal uint) *Limit

func NewLimitShared

func NewLimitShared(minVal uint) *Limit

func NewLimitSharedWithMax

func NewLimitSharedWithMax(minVal uint, maxVal uint) *Limit

func NewLimitWithMax

func NewLimitWithMax(minVal uint, maxVal uint) *Limit

func (*Limit) GetMax

func (l *Limit) GetMax() uint

func (*Limit) GetMin

func (l *Limit) GetMin() uint

func (*Limit) HasMax

func (l *Limit) HasMax() bool

func (*Limit) IsShared

func (l *Limit) IsShared() bool

type Loader

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

func NewLoader

func NewLoader() *Loader

func NewLoaderWithConfig

func NewLoaderWithConfig(conf *Configure) *Loader

func (*Loader) LoadBuffer

func (self *Loader) LoadBuffer(buf []byte) (*AST, error)

func (*Loader) LoadFile

func (self *Loader) LoadFile(path string) (*AST, error)

func (*Loader) Release

func (self *Loader) Release()

type Memory

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

func NewMemory

func NewMemory(mtype *MemoryType) *Memory

func (*Memory) GetData

func (self *Memory) GetData(off uint, length uint) ([]byte, error)

func (*Memory) GetMemoryType

func (self *Memory) GetMemoryType() *MemoryType

func (*Memory) GetPageSize

func (self *Memory) GetPageSize() uint

func (*Memory) GrowPage

func (self *Memory) GrowPage(size uint) error

func (*Memory) Release

func (self *Memory) Release()

func (*Memory) SetData

func (self *Memory) SetData(data []byte, off uint, length uint) error

type MemoryType

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

func NewMemoryType

func NewMemoryType(lim *Limit) *MemoryType

func (*MemoryType) GetLimit

func (self *MemoryType) GetLimit() *Limit

func (*MemoryType) Release

func (self *MemoryType) Release()

type Module

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

func NewModule

func NewModule(modname string) *Module

func NewWasiCryptoAsymmetricCommonModule

func NewWasiCryptoAsymmetricCommonModule() *Module

func NewWasiCryptoCommonModule

func NewWasiCryptoCommonModule() *Module

func NewWasiCryptoKxModule

func NewWasiCryptoKxModule() *Module

func NewWasiCryptoSignaturesModule

func NewWasiCryptoSignaturesModule() *Module

func NewWasiCryptoSymmetricModule

func NewWasiCryptoSymmetricModule() *Module

func NewWasiModule

func NewWasiModule(args []string, envs []string, preopens []string) *Module

func NewWasiNNModule

func NewWasiNNModule() *Module

func NewWasmEdgeProcessModule

func NewWasmEdgeProcessModule(allowedcmds []string, allowall bool) *Module

func (*Module) AddFunction

func (self *Module) AddFunction(name string, inst *Function)

func (*Module) AddGlobal

func (self *Module) AddGlobal(name string, inst *Global)

func (*Module) AddMemory

func (self *Module) AddMemory(name string, inst *Memory)

func (*Module) AddTable

func (self *Module) AddTable(name string, inst *Table)

func (*Module) FindFunction

func (self *Module) FindFunction(name string) *Function

func (*Module) FindGlobal

func (self *Module) FindGlobal(name string) *Global

func (*Module) FindMemory

func (self *Module) FindMemory(name string) *Memory

func (*Module) FindTable

func (self *Module) FindTable(name string) *Table

func (*Module) InitWasi

func (self *Module) InitWasi(args []string, envs []string, preopens []string)

func (*Module) InitWasmEdgeProcess

func (self *Module) InitWasmEdgeProcess(allowedcmds []string, allowall bool)

func (*Module) ListFunction

func (self *Module) ListFunction() []string

func (*Module) ListGlobal

func (self *Module) ListGlobal() []string

func (*Module) ListMemory

func (self *Module) ListMemory() []string

func (*Module) ListTable

func (self *Module) ListTable() []string

func (*Module) Release

func (self *Module) Release()

func (*Module) WasiGetExitCode

func (self *Module) WasiGetExitCode() uint

type Proposal

type Proposal C.enum_WasmEdge_Proposal

type RefType

type RefType C.enum_WasmEdge_RefType

func (RefType) String

func (self RefType) String() string

type Result

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

func NewResult

func NewResult(cate ErrCategory, code int) Result

func (*Result) Error

func (res *Result) Error() string

func (*Result) GetCode

func (res *Result) GetCode() int

func (*Result) GetErrorCategory

func (res *Result) GetErrorCategory() ErrCategory

type Statistics

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

func NewStatistics

func NewStatistics() *Statistics

func (*Statistics) GetInstrCount

func (self *Statistics) GetInstrCount() uint

func (*Statistics) GetInstrPerSecond

func (self *Statistics) GetInstrPerSecond() float64

func (*Statistics) GetTotalCost

func (self *Statistics) GetTotalCost() uint

func (*Statistics) Release

func (self *Statistics) Release()

func (*Statistics) SetCostLimit

func (self *Statistics) SetCostLimit(limit uint)

func (*Statistics) SetCostTable

func (self *Statistics) SetCostTable(table []uint64)

type Store

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

func NewStore

func NewStore() *Store

func (*Store) FindModule

func (self *Store) FindModule(name string) *Module

func (*Store) ListModule

func (self *Store) ListModule() []string

func (*Store) Release

func (self *Store) Release()

type Table

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

func NewTable

func NewTable(ttype *TableType) *Table

func (*Table) GetData

func (self *Table) GetData(off uint) (interface{}, error)

func (*Table) GetSize

func (self *Table) GetSize() uint

func (*Table) GetTableType

func (self *Table) GetTableType() *TableType

func (*Table) Grow

func (self *Table) Grow(size uint) error

func (*Table) Release

func (self *Table) Release()

func (*Table) SetData

func (self *Table) SetData(data interface{}, off uint) error

type TableType

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

func NewTableType

func NewTableType(rtype RefType, lim *Limit) *TableType

func (*TableType) GetLimit

func (self *TableType) GetLimit() *Limit

func (*TableType) GetRefType

func (self *TableType) GetRefType() RefType

func (*TableType) Release

func (self *TableType) Release()

type V128

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

func NewV128

func NewV128(high uint64, low uint64) V128

func (V128) GetVal

func (self V128) GetVal() (uint64, uint64)

type VM

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

func NewVM

func NewVM() *VM

func NewVMWithConfig

func NewVMWithConfig(conf *Configure) *VM

func NewVMWithConfigAndStore

func NewVMWithConfigAndStore(conf *Configure, store *Store) *VM

func NewVMWithStore

func NewVMWithStore(store *Store) *VM

func (*VM) AsyncExecute

func (self *VM) AsyncExecute(funcname string, params ...interface{}) *Async

func (*VM) AsyncExecuteRegistered

func (self *VM) AsyncExecuteRegistered(modname string, funcname string, params ...interface{}) *Async

func (*VM) AsyncRunWasmAST

func (self *VM) AsyncRunWasmAST(ast *AST, funcname string, params ...interface{}) *Async

func (*VM) AsyncRunWasmBuffer

func (self *VM) AsyncRunWasmBuffer(buf []byte, funcname string, params ...interface{}) *Async

func (*VM) AsyncRunWasmFile

func (self *VM) AsyncRunWasmFile(path string, funcname string, params ...interface{}) *Async

func (*VM) Cleanup

func (self *VM) Cleanup()

func (*VM) Execute

func (self *VM) Execute(funcname string, params ...interface{}) ([]interface{}, error)

func (*VM) ExecuteBindgen

func (self *VM) ExecuteBindgen(funcname string, rettype bindgen, params ...interface{}) (interface{}, error)

Special execute function for running with wasm-bindgen.

func (*VM) ExecuteBindgenRegistered

func (self *VM) ExecuteBindgenRegistered(modname string, funcname string, rettype bindgen, params ...interface{}) (interface{}, error)

Special execute function for running with wasm-bindgen.

func (*VM) ExecuteRegistered

func (self *VM) ExecuteRegistered(modname string, funcname string, params ...interface{}) ([]interface{}, error)

func (*VM) GetActiveModule

func (self *VM) GetActiveModule() *Module

func (*VM) GetExecutor

func (self *VM) GetExecutor() *Executor

func (*VM) GetFunctionList

func (self *VM) GetFunctionList() ([]string, []*FunctionType)

func (*VM) GetFunctionType

func (self *VM) GetFunctionType(funcname string) *FunctionType

func (*VM) GetFunctionTypeRegistered

func (self *VM) GetFunctionTypeRegistered(modname string, funcname string) *FunctionType

func (*VM) GetImportModule

func (self *VM) GetImportModule(host HostRegistration) *Module

func (*VM) GetLoader

func (self *VM) GetLoader() *Loader

func (*VM) GetStatistics

func (self *VM) GetStatistics() *Statistics

func (*VM) GetStore

func (self *VM) GetStore() *Store

func (*VM) GetValidator

func (self *VM) GetValidator() *Validator

func (*VM) Instantiate

func (self *VM) Instantiate() error

func (*VM) LoadWasmAST

func (self *VM) LoadWasmAST(ast *AST) error

func (*VM) LoadWasmBuffer

func (self *VM) LoadWasmBuffer(buf []byte) error

func (*VM) LoadWasmFile

func (self *VM) LoadWasmFile(path string) error

func (*VM) RegisterAST

func (self *VM) RegisterAST(modname string, ast *AST) error

func (*VM) RegisterModule

func (self *VM) RegisterModule(module *Module) error

func (*VM) RegisterWasmBuffer

func (self *VM) RegisterWasmBuffer(modname string, buf []byte) error

func (*VM) RegisterWasmFile

func (self *VM) RegisterWasmFile(modname string, path string) error

func (*VM) Release

func (self *VM) Release()

func (*VM) RunWasmAST

func (self *VM) RunWasmAST(ast *AST, funcname string, params ...interface{}) ([]interface{}, error)

func (*VM) RunWasmBuffer

func (self *VM) RunWasmBuffer(buf []byte, funcname string, params ...interface{}) ([]interface{}, error)

func (*VM) RunWasmFile

func (self *VM) RunWasmFile(path string, funcname string, params ...interface{}) ([]interface{}, error)

func (*VM) Validate

func (self *VM) Validate() error

type ValMut

func (ValMut) String

func (self ValMut) String() string

type ValType

type ValType C.enum_WasmEdge_ValType

func (ValType) String

func (self ValType) String() string

type Validator

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

func NewValidator

func NewValidator() *Validator

func NewValidatorWithConfig

func NewValidatorWithConfig(conf *Configure) *Validator

func (*Validator) Release

func (self *Validator) Release()

func (*Validator) Validate

func (self *Validator) Validate(ast *AST) error

Jump to

Keyboard shortcuts

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