Documentation
¶
Overview ¶
Package experimental includes features we aren't yet sure about. These are enabled with context.Context keys.
Note: All features here may be changed or deleted at any time, so use with caution!
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithCompilationCacheDirName ¶
WithCompilationCacheDirName configures the destination directory of the compilation cache. Regardless of the usage of this, the compiled functions are cached in memory, but its lifetime is bound to the lifetime of wazero.Runtime or wazero.CompiledModule.
If the dirname doesn't exist, this creates the directory.
With the given non-empty directory, wazero persists the cache into the directory and that cache will be used as long as the running wazero version match the version of compilation wazero.
A cache is only valid for use in one wazero.Runtime at a time. Concurrent use of a wazero.Runtime is supported, but multiple runtimes must not share the same directory.
Note: The embedder must safeguard this directory from external changes.
Usage:
ctx, _ := experimental.WithCompilationCacheDirName(context.Background(), "/home/me/.cache/wazero") r := wazero.NewRuntimeWithConfig(ctx, wazero.NewRuntimeConfigCompiler())
Types ¶
type FunctionListener ¶
type FunctionListener interface { // Before is invoked before a function is called. The returned context will // be used as the context of this function call. // // # Params // // - ctx: the context of the caller function which must be the same // instance or parent of the result. // - def: the function definition. // - paramValues: api.ValueType encoded parameters. Before(ctx context.Context, def api.FunctionDefinition, paramValues []uint64) context.Context // After is invoked after a function is called. // // # Params // // - ctx: the context returned by Before. // - def: the function definition. // - err: nil if the function didn't err // - resultValues: api.ValueType encoded results. After(ctx context.Context, def api.FunctionDefinition, err error, resultValues []uint64) }
FunctionListener can be registered for any function via FunctionListenerFactory to be notified when the function is called.
type FunctionListenerFactory ¶
type FunctionListenerFactory interface { // NewListener returns a FunctionListener for a defined function. If nil is // returned, no listener will be notified. NewListener(api.FunctionDefinition) FunctionListener }
FunctionListenerFactory returns FunctionListeners to be notified when a function is called.
type FunctionListenerFactoryKey ¶
type FunctionListenerFactoryKey struct{}
FunctionListenerFactoryKey is a context.Context Value key. Its associated value should be a FunctionListenerFactory.