Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeULeb128(value []byte) uint32
- func LoadCustomSections(data []byte) (map[string]CustomSection, int, error)
- func NewWasmtimeInstance(vm *VM, mod *Module) types.Instance
- func NewWasmtimeVM(id string) types.VM
- func ReadULEB128(data []byte) (int, int)
- type CustomSection
- type DwarfInfo
- type Instance
- func (i *Instance) Acquire() bool
- func (i *Instance) Call(name string, args ...interface{}) (interface{}, uint64, error)
- func (i *Instance) GetByte(addr int32) (byte, error)
- func (i *Instance) GetExportsFunc(name string) (types.Function, error)
- func (i *Instance) GetExportsMem(name string) ([]byte, error)
- func (i *Instance) GetMemory(addr, size int32) ([]byte, error)
- func (i *Instance) GetModule() types.Module
- func (i *Instance) GetUint32(addr int32) (uint32, error)
- func (i *Instance) GetUserdata() any
- func (i *Instance) HandleError(err error)
- func (i *Instance) ID() string
- func (i *Instance) Lock(data any)
- func (i *Instance) Malloc(size int32) (int32, error)
- func (i *Instance) PutByte(addr int32, v byte) error
- func (i *Instance) PutMemory(addr, size int32, data []byte) error
- func (i *Instance) PutUint32(addr int32, v uint32) error
- func (i *Instance) RegisterImports(name string) error
- func (i *Instance) Release()
- func (i *Instance) SetUserdata(data any)
- func (i *Instance) Start() error
- func (i *Instance) Started() bool
- func (i *Instance) Stop()
- func (i *Instance) Unlock()
- type Module
- type VM
Constants ¶
View Source
const ( SecCustom byte = 0 SecType byte = 1 SecImport byte = 2 SecFunction byte = 3 SecTable byte = 4 SecMemory byte = 5 SecGlobal byte = 6 SecExport byte = 7 SecStart byte = 8 SecElement byte = 9 SecCode byte = 10 SecData byte = 11 )
View Source
const MaxFuelInStore = 10240000
Variables ¶
View Source
var ( ErrInvalidWasmCode = errors.New("invalid wasm code") ErrFailedToNewWasmModule = errors.New("failed to new wasm module") ErrInstanceNotStarted = errors.New("instance not started") ErrInvalidExportFunc = errors.New("invalid export func") ErrInvalidExportMem = errors.New("invalid export memory") ErrInvalidImportFunc = errors.New("invalid import func") ErrMemAccessOverflow = errors.New("memory access overflow") ErrUnknownABIName = errors.New("unknown abi name") )
Functions ¶
func DecodeULeb128 ¶
DecodeULeb128 decodes an unsigned LEB128 value to an unsigned int32 value. Returns the result as a uint32.
func LoadCustomSections ¶
func LoadCustomSections(data []byte) (map[string]CustomSection, int, error)
func ReadULEB128 ¶
ReadULEB128 read a uLEB128 at the starting position. Returns (number read, number of bytes read).
Types ¶
type CustomSection ¶
type CustomSection struct {
// contains filtered or unexported fields
}
func NewCustomSection ¶
func NewCustomSection(data []byte) CustomSection
NewCustomSection properly read name and data from a custom section.
type DwarfInfo ¶
type DwarfInfo struct {
// contains filtered or unexported fields
}
func ParseDwarf ¶
func (*DwarfInfo) GetLineReader ¶
func (d *DwarfInfo) GetLineReader() *dwarf.LineReader
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
func (*Instance) GetExportsFunc ¶
func (*Instance) GetUserdata ¶
func (*Instance) HandleError ¶
func (*Instance) RegisterImports ¶
func (*Instance) SetUserdata ¶
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
func NewWasmtimeModule ¶
NewWasmtimeModule
func (*Module) GetABINameList ¶
func (*Module) NewInstance ¶
Click to show internal directories.
Click to hide internal directories.