vs

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

README

VS

This directory contains tests which compare against other runtimes. As all known alternatives use CGO, this contains its own go.mod, as otherwise project dependencies are tainted and multi-platform tests more difficult to manage.

Examples of portability issues besides CGO

  • Wasmtime can only be used in amd64
  • Wasmer doesn't link on Windows

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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
}

Directories

Path Synopsis
wasmer module
wasmtime module

Jump to

Keyboard shortcuts

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