compiler: adds support for FunctionListeners (#869)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
This commit is contained in:
@@ -3,13 +3,15 @@ package wasm
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/tetratelabs/wazero/experimental"
|
||||
)
|
||||
|
||||
// Engine is a Store-scoped mechanism to compile functions declared or imported by a module.
|
||||
// This is a top-level type implemented by an interpreter or compiler.
|
||||
type Engine interface {
|
||||
// CompileModule implements the same method as documented on wasm.Engine.
|
||||
CompileModule(ctx context.Context, module *Module) error
|
||||
CompileModule(ctx context.Context, module *Module, listeners []experimental.FunctionListener) error
|
||||
|
||||
// CompiledModuleCount is exported for testing, to track the size of the compilation cache.
|
||||
CompiledModuleCount() uint32
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/tetratelabs/wazero/api"
|
||||
"github.com/tetratelabs/wazero/experimental"
|
||||
"github.com/tetratelabs/wazero/internal/leb128"
|
||||
"github.com/tetratelabs/wazero/internal/sys"
|
||||
"github.com/tetratelabs/wazero/internal/testing/hammer"
|
||||
@@ -362,7 +363,9 @@ func newStore() (*Store, *Namespace) {
|
||||
}
|
||||
|
||||
// CompileModule implements the same method as documented on wasm.Engine.
|
||||
func (e *mockEngine) CompileModule(context.Context, *Module) error { return nil }
|
||||
func (e *mockEngine) CompileModule(context.Context, *Module, []experimental.FunctionListener) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// LookupFunction implements the same method as documented on wasm.Engine.
|
||||
func (e *mockModuleEngine) LookupFunction(*TableInstance, FunctionTypeID, Index) (Index, error) {
|
||||
|
||||
Reference in New Issue
Block a user