Versions in this module Expand all Collapse all v1 v1.1.2 Jul 4, 2022 v1.1.1 Apr 21, 2022 v1.1.0 Mar 30, 2022 v1.0.1 Mar 24, 2022 v1.0.0 Mar 14, 2022 Changes in this version + const DefaultCallStackSize + const DefaultMemBlockSize + const DefaultMemPoolCount + const DefaultMemTreeMaxPage + const DefaultMemoryPages + const DefaultPageSize + const DynamicMemoryPages + const JITCodeSizeThreshold + var EmptyPage = make([]byte, DefaultPageSize) + var GasTable = [256]Instruction + var LE = binary.LittleEndian + func ImportGasFunc(vm *VirtualMachine, frame *Frame) (uint64, error) + func ParseModuleAndFunc(code []byte, gasPolicy compiler.GasPolicy) (*compiler.Module, []compiler.InterpreterCode, error) + type DynamicModule struct + func CompileDynamicModule(source string) *DynamicModule + func (m *DynamicModule) Run(vm *VirtualMachine, ret *int64) int32 + type Execute func(vm *VirtualMachine) int64 + type Frame struct + Code []byte + Continuation int32 + FunctionID int + IP int + JITInfo interface{} + Locals []int64 + Regs []int64 + ReturnReg int + func (f *Frame) Destroy(vm *VirtualMachine) + func (f *Frame) Init(vm *VirtualMachine, functionID int, code compiler.InterpreterCode) + type FunctionImport struct + Execute Execute + GasCost GasCost + type GasCost func(vm *VirtualMachine) (uint64, error) + type ImportResolver interface + ResolveFunc func(module, field string) *FunctionImport + ResolveGlobal func(module, field string) int64 + type Instruction struct + Execute executionFunc + GasCost gasFunc + type MemBlock struct + FreeMem [][]byte + func NewMemBlock(size, pages int) *MemBlock + func (mb *MemBlock) Get() []byte + func (mb *MemBlock) Put(mem []byte) + type MemPool struct + func NewMemPool(count int, size int) *MemPool + func (mp *MemPool) Get(pages int) []byte + func (mp *MemPool) Put(mem []byte) + type Memory struct + Memory []byte + Size int + Start int + func (m *Memory) Free(offset int) error + func (m *Memory) Malloc(size int) int + func (m *Memory) Realloc(offset int, size int) int + type NopResolver struct + func (r *NopResolver) ResolveFunc(module, field string) *FunctionImport + func (r *NopResolver) ResolveGlobal(module, field string) int64 + type StateDB interface + AddLog func(address common.Address, topics []common.Hash, data []byte, bn uint64) + Address func() common.Address + BlockHash func(num uint64) common.Hash + BlockNumber func() *big.Int + Call func(addr, params []byte) ([]byte, error) + CallValue func() *big.Int + Caller func() common.Address + Coinbase func() common.Address + DelegateCall func(addr, params []byte) ([]byte, error) + GasLimimt func() uint64 + GasPrice func() int64 + GetBalance func(addr common.Address) *big.Int + GetCallerNonce func() int64 + GetCode func(addr common.Address) []byte + GetState func(key []byte) []byte + IsOwner func(contractAddress common.Address, accountAddress common.Address) int64 + Origin func() common.Address + SetState func(key []byte, value []byte) + Time func() *big.Int + Transfer func(addr common.Address, value *big.Int) (ret []byte, leftOverGas uint64, err error) + type TreePool struct + func NewTreePool(poolSize int, cacheSize int) *TreePool + func (tp *TreePool) GetTree(pages int) tree + func (tp *TreePool) PutTree(tree tree) + type VMConfig struct + DefaultMemoryPages int + DefaultTableSize int + DisableFree bool + DynamicMemoryPages int + EnableJIT bool + GasLimit uint64 + MaxCallStackDepth int + MaxMemoryPages int + MaxTableSize int + MaxValueSlots int + type VMContext struct + Addr [20]byte + Config VMConfig + GasLimit uint64 + GasUsed uint64 + Log log.Logger + StateDB StateDB + type VMMemory struct + Current int + MemPoints map[int]int + Memory []byte + Start int + type VirtualMachine struct + CallStack []Frame + Context *VMContext + CurrentFrame int + Delegate func() + ExitError interface{} + Exited bool + ExternalParams []int64 + FunctionCode []compiler.InterpreterCode + FunctionImports []*FunctionImport + Gas uint64 + Globals []int64 + InitEntryID int + InsideExecute bool + JumpTable [256]Instruction + Memory *Memory + Module *compiler.Module + NumValueSlots int + ReturnValue int64 + Table []uint32 + Yielded int64 + func NewVirtualMachine(code []byte, context *VMContext, impResolver ImportResolver, ...) (_retVM *VirtualMachine, retErr error) + func NewVirtualMachineWithModule(m *compiler.Module, functionCode []compiler.InterpreterCode, ...) (_retVM *VirtualMachine, retErr error) + func (vm *VirtualMachine) AddAndCheckGas(delta uint64) + func (vm *VirtualMachine) Execute() + func (vm *VirtualMachine) GenerateCodeForFunction(functionID int) bool + func (vm *VirtualMachine) GetCurrentFrame() *Frame + func (vm *VirtualMachine) GetFunctionExport(key string) (int, bool) + func (vm *VirtualMachine) GetGlobalExport(key string) (int, bool) + func (vm *VirtualMachine) Ignite(functionID int, params ...int64) + func (vm *VirtualMachine) PrintStackTrace() + func (vm *VirtualMachine) Run(entryID int, params ...int64) (int64, error) + func (vm *VirtualMachine) RunWithGasLimit(entryID, limit int, params ...int64) (int64, error) + func (vm *VirtualMachine) Stop() (err error)