Versions in this module Expand all Collapse all v3 v3.0.1 Dec 26, 2023 v3.0.0 Dec 23, 2022 Changes in this version + const ExportKindFunction + const ExportKindGlobal + const ExportKindMem + const ExportKindTable + var ErrInvalidByte = errors.New("invalid byte") + var ErrInvalidMagicNumber = errors.New("invalid magic number") + var ErrInvalidVersion = errors.New("invalid version header") + type BlockType = FunctionType + type CodeSegment struct + Body []byte + NumLocals uint32 + type ConstantExpression struct + type DataSegment struct + Init []byte + MemoryIndex uint32 + OffsetExpression *ConstantExpression + type ElementSegment struct + Init []uint32 + OffsetExpr *ConstantExpression + TableIndex uint32 + type ExportDesc struct + Index uint32 + Kind byte + type ExportSegment struct + Desc *ExportDesc + Name string + type FuncGas struct + Gas uint64 + Name string + type FunctionType struct + InputTypes []ValueType + ReturnTypes []ValueType + type Global struct + Type *GlobalType + Val interface{} + type GlobalSegment struct + Init *ConstantExpression + Type *GlobalType + type GlobalType struct + Mutable bool + Value ValueType + type HostFunction struct + ClosureGenerator func(vm *VirtualMachine) reflect.Value + Signature *FunctionType + func (h *HostFunction) Call(vm *VirtualMachine) + func (h *HostFunction) FunctionType() *FunctionType + type ImportDesc struct + GlobalTypePtr *GlobalType + Kind byte + MemTypePtr *MemoryType + TableTypePtr *TableType + TypeIndexPtr *uint32 + type ImportSegment struct + Desc *ImportDesc + Module string + Name string + type Label struct + Arity int + ContinuationPC uint64 + EndPC uint64 + type LimitsType struct + Max *uint32 + Min uint32 + type MemoryType = LimitsType + type Module struct + IndexSpace *ModuleIndexSpace + SecCodes []*CodeSegment + SecData []*DataSegment + SecElements []*ElementSegment + SecExports map[string]*ExportSegment + SecFunctions []uint32 + SecGlobals []*GlobalSegment + SecImports []*ImportSegment + SecMemory []*MemoryType + SecStart []uint32 + SecTables []*TableType + SecTypes []*FunctionType + func DecodeModule(r io.Reader) (*Module, error) + func (m *Module) BuildIndexSpaces(externModules map[string]*Module) error + func (m *Module) BuildIndexSpacesUsingOldNativeFunction(externModules map[string]*Module, nativeFunctions []VirtualMachineFunction) error + type ModuleIndexSpace struct + Function []VirtualMachineFunction + Globals []*Global + Memory [][]byte + Table [][]*uint32 + type NativeFunction struct + Blocks map[uint64]*NativeFunctionBlock + Body []byte + NumLocal uint32 + Signature *FunctionType + func (n *NativeFunction) Call(vm *VirtualMachine) + func (n *NativeFunction) FunctionType() *FunctionType + type NativeFunctionBlock struct + BlockType *FunctionType + BlockTypeBytes uint64 + ElseAt uint64 + EndAt uint64 + HasElse bool + StartAt uint64 + type NativeFunctionContext struct + Function *NativeFunction + LabelStack *VirtualMachineLabelStack + Locals []uint64 + PC uint64 + type OptCode byte + const OptCodeBlock + const OptCodeBr + const OptCodeBrIf + const OptCodeBrTable + const OptCodeCall + const OptCodeCallIndirect + const OptCodeDrop + const OptCodeElse + const OptCodeEnd + const OptCodeF32Const + const OptCodeF32Converti32s + const OptCodeF32Converti32u + const OptCodeF32Converti64s + const OptCodeF32Converti64u + const OptCodeF32Demotef64 + const OptCodeF32Load + const OptCodeF32Store + const OptCodeF32abs + const OptCodeF32add + const OptCodeF32ceil + const OptCodeF32copysign + const OptCodeF32div + const OptCodeF32eq + const OptCodeF32floor + const OptCodeF32ge + const OptCodeF32gt + const OptCodeF32le + const OptCodeF32lt + const OptCodeF32max + const OptCodeF32min + const OptCodeF32mul + const OptCodeF32ne + const OptCodeF32nearest + const OptCodeF32neg + const OptCodeF32reinterpreti32 + const OptCodeF32sqrt + const OptCodeF32sub + const OptCodeF32trunc + const OptCodeF64Const + const OptCodeF64Converti32s + const OptCodeF64Converti32u + const OptCodeF64Converti64s + const OptCodeF64Converti64u + const OptCodeF64Load + const OptCodeF64Promotef32 + const OptCodeF64Store + const OptCodeF64abs + const OptCodeF64add + const OptCodeF64ceil + const OptCodeF64copysign + const OptCodeF64div + const OptCodeF64eq + const OptCodeF64floor + const OptCodeF64ge + const OptCodeF64gt + const OptCodeF64le + const OptCodeF64lt + const OptCodeF64max + const OptCodeF64min + const OptCodeF64mul + const OptCodeF64ne + const OptCodeF64nearest + const OptCodeF64neg + const OptCodeF64reinterpreti64 + const OptCodeF64sqrt + const OptCodeF64sub + const OptCodeF64trunc + const OptCodeGlobalGet + const OptCodeGlobalSet + const OptCodeI32Const + const OptCodeI32Load + const OptCodeI32Load16s + const OptCodeI32Load16u + const OptCodeI32Load8s + const OptCodeI32Load8u + const OptCodeI32Store + const OptCodeI32Store16 + const OptCodeI32Store8 + const OptCodeI32add + const OptCodeI32and + const OptCodeI32clz + const OptCodeI32ctz + const OptCodeI32divs + const OptCodeI32divu + const OptCodeI32eq + const OptCodeI32eqz + const OptCodeI32ges + const OptCodeI32geu + const OptCodeI32gts + const OptCodeI32gtu + const OptCodeI32les + const OptCodeI32leu + const OptCodeI32lts + const OptCodeI32ltu + const OptCodeI32mul + const OptCodeI32ne + const OptCodeI32or + const OptCodeI32popcnt + const OptCodeI32reinterpretf32 + const OptCodeI32rems + const OptCodeI32remu + const OptCodeI32rotl + const OptCodeI32rotr + const OptCodeI32shl + const OptCodeI32shrs + const OptCodeI32shru + const OptCodeI32sub + const OptCodeI32truncf32s + const OptCodeI32truncf32u + const OptCodeI32truncf64s + const OptCodeI32truncf64u + const OptCodeI32wrapI64 + const OptCodeI32xor + const OptCodeI64Const + const OptCodeI64Extendi32s + const OptCodeI64Extendi32u + const OptCodeI64Load + const OptCodeI64Load16s + const OptCodeI64Load16u + const OptCodeI64Load32s + const OptCodeI64Load32u + const OptCodeI64Load8s + const OptCodeI64Load8u + const OptCodeI64Store + const OptCodeI64Store16 + const OptCodeI64Store32 + const OptCodeI64Store8 + const OptCodeI64TruncF32s + const OptCodeI64TruncF32u + const OptCodeI64Truncf64s + const OptCodeI64Truncf64u + const OptCodeI64add + const OptCodeI64and + const OptCodeI64clz + const OptCodeI64ctz + const OptCodeI64divs + const OptCodeI64divu + const OptCodeI64eq + const OptCodeI64eqz + const OptCodeI64ges + const OptCodeI64geu + const OptCodeI64gts + const OptCodeI64gtu + const OptCodeI64les + const OptCodeI64leu + const OptCodeI64lts + const OptCodeI64ltu + const OptCodeI64mul + const OptCodeI64ne + const OptCodeI64or + const OptCodeI64popcnt + const OptCodeI64reinterpretf64 + const OptCodeI64rems + const OptCodeI64remu + const OptCodeI64rotl + const OptCodeI64rotr + const OptCodeI64shl + const OptCodeI64shrs + const OptCodeI64shru + const OptCodeI64sub + const OptCodeI64xor + const OptCodeIf + const OptCodeLocalGet + const OptCodeLocalSet + const OptCodeLocalTee + const OptCodeLoop + const OptCodeMemoryGrow + const OptCodeMemorySize + const OptCodeNop + const OptCodeReturn + const OptCodeSelect + const OptCodeUnreachable + type SectionID byte + const SectionIDCode + const SectionIDCustom + const SectionIDData + const SectionIDElement + const SectionIDExport + const SectionIDFunction + const SectionIDGlobal + const SectionIDImport + const SectionIDMemory + const SectionIDStart + const SectionIDTable + const SectionIDType + type TableType struct + Elem byte + Limit *LimitsType + type ValueType byte + const ValueTypeF32 + const ValueTypeF64 + const ValueTypeI32 + const ValueTypeI64 + type VirtualMachine struct + ActiveContext *NativeFunctionContext + Depth int + EndTime uint64 + Functions []VirtualMachineFunction + Gas uint64 + GasLimit uint64 + GasMap map[string]uint64 + Globals []uint64 + InnerModule *Module + Memory []byte + OperandStack *VirtualMachineOperandStack + RuntimeData interface{} + StartTime uint64 + TimeLimit uint64 + func NewVM(module *Module, gasUsed uint64, gasLimit uint64, timeLimit uint64) (*VirtualMachine, error) + func (vm *VirtualMachine) AddGas(op OptCode) + func (vm *VirtualMachine) CalculateTime() + func (vm *VirtualMachine) ExecExportedFunction(name string, args ...uint64) (returns []uint64, returnTypes []ValueType, err error) + func (vm *VirtualMachine) FetchFloat32() float32 + func (vm *VirtualMachine) FetchFloat64() float64 + func (vm *VirtualMachine) FetchInt32() int32 + func (vm *VirtualMachine) FetchInt64() int64 + func (vm *VirtualMachine) FetchUint32() uint32 + func (vm *VirtualMachine) SetGasLimit(limit uint64) + func (vm *VirtualMachine) SetGasTable(gasMap map[string]uint64) + func (vm *VirtualMachine) SetTimeLimit(limit uint64) + type VirtualMachineFunction interface + Call func(vm *VirtualMachine) + FunctionType func() *FunctionType + type VirtualMachineLabelStack struct + SP int + Stack []*Label + func NewVirtualMachineLabelStack() *VirtualMachineLabelStack + func (s *VirtualMachineLabelStack) Pop() *Label + func (s *VirtualMachineLabelStack) Push(val *Label) + type VirtualMachineOperandStack struct + SP int + Stack []uint64 + func NewVirtualMachineOperandStack() *VirtualMachineOperandStack + func (s *VirtualMachineOperandStack) Drop() + func (s *VirtualMachineOperandStack) Peek() uint64 + func (s *VirtualMachineOperandStack) Pop() uint64 + func (s *VirtualMachineOperandStack) Push(val uint64) + func (s *VirtualMachineOperandStack) PushBool(b bool) Other modules containing this package chainmaker.org/chainmaker/vm-gasm/v2