Documentation ¶
Overview ¶
modified from https://github.com/ontio/ontology-wasm
Index ¶
- type PointerType
- type TypeLength
- type VMemory
- func (vm *VMemory) GetPointerMemSize(addr uint64) int
- func (vm *VMemory) GetPointerMemory(addr uint64) ([]byte, error)
- func (vm *VMemory) Grow(size uint64)
- func (vm *VMemory) Length() int
- func (vm *VMemory) Malloc(size int) (int, error)
- func (vm *VMemory) MallocPointer(size int, pType PointerType) (int, error)
- func (vm *VMemory) MemSet(dest int, ch int, count int) (int, error)
- func (vm *VMemory) SetMemory(val interface{}) (int, error)
- func (vm *VMemory) SetPointerMemory(val interface{}) (int, error)
- func (vm *VMemory) SetStructMemory(val interface{}) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PointerType ¶
type PointerType int
const ( PInt8 PointerType = iota PInt16 PInt32 PInt64 PFloat32 PFloat64 PString PStruct PUnknown )
type TypeLength ¶
type TypeLength struct { Type PointerType Length int }
type VMemory ¶
type VMemory struct { Memory []byte // linear memory AllocatedMemIndex int // index of allocated memory PointedMemIndex int //for the pointed objects,string,array,structs ParamIndex int MemPoints map[uint64]*TypeLength }
func NewVMemory ¶
func (*VMemory) GetPointerMemSize ¶
GetPointerMemSize return pointed memory size
func (*VMemory) GetPointerMemory ¶
GetPointerMemory return pointed memory data of the address when wasm returns a pointer, call this function to get the pointed memory
func (*VMemory) MallocPointer ¶
func (vm *VMemory) MallocPointer(size int, pType PointerType) (int, error)
MallocPointer malloc memory for pointer types, return the address in memory
func (*VMemory) SetPointerMemory ¶
SetPointerMemory set pointer types into memory, return address of memory
func (*VMemory) SetStructMemory ¶
SetStructMemory set struct into memory , return address of memory
Click to show internal directories.
Click to hide internal directories.