diff --git a/.github/workflows/commit.yaml b/.github/workflows/commit.yaml index 5cb257f9c5..7065691e9a 100644 --- a/.github/workflows/commit.yaml +++ b/.github/workflows/commit.yaml @@ -154,7 +154,7 @@ jobs: # The version here is coupled to internal/integration_test/go.mod, but it # isn't always the same as sometimes the Go layer has a broken release. env: - WASMEDGE_VERSION: 0.11.1 + WASMEDGE_VERSION: 0.11.2 - uses: actions/checkout@v3 diff --git a/internal/integration_test/vs/wasmedge/go.mod b/internal/integration_test/vs/wasmedge/go.mod index 67793c8d46..10b29be52e 100644 --- a/internal/integration_test/vs/wasmedge/go.mod +++ b/internal/integration_test/vs/wasmedge/go.mod @@ -3,7 +3,7 @@ module github.com/tetratelabs/wazero/internal/integration_test/vs/wasmedge go 1.17 require ( - github.com/second-state/WasmEdge-go v0.11.1 + github.com/second-state/WasmEdge-go v0.11.2 github.com/tetratelabs/wazero v0.0.0 ) diff --git a/internal/integration_test/vs/wasmedge/go.sum b/internal/integration_test/vs/wasmedge/go.sum index 7c48009ed0..2923cbab66 100644 --- a/internal/integration_test/vs/wasmedge/go.sum +++ b/internal/integration_test/vs/wasmedge/go.sum @@ -1,2 +1,2 @@ -github.com/second-state/WasmEdge-go v0.11.1 h1:ggf9mFJrnx+eD/7bQf3vF8hYVyCMTzXTXi2MNKljhC8= -github.com/second-state/WasmEdge-go v0.11.1/go.mod h1:HyBf9hVj1sRAjklsjc1Yvs9b5RcmthPG9z99dY78TKg= +github.com/second-state/WasmEdge-go v0.11.2 h1:4RZhxKvay9uBM9uzE0jrB/26t1ncQG3LbNQOooKjrHA= +github.com/second-state/WasmEdge-go v0.11.2/go.mod h1:HyBf9hVj1sRAjklsjc1Yvs9b5RcmthPG9z99dY78TKg= diff --git a/internal/integration_test/vs/wasmtime/go.mod b/internal/integration_test/vs/wasmtime/go.mod index 36fda8b7c8..1d88a472b8 100644 --- a/internal/integration_test/vs/wasmtime/go.mod +++ b/internal/integration_test/vs/wasmtime/go.mod @@ -3,7 +3,7 @@ module github.com/tetratelabs/wazero/internal/integration_test/vs/wasmtime go 1.17 require ( - github.com/bytecodealliance/wasmtime-go v1.0.0 + github.com/bytecodealliance/wasmtime-go/v5 v5.0.0 github.com/tetratelabs/wazero v0.0.0 ) diff --git a/internal/integration_test/vs/wasmtime/go.sum b/internal/integration_test/vs/wasmtime/go.sum index 172c22aa35..6c8072138d 100644 --- a/internal/integration_test/vs/wasmtime/go.sum +++ b/internal/integration_test/vs/wasmtime/go.sum @@ -1,5 +1,5 @@ -github.com/bytecodealliance/wasmtime-go v1.0.0 h1:9u9gqaUiaJeN5IoD1L7egD8atOnTGyJcNp8BhkL9cUU= -github.com/bytecodealliance/wasmtime-go v1.0.0/go.mod h1:jjlqQbWUfVSbehpErw3UoWFndBXRRMvfikYH6KsCwOg= +github.com/bytecodealliance/wasmtime-go/v5 v5.0.0 h1:Ue3eBDElMrdzWoUtr7uPr7NeDZriuR5oIivp5EHknQU= +github.com/bytecodealliance/wasmtime-go/v5 v5.0.0/go.mod h1:KcecyOqumZrvLnlaEIMFRbBaQeUYNvsbPjAEVho1Fcs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/internal/integration_test/vs/wasmtime/wasmtime.go b/internal/integration_test/vs/wasmtime/wasmtime.go index 2704a1c0eb..3cd8614f01 100644 --- a/internal/integration_test/vs/wasmtime/wasmtime.go +++ b/internal/integration_test/vs/wasmtime/wasmtime.go @@ -6,7 +6,7 @@ import ( "context" "fmt" - "github.com/bytecodealliance/wasmtime-go" + wt "github.com/bytecodealliance/wasmtime-go/v5" "github.com/tetratelabs/wazero/internal/integration_test/vs" ) @@ -16,86 +16,86 @@ func newWasmtimeRuntime() vs.Runtime { } type wasmtimeRuntime struct { - engine *wasmtime.Engine - module *wasmtime.Module + engine *wt.Engine + module *wt.Module } type wasmtimeModule struct { - store *wasmtime.Store + store *wt.Store // instance is here because there's no close/destroy function. The only thing is garbage collection. - instance *wasmtime.Instance - funcs map[string]*wasmtime.Func + instance *wt.Instance + funcs map[string]*wt.Func logFn func([]byte) error - mem *wasmtime.Memory + mem *wt.Memory } func (r *wasmtimeRuntime) Name() string { return "wasmtime" } -func (m *wasmtimeModule) log(_ *wasmtime.Caller, args []wasmtime.Val) ([]wasmtime.Val, *wasmtime.Trap) { +func (m *wasmtimeModule) log(_ *wt.Caller, args []wt.Val) ([]wt.Val, *wt.Trap) { unsafeSlice := m.mem.UnsafeData(m.store) offset := args[0].I32() byteCount := args[1].I32() if err := m.logFn(unsafeSlice[offset : offset+byteCount]); err != nil { - return nil, wasmtime.NewTrap(err.Error()) + return nil, wt.NewTrap(err.Error()) } - return []wasmtime.Val{}, nil + return []wt.Val{}, nil } func (r *wasmtimeRuntime) Compile(_ context.Context, cfg *vs.RuntimeConfig) (err error) { - r.engine = wasmtime.NewEngine() - if r.module, err = wasmtime.NewModule(r.engine, cfg.ModuleWasm); err != nil { + r.engine = wt.NewEngine() + if r.module, err = wt.NewModule(r.engine, cfg.ModuleWasm); err != nil { return } return } func (r *wasmtimeRuntime) Instantiate(_ context.Context, cfg *vs.RuntimeConfig) (mod vs.Module, err error) { - wm := &wasmtimeModule{funcs: map[string]*wasmtime.Func{}} + wm := &wasmtimeModule{funcs: map[string]*wt.Func{}} // We can't reuse a store because even if we call close, re-instantiating too many times leads to: // >> resource limit exceeded: instance count too high at 10001 - wm.store = wasmtime.NewStore(r.engine) - linker := wasmtime.NewLinker(wm.store.Engine) + wm.store = wt.NewStore(r.engine) + linker := wt.NewLinker(wm.store.Engine) // Instantiate WASI, if configured. if cfg.NeedsWASI { if err = linker.DefineWasi(); err != nil { return } - config := wasmtime.NewWasiConfig() // defaults to toss stdout - config.InheritStderr() // see errors + config := wt.NewWasiConfig() // defaults to toss stdout + config.InheritStderr() // see errors wm.store.SetWasi(config) } // Instantiate the host module, "env", if configured. if cfg.LogFn != nil { wm.logFn = cfg.LogFn - if err = linker.Define("env", "log", wasmtime.NewFunc( + if err = linker.Define("env", "log", wt.NewFunc( wm.store, - wasmtime.NewFuncType( - []*wasmtime.ValType{ - wasmtime.NewValType(wasmtime.KindI32), - wasmtime.NewValType(wasmtime.KindI32), + wt.NewFuncType( + []*wt.ValType{ + wt.NewValType(wt.KindI32), + wt.NewValType(wt.KindI32), }, - []*wasmtime.ValType{}, + []*wt.ValType{}, ), wm.log, )); err != nil { return } } else if cfg.EnvFReturnValue != 0 { - ret := []wasmtime.Val{wasmtime.ValI64(int64(cfg.EnvFReturnValue))} - if err = linker.Define("env", "f", wasmtime.NewFunc( + ret := []wt.Val{wt.ValI64(int64(cfg.EnvFReturnValue))} + if err = linker.Define("env", "f", wt.NewFunc( wm.store, - wasmtime.NewFuncType( - []*wasmtime.ValType{ - wasmtime.NewValType(wasmtime.KindI64), + wt.NewFuncType( + []*wt.ValType{ + wt.NewValType(wt.KindI64), }, - []*wasmtime.ValType{wasmtime.NewValType(wasmtime.KindI64)}, + []*wt.ValType{wt.NewValType(wt.KindI64)}, ), - func(_ *wasmtime.Caller, args []wasmtime.Val) ([]wasmtime.Val, *wasmtime.Trap) { + func(_ *wt.Caller, args []wt.Val) ([]wt.Val, *wt.Trap) { return ret, nil }, )); err != nil { @@ -148,7 +148,7 @@ func (r *wasmtimeRuntime) Instantiate(_ context.Context, cfg *vs.RuntimeConfig) func (r *wasmtimeRuntime) Close(context.Context) error { r.module = nil r.engine = nil - return nil // wasmtime only closes via finalizer + return nil // wt only closes via finalizer } func (m *wasmtimeModule) Memory() []byte { @@ -201,5 +201,5 @@ func (m *wasmtimeModule) Close(context.Context) error { m.store = nil m.instance = nil m.funcs = nil - return nil // wasmtime only closes via finalizer + return nil // wt only closes via finalizer }