fix(wasm): use interpreter on aarch64 for now

Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
Xe Iaso
2025-09-30 14:39:56 +00:00
parent 2ad7be2847
commit 7f1a7197f3
2 changed files with 21 additions and 1 deletions
+13 -1
View File
@@ -7,6 +7,7 @@ import (
"io" "io"
"math" "math"
"os" "os"
"runtime"
"strconv" "strconv"
"sync" "sync"
"time" "time"
@@ -45,7 +46,18 @@ func NewRunner(ctx context.Context, fname string, fin io.ReadCloser) (*Runner, e
return nil, fmt.Errorf("wasm: can't read from fin: %w", err) return nil, fmt.Errorf("wasm: can't read from fin: %w", err)
} }
r := wazero.NewRuntime(ctx) var cfg wazero.RuntimeConfig
switch runtime.GOARCH {
case "amd64":
cfg = wazero.NewRuntimeConfigCompiler()
default:
cfg = wazero.NewRuntimeConfigInterpreter()
}
cfg = cfg.WithMemoryLimitPages(512)
r := wazero.NewRuntimeWithConfig(ctx, cfg)
_, err = r.NewHostModuleBuilder("anubis"). _, err = r.NewHostModuleBuilder("anubis").
NewFunctionBuilder(). NewFunctionBuilder().
+8
View File
@@ -5,6 +5,7 @@ import (
"crypto/sha256" "crypto/sha256"
"fmt" "fmt"
"io/fs" "io/fs"
"path/filepath"
"testing" "testing"
"time" "time"
@@ -58,6 +59,9 @@ func TestAlgos(t *testing.T) {
for _, kind := range []string{"baseline", "simd128"} { for _, kind := range []string{"baseline", "simd128"} {
for _, fname := range fnames { for _, fname := range fnames {
if filepath.Ext(fname.Name()) != ".wasm" {
continue
}
t.Run(kind+"/"+fname.Name(), func(t *testing.T) { t.Run(kind+"/"+fname.Name(), func(t *testing.T) {
abiTest(t, kind, fname.Name(), 16) abiTest(t, kind, fname.Name(), 16)
}) })
@@ -139,6 +143,10 @@ func BenchmarkValidate(b *testing.B) {
difficulty = 16 difficulty = 16
} }
if filepath.Ext(fname) != ".wasm" {
continue
}
b.Run(fname, func(b *testing.B) { b.Run(fname, func(b *testing.B) {
fin, err := web.Static.Open("static/wasm/simd128/" + fname) fin, err := web.Static.Open("static/wasm/simd128/" + fname)
if err != nil { if err != nil {