wasm

package
v0.0.0-...-10d2010 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CodeCache, _ = lru.NewARC(codeCacheSize)

Functions

func CallOutputLength

func CallOutputLength(proc *exec.Process) uint32

func Debug

func Debug(proc *exec.Process, ptr uint32, len uint32)

func GetCallOutput

func GetCallOutput(proc *exec.Process, dst uint32)

func GetInput

func GetInput(proc *exec.Process, dst uint32)

func InputLength

func InputLength(proc *exec.Process) uint32

func NewHostModule

func NewHostModule() *wasm.Module

func RaiseException

func RaiseException(proc *exec.Process, ptr uint32, len uint32)

func ReadWasmMemory

func ReadWasmMemory(proc *exec.Process, ptr uint32, len uint32) ([]byte, error)

func ReadWasmModule

func ReadWasmModule(Code []byte, verify bool) (*exec.CompiledModule, error)

func Ret

func Ret(proc *exec.Process, ptr uint32, len uint32)

func Sha256

func Sha256(proc *exec.Process, src uint32, slen uint32, dst uint32)

func VerifyWasmModule

func VerifyWasmModule(wasmCode []byte) error

func VmRpc

func VmRpc(proc *exec.Process, src uint32, slen uint32) uint32

vmrpc is used to make vm to communicate with host env. the format is : req-> {"version": 0, "method": "add", "params":jsonval } response <- jsonresult

Types

type Address

type Address [32]byte

func AddressFromCode

func AddressFromCode(code []byte) Address

func (Address) ToHex

func (self Address) ToHex() string

type ExecEnv

type ExecEnv struct {
	Service *WasmService
}

type Executor

type Executor struct {
	//Input    []byte
	GasLimit uint64
	ExecStep uint64

	Env *ExecEnv
	// contains filtered or unexported fields
}

func NewExecutor

func NewExecutor(gasLimit, stepLimit uint64, env *ExecEnv) *Executor

func (*Executor) Invoke

func (self *Executor) Invoke(input, wasmCode []byte) (*types.ScoreResult, error)

type HostModuleBuilder

type HostModuleBuilder struct {
	// contains filtered or unexported fields
}

func NewHostModuleBuilder

func NewHostModuleBuilder() *HostModuleBuilder

func (*HostModuleBuilder) AppendFunc

func (self *HostModuleBuilder) AppendFunc(name string, fn interface{}) error

func (*HostModuleBuilder) Finish

func (self *HostModuleBuilder) Finish() *wasm.Module

type Runtime

type Runtime struct {
	Input      []byte
	Output     []byte
	CallOutput []byte
	Env        *ExecEnv
	// contains filtered or unexported fields
}

type WasmService

type WasmService struct {
	// contains filtered or unexported fields
}

func NewWasmService

func NewWasmService() *WasmService

func (*WasmService) Call

func (self *WasmService) Call(method string, argv interface{}, reply interface{}) error

func (*WasmService) HandleWasmRequest

func (self *WasmService) HandleWasmRequest(req []byte) (rep []byte, err error)

func (*WasmService) Register

func (self *WasmService) Register(name string, fnval interface{}) error

fnval must be a func with signature: func (req T, reply *O) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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