package vs

import "github.com/tetratelabs/wazero/internal/integration_test/vs"

Index

Functions

func RunBenchmarkAllocation

func RunBenchmarkAllocation(b *testing.B, runtime func() Runtime)

func RunBenchmarkFactorial

func RunBenchmarkFactorial(b *testing.B, runtime func() Runtime)

func RunBenchmarkHostCall

func RunBenchmarkHostCall(b *testing.B, runtime func() Runtime)

func RunBenchmarkMemory

func RunBenchmarkMemory(b *testing.B, runtime func() Runtime)

func RunBenchmarkShorthash

func RunBenchmarkShorthash(b *testing.B, runtime func() Runtime)

func RunTestAllocation

func RunTestAllocation(t *testing.T, runtime func() Runtime)

func RunTestBenchmarkAllocation_Call_CompilerFastest

func RunTestBenchmarkAllocation_Call_CompilerFastest(t *testing.T, vsRuntime Runtime)

func RunTestBenchmarkFactorial_Call_CompilerFastest

func RunTestBenchmarkFactorial_Call_CompilerFastest(t *testing.T, vsRuntime Runtime)

func RunTestBenchmarkHostCall_CompilerFastest

func RunTestBenchmarkHostCall_CompilerFastest(t *testing.T, vsRuntime Runtime)

func RunTestBenchmarkMemory_CompilerFastest

func RunTestBenchmarkMemory_CompilerFastest(t *testing.T, vsRuntime Runtime)

func RunTestFactorial

func RunTestFactorial(t *testing.T, runtime func() Runtime)

func RunTestHostCall

func RunTestHostCall(t *testing.T, runtime func() Runtime)

func RunTestMemory

func RunTestMemory(t *testing.T, runtime func() Runtime)

func RunTestShorthash

func RunTestShorthash(t *testing.T, runtime func() Runtime)

Types

type Module

type Module interface {
	CallI32_I32(ctx context.Context, funcName string, param uint32) (uint32, error)
	CallI32I32_V(ctx context.Context, funcName string, x, y uint32) error
	CallI32_V(ctx context.Context, funcName string, param uint32) error
	CallV_V(ctx context.Context, funcName string) error
	CallI64_I64(ctx context.Context, funcName string, param uint64) (uint64, error)
	WriteMemory(offset uint32, bytes []byte) error
	Memory() []byte
	Close(context.Context) error
}

type Runtime

type Runtime interface {
	Name() string
	Compile(context.Context, *RuntimeConfig) error
	Instantiate(context.Context, *RuntimeConfig) (Module, error)
	Close(context.Context) error
}

func NewWazeroCompilerRuntime

func NewWazeroCompilerRuntime() Runtime

func NewWazeroInterpreterRuntime

func NewWazeroInterpreterRuntime() Runtime

type RuntimeConfig

type RuntimeConfig struct {
	Name              string
	ModuleName        string
	ModuleWasm        []byte
	FuncNames         []string
	NeedsWASI         bool
	NeedsMemoryExport bool
	// LogFn requires the implementation to export a function "env.log" which accepts i32i32_v.
	// The implementation invoke this with a byte slice allocated from the offset, length pair.
	// This function simulates a host function that logs a message.
	LogFn func([]byte) error
	// EnvFReturnValue is set to non-zero if we want the runtime to instantiate "env" module with the function "f"
	// which accepts one i64 value and returns the EnvFReturnValue as i64. This is mutually exclusive to LogFn.
	EnvFReturnValue uint64
}

Source Files

bench.go bench_allocation.go bench_factorial.go bench_hostcall.go bench_memory.go bench_shorthash.go runtime.go

Directories

PathSynopsis
internal/integration_test/vs/compiler
internal/integration_test/vs/interpreter
Version
v1.1.0
Published
May 1, 2023
Platform
linux/amd64
Imports
17 packages
Last checked
39 minutes ago

Tools for package owners.