Repository: tetratelabs/wazero
Pull request #1871 (2023-12-13 23:22:00)

wasi: Handle EFBIG from OS on`fd_filestat_set_size`
This commit handles potential `EFBIG` returned from the OS and maps it to WASI's `fbig`.  It also fixes an integer truncation bug in the `fd_filestat_set_size` handler.

fixes https://github.com/tetratelabs/wazero/issues/1870


Patch:
diff --git a/cmd/wazero/wazero.go b/cmd/wazero/wazero.go
index b92a910a..6bb6bb0e 100644
--- a/cmd/wazero/wazero.go
+++ b/cmd/wazero/wazero.go
@@ -20,6 +20,7 @@ import (
 	"github.com/tetratelabs/wazero/experimental"
 	"github.com/tetratelabs/wazero/experimental/gojs"
 	"github.com/tetratelabs/wazero/experimental/logging"
+	"github.com/tetratelabs/wazero/experimental/opt"
 	"github.com/tetratelabs/wazero/experimental/sock"
 	"github.com/tetratelabs/wazero/experimental/sysfs"
 	"github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1"
@@ -161,6 +162,10 @@ func doRun(args []string, stdOut io.Writer, stdErr logging.Writer) int {
 	flags.BoolVar(&useInterpreter, "interpreter", false,
 		"Interprets WebAssembly modules instead of compiling them into native code.")
 
+	var useOptimizingCompiler bool
+	flags.BoolVar(&useOptimizingCompiler, "optimizing-compiler", false,
+		"[Experimental] Compiles WebAssembly modules using the optimizing compiler.")
+
 	var envs sliceFlag
 	flags.Var(&envs, "env", "key=value pair of environment variable to expose to the binary. "+
 		"Can be specified multiple times.")
@@ -269,6 +274,8 @@ func doRun(args []string, stdOut io.Writer, stdErr logging.Writer) int {
 	var rtc wazero.RuntimeConfig
 	if useInterpreter {
 		rtc = wazero.NewRuntimeConfigInterpreter()
+	} else if useOptimizingCompiler {
+		rtc = opt.NewRuntimeConfigOptimizingCompiler()
 	} else {
 		rtc = wazero.NewRuntimeConfig()
 	}
diff --git a/config.go b/config.go
index 70219b05..00e22303 100644
--- a/config.go
+++ b/config.go
@@ -14,6 +14,7 @@ import (
 	experimentalsys "github.com/tetratelabs/wazero/experimental/sys"
 	"github.com/tetratelabs/wazero/internal/engine/compiler"
 	"github.com/tetratelabs/wazero/internal/engine/interpreter"
+	"github.com/tetratelabs/wazero/internal/engine/wazevo"
 	"github.com/tetratelabs/wazero/internal/filecache"
 	"github.com/tetratelabs/wazero/internal/internalapi"
 	"github.com/tetratelabs/wazero/internal/platform"
@@ -190,6 +191,11 @@ type runtimeConfig struct {
 	ensureTermination     bool
 }
 
+// EnableOptimizingCompiler implements experimental/opt/enabler.EnableOptimizingCompiler.
+func (c *runtimeConfig) EnableOptimizingCompiler() {
+	c.newEngine = wazevo.NewEngine
+}
+
 // engineLessConfig helps avoid copy/pasting the wrong defaults.
 var engineLessConfig = &runtimeConfig{
 	enabledFeatures:       api.CoreFeaturesV2,
diff --git a/experimental/opt/opt.go b/experimental/opt/opt.go
new file mode 100644
index 00000000..ecffb001
--- /dev/null
+++ b/experimental/opt/opt.go
@@ -0,0 +1,23 @@
+package opt
+
+import (
+	"runtime"
+
+	"github.com/tetratelabs/wazero"
+)
+
+type enabler interface {
+	// EnableOptimizingCompiler enables the optimizing compiler.
+	// This is only implemented the internal type of wazero.runtimeConfig.
+	EnableOptimizingCompiler()
+}
+
+// NewRuntimeConfigOptimizingCompiler returns a new RuntimeConfig with the optimizing compiler enabled.
+func NewRuntimeConfigOptimizingCompiler() wazero.RuntimeConfig {
+	if runtime.GOARCH != "arm64" {
+		panic("UseOptimizingCompiler is only supported on arm64")
+	}
+	c := wazero.NewRuntimeConfig()
+	c.(enabler).EnableOptimizingCompiler()
+	return c
+}
diff --git a/imports/wasi_snapshot_preview1/fs.go b/imports/wasi_snapshot_preview1/fs.go
index 9d28ae17..384036a2 100644
--- a/imports/wasi_snapshot_preview1/fs.go
+++ b/imports/wasi_snapshot_preview1/fs.go
@@ -464,7 +464,7 @@ var fdFilestatSetSize = newHostFunc(wasip1.FdFilestatSetSizeName, fdFilestatSetS
 
 func fdFilestatSetSizeFn(_ context.Context, mod api.Module, params []uint64) experimentalsys.Errno {
 	fd := int32(params[0])
-	size := uint32(params[1])
+	size := int64(params[1])
 
 	fsc := mod.(*wasm.ModuleInstance).Sys.FS()
 
@@ -472,7 +472,7 @@ func fdFilestatSetSizeFn(_ context.Context, mod api.Module, params []uint64) exp
 	if f, ok := fsc.LookupFile(fd); !ok {
 		return experimentalsys.EBADF
 	} else {
-		return f.File.Truncate(int64(size))
+		return f.File.Truncate(size)
 	}
 }
 
diff --git a/internal/engine/wazevo/config.go b/internal/engine/wazevo/config.go
deleted file mode 100644
index 7b009c64..00000000
--- a/internal/engine/wazevo/config.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package wazevo
-
-import (
-	"context"
-	"unsafe"
-
-	"github.com/tetratelabs/wazero"
-	"github.com/tetratelabs/wazero/api"
-	"github.com/tetratelabs/wazero/internal/filecache"
-	"github.com/tetratelabs/wazero/internal/wasm"
-)
-
-// ConfigureWazevo modifies wazero.RuntimeConfig and sets the wazevo implementation.
-// This is a hack to avoid modifying outside the wazevo package while testing it end-to-end.
-//
-// Until we expose it in the experimental public API, use this for internal testing.
-func ConfigureWazevo(config wazero.RuntimeConfig) {
-	// This is the internal representation of interface in Go.
-	// https://research.swtch.com/interfaces
-	type iface struct {
-		_    *byte
-		data unsafe.Pointer
-	}
-
-	configInterface := (*iface)(unsafe.Pointer(&config))
-
-	// This corresponds to the unexported wazero.runtimeConfig, and the target field newEngine exists
-	// in the middle of the implementation.
-	type newEngine func(context.Context, api.CoreFeatures, filecache.Cache) wasm.Engine
-	type runtimeConfig struct {
-		enabledFeatures       api.CoreFeatures
-		memoryLimitPages      uint32
-		memoryCapacityFromMax bool
-		engineKind            int
-		dwarfDisabled         bool
-		newEngine
-		// Other fields follow, but we don't care.
-	}
-	cm := (*runtimeConfig)(configInterface.data)
-	// Insert the wazevo implementation.
-	cm.newEngine = NewEngine
-}


Test patch:
diff --git a/experimental/opt/opt_test.go b/experimental/opt/opt_test.go
new file mode 100644
index 00000000..5b75f3ff
--- /dev/null
+++ b/experimental/opt/opt_test.go
@@ -0,0 +1,20 @@
+package opt_test
+
+import (
+	"context"
+	"runtime"
+	"testing"
+
+	"github.com/tetratelabs/wazero"
+	"github.com/tetratelabs/wazero/experimental/opt"
+	"github.com/tetratelabs/wazero/internal/testing/require"
+)
+
+func TestUseOptimizingCompiler(t *testing.T) {
+	if runtime.GOARCH != "arm64" {
+		return
+	}
+	c := opt.NewRuntimeConfigOptimizingCompiler()
+	r := wazero.NewRuntimeWithConfig(context.Background(), c)
+	require.NoError(t, r.Close(context.Background()))
+}
diff --git a/imports/wasi_snapshot_preview1/fs_test.go b/imports/wasi_snapshot_preview1/fs_test.go
index 6cae4d0d..301ce648 100644
--- a/imports/wasi_snapshot_preview1/fs_test.go
+++ b/imports/wasi_snapshot_preview1/fs_test.go
@@ -835,7 +835,7 @@ func Test_fdFilestatSetSize(t *testing.T) {
 
 	tests := []struct {
 		name                     string
-		size                     uint32
+		size                     uint64
 		content, expectedContent []byte
 		expectedLog              string
 		expectedErrno            wasip1.Errno
@@ -881,6 +881,17 @@ func Test_fdFilestatSetSize(t *testing.T) {
 			expectedLog: `
 ==> wasi_snapshot_preview1.fd_filestat_set_size(fd=4,size=106)
 <== errno=ESUCCESS
+`,
+		},
+		{
+			name:            "large size",
+			content:         []byte(""),
+			expectedContent: []byte(""),
+			size:            math.MaxUint64,
+			expectedErrno:   wasip1.ErrnoInval,
+			expectedLog: `
+==> wasi_snapshot_preview1.fd_filestat_set_size(fd=4,size=-1)
+<== errno=EINVAL
 `,
 		},
 	}
diff --git a/internal/engine/wazevo/e2e_test.go b/internal/engine/wazevo/e2e_test.go
index 7b057851..b8152b43 100644
--- a/internal/engine/wazevo/e2e_test.go
+++ b/internal/engine/wazevo/e2e_test.go
@@ -12,7 +12,7 @@ import (
 	"github.com/tetratelabs/wazero/api"
 	"github.com/tetratelabs/wazero/experimental"
 	"github.com/tetratelabs/wazero/experimental/logging"
-	"github.com/tetratelabs/wazero/internal/engine/wazevo"
+	"github.com/tetratelabs/wazero/experimental/opt"
 	"github.com/tetratelabs/wazero/internal/engine/wazevo/testcases"
 	"github.com/tetratelabs/wazero/internal/leb128"
 	"github.com/tetratelabs/wazero/internal/testing/binaryencoding"
@@ -308,10 +308,7 @@ func TestE2E(t *testing.T) {
 				t.Run(name, func(t *testing.T) {
 					cache, err := wazero.NewCompilationCacheWithDir(tmp)
 					require.NoError(t, err)
-					config := wazero.NewRuntimeConfigCompiler().WithCompilationCache(cache)
-
-					// Configure the new optimizing backend!
-					wazevo.ConfigureWazevo(config)
+					config := opt.NewRuntimeConfigOptimizingCompiler().WithCompilationCache(cache)
 
 					ctx := context.Background()
 					r := wazero.NewRuntimeWithConfig(ctx, config)
@@ -377,10 +374,7 @@ func TestE2E_host_functions(t *testing.T) {
 		t.Run(tc.name, func(t *testing.T) {
 			ctx := tc.ctx
 
-			config := wazero.NewRuntimeConfigCompiler()
-
-			// Configure the new optimizing backend!
-			wazevo.ConfigureWazevo(config)
+			config := opt.NewRuntimeConfigOptimizingCompiler()
 
 			r := wazero.NewRuntimeWithConfig(ctx, config)
 			defer func() {
@@ -462,10 +456,7 @@ func TestE2E_host_functions(t *testing.T) {
 }
 
 func TestE2E_stores(t *testing.T) {
-	config := wazero.NewRuntimeConfigCompiler()
-
-	// Configure the new optimizing backend!
-	wazevo.ConfigureWazevo(config)
+	config := opt.NewRuntimeConfigOptimizingCompiler()
 
 	ctx := context.Background()
 	r := wazero.NewRuntimeWithConfig(ctx, config)
@@ -552,10 +543,7 @@ func TestE2E_reexported_memory(t *testing.T) {
 		CodeSection:       []wasm.Code{{Body: []byte{wasm.OpcodeI32Const, 10, wasm.OpcodeMemoryGrow, 0, wasm.OpcodeEnd}}},
 	}
 
-	config := wazero.NewRuntimeConfigCompiler()
-
-	// Configure the new optimizing backend!
-	wazevo.ConfigureWazevo(config)
+	config := opt.NewRuntimeConfigOptimizingCompiler()
 
 	ctx := context.Background()
 	r := wazero.NewRuntimeWithConfig(ctx, config)
@@ -604,10 +592,7 @@ func TestStackUnwind_panic_in_host(t *testing.T) {
 		},
 	}
 
-	config := wazero.NewRuntimeConfigCompiler()
-
-	// Configure the new optimizing backend!
-	wazevo.ConfigureWazevo(config)
+	config := opt.NewRuntimeConfigOptimizingCompiler()
 
 	ctx := context.Background()
 	r := wazero.NewRuntimeWithConfig(ctx, config)
@@ -657,11 +642,7 @@ func TestStackUnwind_unreachable(t *testing.T) {
 		},
 	}
 
-	config := wazero.NewRuntimeConfigCompiler()
-
-	// Configure the new optimizing backend!
-	wazevo.ConfigureWazevo(config)
-
+	config := opt.NewRuntimeConfigOptimizingCompiler()
 	ctx := context.Background()
 	r := wazero.NewRuntimeWithConfig(ctx, config)
 	defer func() {
@@ -683,12 +664,9 @@ wasm stack trace:
 
 func TestListener_local(t *testing.T) {
 	var buf bytes.Buffer
-	config := wazero.NewRuntimeConfigCompiler()
+	config := opt.NewRuntimeConfigOptimizingCompiler()
 	ctx := context.WithValue(context.Background(), experimental.FunctionListenerFactoryKey{}, logging.NewLoggingListenerFactory(&buf))
 
-	// Configure the new optimizing backend!
-	wazevo.ConfigureWazevo(config)
-
 	r := wazero.NewRuntimeWithConfig(ctx, config)
 	defer func() {
 		require.NoError(t, r.Close(ctx))
@@ -714,12 +692,9 @@ func TestListener_local(t *testing.T) {
 
 func TestListener_imported(t *testing.T) {
 	var buf bytes.Buffer
-	config := wazero.NewRuntimeConfigCompiler()
+	config := opt.NewRuntimeConfigOptimizingCompiler()
 	ctx := context.WithValue(context.Background(), experimental.FunctionListenerFactoryKey{}, logging.NewLoggingListenerFactory(&buf))
 
-	// Configure the new optimizing backend!
-	wazevo.ConfigureWazevo(config)
-
 	r := wazero.NewRuntimeWithConfig(ctx, config)
 	defer func() {
 		require.NoError(t, r.Close(ctx))
@@ -768,12 +743,9 @@ func TestListener_long(t *testing.T) {
 	})
 
 	var buf bytes.Buffer
-	config := wazero.NewRuntimeConfigCompiler()
+	config := opt.NewRuntimeConfigOptimizingCompiler()
 	ctx := context.WithValue(context.Background(), experimental.FunctionListenerFactoryKey{}, logging.NewLoggingListenerFactory(&buf))
 
-	// Configure the new optimizing backend!
-	wazevo.ConfigureWazevo(config)
-
 	r := wazero.NewRuntimeWithConfig(ctx, config)
 	defer func() {
 		require.NoError(t, r.Close(ctx))
@@ -821,12 +793,9 @@ func TestListener_long_as_is(t *testing.T) {
 	})
 
 	var buf bytes.Buffer
-	config := wazero.NewRuntimeConfigCompiler()
+	config := opt.NewRuntimeConfigOptimizingCompiler()
 	ctx := context.WithValue(context.Background(), experimental.FunctionListenerFactoryKey{}, logging.NewLoggingListenerFactory(&buf))
 
-	// Configure the new optimizing backend!
-	wazevo.ConfigureWazevo(config)
-
 	r := wazero.NewRuntimeWithConfig(ctx, config)
 	defer func() {
 		require.NoError(t, r.Close(ctx))
@@ -873,12 +842,9 @@ func TestListener_long_many_consts(t *testing.T) {
 	})
 
 	var buf bytes.Buffer
-	config := wazero.NewRuntimeConfigCompiler()
+	config := opt.NewRuntimeConfigOptimizingCompiler()
 	ctx := context.WithValue(context.Background(), experimental.FunctionListenerFactoryKey{}, logging.NewLoggingListenerFactory(&buf))
 
-	// Configure the new optimizing backend!
-	wazevo.ConfigureWazevo(config)
-
 	r := wazero.NewRuntimeWithConfig(ctx, config)
 	defer func() {
 		require.NoError(t, r.Close(ctx))
@@ -901,12 +867,9 @@ func TestListener_long_many_consts(t *testing.T) {
 
 // TestDWARF verifies that the DWARF based stack traces work as expected before/after compilation cache.
 func TestDWARF(t *testing.T) {
-	config := wazero.NewRuntimeConfigCompiler()
+	config := opt.NewRuntimeConfigOptimizingCompiler()
 	ctx := context.Background()
 
-	// Configure the new optimizing backend!
-	wazevo.ConfigureWazevo(config)
-
 	bin := dwarftestdata.ZigWasm
 
 	dir := t.TempDir()
diff --git a/internal/integration_test/engine/adhoc_test.go b/internal/integration_test/engine/adhoc_test.go
index 823e0ca2..7d55fd05 100644
--- a/internal/integration_test/engine/adhoc_test.go
+++ b/internal/integration_test/engine/adhoc_test.go
@@ -18,8 +18,8 @@ import (
 	"github.com/tetratelabs/wazero/api"
 	"github.com/tetratelabs/wazero/experimental"
 	"github.com/tetratelabs/wazero/experimental/logging"
+	"github.com/tetratelabs/wazero/experimental/opt"
 	"github.com/tetratelabs/wazero/experimental/table"
-	"github.com/tetratelabs/wazero/internal/engine/wazevo"
 	"github.com/tetratelabs/wazero/internal/leb128"
 	"github.com/tetratelabs/wazero/internal/platform"
 	"github.com/tetratelabs/wazero/internal/testing/binaryencoding"
@@ -96,8 +96,7 @@ func TestEngineWazevo(t *testing.T) {
 	if runtime.GOARCH != "arm64" {
 		t.Skip()
 	}
-	config := wazero.NewRuntimeConfigInterpreter()
-	wazevo.ConfigureWazevo(config)
+	config := opt.NewRuntimeConfigOptimizingCompiler()
 	runAllTests(t, tests, config.WithCloseOnContextDone(true), true)
 }
 
diff --git a/internal/integration_test/engine/dwarf_test.go b/internal/integration_test/engine/dwarf_test.go
index cc93e4f6..561ac5c7 100644
--- a/internal/integration_test/engine/dwarf_test.go
+++ b/internal/integration_test/engine/dwarf_test.go
@@ -8,8 +8,8 @@ import (
 	"testing"
 
 	"github.com/tetratelabs/wazero"
+	"github.com/tetratelabs/wazero/experimental/opt"
 	"github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1"
-	"github.com/tetratelabs/wazero/internal/engine/wazevo"
 	"github.com/tetratelabs/wazero/internal/platform"
 	"github.com/tetratelabs/wazero/internal/testing/dwarftestdata"
 	"github.com/tetratelabs/wazero/internal/testing/require"
@@ -37,8 +37,7 @@ func TestEngineWazevo_DWARF(t *testing.T) {
 	if runtime.GOARCH != "arm64" {
 		t.Skip()
 	}
-	config := wazero.NewRuntimeConfigInterpreter()
-	wazevo.ConfigureWazevo(config)
+	config := opt.NewRuntimeConfigOptimizingCompiler()
 	runAllTests(t, dwarfTests, config, true)
 }
 
diff --git a/internal/integration_test/engine/hammer_test.go b/internal/integration_test/engine/hammer_test.go
index eb360a06..4e70ad36 100644
--- a/internal/integration_test/engine/hammer_test.go
+++ b/internal/integration_test/engine/hammer_test.go
@@ -8,7 +8,7 @@ import (
 
 	"github.com/tetratelabs/wazero"
 	"github.com/tetratelabs/wazero/api"
-	"github.com/tetratelabs/wazero/internal/engine/wazevo"
+	"github.com/tetratelabs/wazero/experimental/opt"
 	"github.com/tetratelabs/wazero/internal/platform"
 	"github.com/tetratelabs/wazero/internal/testing/hammer"
 	"github.com/tetratelabs/wazero/internal/testing/require"
@@ -36,8 +36,7 @@ func TestEngineWazevo_hammer(t *testing.T) {
 	if runtime.GOARCH != "arm64" {
 		t.Skip()
 	}
-	c := wazero.NewRuntimeConfigInterpreter()
-	wazevo.ConfigureWazevo(c)
+	c := opt.NewRuntimeConfigOptimizingCompiler()
 	runAllTests(t, hammers, c, true)
 }
 
diff --git a/internal/integration_test/engine/memleak_test.go b/internal/integration_test/engine/memleak_test.go
index d1d98abc..7b1a627d 100644
--- a/internal/integration_test/engine/memleak_test.go
+++ b/internal/integration_test/engine/memleak_test.go
@@ -10,7 +10,7 @@ import (
 	"time"
 
 	"github.com/tetratelabs/wazero"
-	"github.com/tetratelabs/wazero/internal/engine/wazevo"
+	"github.com/tetratelabs/wazero/experimental/opt"
 )
 
 func TestMemoryLeak(t *testing.T) {
@@ -61,8 +61,7 @@ func testMemoryLeakInstantiateRuntimeAndModule(isWazevo bool) error {
 
 	var r wazero.Runtime
 	if isWazevo {
-		c := wazero.NewRuntimeConfigInterpreter()
-		wazevo.ConfigureWazevo(c)
+		c := opt.NewRuntimeConfigOptimizingCompiler()
 		r = wazero.NewRuntimeWithConfig(ctx, c)
 	} else {
 		r = wazero.NewRuntime(ctx)
diff --git a/internal/integration_test/filecache/filecache_test.go b/internal/integration_test/filecache/filecache_test.go
index c5129a2a..f1bf16da 100644
--- a/internal/integration_test/filecache/filecache_test.go
+++ b/internal/integration_test/filecache/filecache_test.go
@@ -15,7 +15,7 @@ import (
 	"github.com/tetratelabs/wazero/api"
 	"github.com/tetratelabs/wazero/experimental"
 	"github.com/tetratelabs/wazero/experimental/logging"
-	"github.com/tetratelabs/wazero/internal/engine/wazevo"
+	"github.com/tetratelabs/wazero/experimental/opt"
 	"github.com/tetratelabs/wazero/internal/integration_test/spectest"
 	v1 "github.com/tetratelabs/wazero/internal/integration_test/spectest/v1"
 	"github.com/tetratelabs/wazero/internal/platform"
@@ -35,8 +35,7 @@ func TestFileCacheSpecTest_wazevo(t *testing.T) {
 	if runtime.GOARCH != "arm64" {
 		return
 	}
-	config := wazero.NewRuntimeConfigCompiler()
-	wazevo.ConfigureWazevo(config)
+	config := opt.NewRuntimeConfigOptimizingCompiler()
 	runAllFileCacheTests(t, config)
 }
 
diff --git a/internal/integration_test/fuzz/wazerolib/lib.go b/internal/integration_test/fuzz/wazerolib/lib.go
index 18ab080c..ca6b5a83 100644
--- a/internal/integration_test/fuzz/wazerolib/lib.go
+++ b/internal/integration_test/fuzz/wazerolib/lib.go
@@ -14,7 +14,7 @@ import (
 	"strings"
 
 	"github.com/tetratelabs/wazero"
-	"github.com/tetratelabs/wazero/internal/engine/wazevo"
+	"github.com/tetratelabs/wazero/experimental/opt"
 	"github.com/tetratelabs/wazero/internal/leb128"
 	"github.com/tetratelabs/wazero/internal/testing/binaryencoding"
 	"github.com/tetratelabs/wazero/internal/wasm"
@@ -85,7 +85,7 @@ To reproduce the failure, execute: WASM_BINARY_PATH=%s go test -run=%s ./wazerol
 func newCompilerConfig() wazero.RuntimeConfig {
 	c := wazero.NewRuntimeConfigCompiler()
 	if os.Getenv("WAZERO_FUZZ_WAZEVO") != "" {
-		wazevo.ConfigureWazevo(c)
+		c = opt.NewRuntimeConfigOptimizingCompiler()
 	}
 	return c
 }
@@ -144,8 +144,7 @@ func test_signal_stack() {
 		},
 	})
 	ctx := context.Background()
-	config := wazero.NewRuntimeConfigInterpreter()
-	wazevo.ConfigureWazevo(config)
+	config := opt.NewRuntimeConfigOptimizingCompiler()
 	r := wazero.NewRuntimeWithConfig(ctx, config)
 	module, err := r.Instantiate(ctx, bin)
 	if err != nil {
diff --git a/internal/integration_test/fuzzcases/fuzzcases_test.go b/internal/integration_test/fuzzcases/fuzzcases_test.go
index 82dbc0f9..34f8698b 100644
--- a/internal/integration_test/fuzzcases/fuzzcases_test.go
+++ b/internal/integration_test/fuzzcases/fuzzcases_test.go
@@ -10,7 +10,7 @@ import (
 
 	"github.com/tetratelabs/wazero"
 	"github.com/tetratelabs/wazero/api"
-	"github.com/tetratelabs/wazero/internal/engine/wazevo"
+	"github.com/tetratelabs/wazero/experimental/opt"
 	"github.com/tetratelabs/wazero/internal/platform"
 	"github.com/tetratelabs/wazero/internal/testing/binaryencoding"
 	"github.com/tetratelabs/wazero/internal/testing/require"
@@ -52,8 +52,7 @@ func runWithInterpreter(t *testing.T, runner func(t *testing.T, r wazero.Runtime
 
 func runWithWazevo(t *testing.T, runner func(t *testing.T, r wazero.Runtime)) {
 	t.Run("wazevo", func(t *testing.T) {
-		config := wazero.NewRuntimeConfigInterpreter()
-		wazevo.ConfigureWazevo(config)
+		config := opt.NewRuntimeConfigOptimizingCompiler()
 		r := wazero.NewRuntimeWithConfig(ctx, config)
 		defer r.Close(ctx)
 		runner(t, r)
diff --git a/internal/integration_test/spectest/v1/spec_test.go b/internal/integration_test/spectest/v1/spec_test.go
index 2d36f493..f962b1b6 100644
--- a/internal/integration_test/spectest/v1/spec_test.go
+++ b/internal/integration_test/spectest/v1/spec_test.go
@@ -7,7 +7,7 @@ import (
 
 	"github.com/tetratelabs/wazero"
 	"github.com/tetratelabs/wazero/api"
-	"github.com/tetratelabs/wazero/internal/engine/wazevo"
+	"github.com/tetratelabs/wazero/experimental/opt"
 	"github.com/tetratelabs/wazero/internal/integration_test/spectest"
 	"github.com/tetratelabs/wazero/internal/platform"
 )
@@ -24,10 +24,9 @@ func TestInterpreter(t *testing.T) {
 }
 
 func TestWazevo(t *testing.T) {
-	c := wazero.NewRuntimeConfigCompiler().WithCoreFeatures(api.CoreFeaturesV1)
 	if runtime.GOARCH != "arm64" {
 		t.Skip()
 	}
-	wazevo.ConfigureWazevo(c)
+	c := opt.NewRuntimeConfigOptimizingCompiler().WithCoreFeatures(api.CoreFeaturesV1)
 	spectest.Run(t, Testcases, context.Background(), c)
 }
diff --git a/internal/integration_test/spectest/v2/spec_test.go b/internal/integration_test/spectest/v2/spec_test.go
index 5fe3b99f..1841cc94 100644
--- a/internal/integration_test/spectest/v2/spec_test.go
+++ b/internal/integration_test/spectest/v2/spec_test.go
@@ -7,7 +7,7 @@ import (
 
 	"github.com/tetratelabs/wazero"
 	"github.com/tetratelabs/wazero/api"
-	"github.com/tetratelabs/wazero/internal/engine/wazevo"
+	"github.com/tetratelabs/wazero/experimental/opt"
 	"github.com/tetratelabs/wazero/internal/integration_test/spectest"
 	"github.com/tetratelabs/wazero/internal/platform"
 )
@@ -26,10 +26,9 @@ func TestInterpreter(t *testing.T) {
 }
 
 func TestWazevo(t *testing.T) {
-	c := wazero.NewRuntimeConfigCompiler().WithCoreFeatures(enabledFeatures)
 	if runtime.GOARCH != "arm64" {
 		t.Skip()
 	}
-	wazevo.ConfigureWazevo(c)
+	c := opt.NewRuntimeConfigOptimizingCompiler().WithCoreFeatures(enabledFeatures)
 	spectest.Run(t, Testcases, context.Background(), c)
 }