memory

package
v0.0.0-...-67468a5 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: Apache-2.0, BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//VM_NIL_POINTER = math.MaxInt64
	VM_NIL_POINTER = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PType

type PType int
const (
	PInt8 PType = iota
	PInt16
	PInt32
	PInt64
	PFloat32
	PFloat64
	PString
	PStruct
	PUnkown
)

type TypeLength

type TypeLength struct {
	Ptype  PType
	Length int
}

type VMmemory

type VMmemory struct {
	Memory          []byte
	AllocedMemIdex  int
	PointedMemIndex int
	ParamIndex      int //args analyze pointer
	MemPoints       map[uint64]*TypeLength
}

func (*VMmemory) GetPointerMemSize

func (vm *VMmemory) GetPointerMemSize(addr uint64) int

return pointed memory size

func (*VMmemory) GetPointerMemory

func (vm *VMmemory) GetPointerMemory(addr uint64) ([]byte, error)

return pointed memory when wasm returns a pointer, call this function to get the pointed memory

func (*VMmemory) Malloc

func (vm *VMmemory) Malloc(size int) (int, error)

Alloc memory for base types, return the address in memory

func (*VMmemory) MallocPointer

func (vm *VMmemory) MallocPointer(size int, p_type PType) (int, error)

Alloc memory for pointer types, return the address in memory

func (*VMmemory) SetMemory

func (vm *VMmemory) SetMemory(val interface{}) (int, error)

set base types into memory, return address of memory

func (*VMmemory) SetPointerMemory

func (vm *VMmemory) SetPointerMemory(val interface{}) (int, error)

set pointer types into memory, return address of memory

func (*VMmemory) SetStructMemory

func (vm *VMmemory) SetStructMemory(val interface{}) (int, error)

set struct into memory , return address of memory

Jump to

Keyboard shortcuts

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