Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates dependencies #31

Merged
merged 1 commit into from
Jul 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions engines/wazero/wazero.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import (
"context"
"errors"
"fmt"
"github.com/tetratelabs/wazero/assemblyscript"

"io"
"sync/atomic"

"github.com/tetratelabs/wazero"
"github.com/tetratelabs/wazero/api"
"github.com/tetratelabs/wazero/wasi"
"github.com/tetratelabs/wazero/assemblyscript"
"github.com/tetratelabs/wazero/wasi_snapshot_preview1"

"github.com/wapc/wapc-go"
)
Expand Down Expand Up @@ -118,13 +119,15 @@ func (e *engine) New(ctx context.Context, source []byte, hostCallHandler wapc.Ho
WithStdout(&stdout{m}) // redirect Stdout to the logger
mod = m

if _, err = wasi.InstantiateSnapshotPreview1(ctx, r); err != nil {
if _, err = wasi_snapshot_preview1.Instantiate(ctx, r); err != nil {
_ = r.Close(ctx)
return
}

// This disables the abort message as no other engines write it.
if _, err = assemblyscript.NewModuleBuilder(r).WithAbortMessageDisabled().Instantiate(ctx); err != nil {
envBuilder := r.NewModuleBuilder("env")
assemblyscript.NewFunctionExporter().WithAbortMessageDisabled().ExportFunctions(envBuilder)
if _, err = envBuilder.Instantiate(ctx, r); err != nil {
_ = r.Close(ctx)
return
}
Expand Down Expand Up @@ -179,7 +182,7 @@ func instantiateWapcHost(ctx context.Context, r wazero.Runtime, callHandler wapc
ExportFunction("__guest_error", h.guestError).
ExportFunction("__host_error", h.hostError).
ExportFunction("__host_error_len", h.hostErrorLen).
Instantiate(ctx)
Instantiate(ctx, r)
}

// hostCall is the WebAssembly function export "__host_call", which initiates a host using the callHandler using
Expand Down Expand Up @@ -392,7 +395,7 @@ func requireReadString(ctx context.Context, mem api.Memory, fieldName string, of
func requireRead(ctx context.Context, mem api.Memory, fieldName string, offset, byteCount uint32) []byte {
buf, ok := mem.Read(ctx, offset, byteCount)
if !ok {
panic(fmt.Errorf("out of range reading %s", fieldName))
panic(fmt.Errorf("out of memory reading %s", fieldName))
}
return buf
}
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ go 1.17

require (
github.com/Workiva/go-datastructures v1.0.53
github.com/bytecodealliance/wasmtime-go v0.36.0
github.com/tetratelabs/wazero v0.0.0-20220529032218-029a79476b4f
github.com/bytecodealliance/wasmtime-go v0.38.1
github.com/tetratelabs/wazero v0.0.0-20220714084325-040736caac8f
github.com/wasmerio/wasmer-go v1.0.4
)

Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/Workiva/go-datastructures v1.0.53 h1:J6Y/52yX10Xc5JjXmGtWoSSxs3mZnGSaq37xZZh7Yig=
github.com/Workiva/go-datastructures v1.0.53/go.mod h1:1yZL+zfsztete+ePzZz/Zb1/t5BnDuE2Ya2MMGhzP6A=
github.com/bytecodealliance/wasmtime-go v0.36.0 h1:B6thr7RMM9xQmouBtUqm1RpkJjuLS37m6nxX+iwsQSc=
github.com/bytecodealliance/wasmtime-go v0.36.0/go.mod h1:q320gUxqyI8yB+ZqRuaJOEnGkAnHh6WtJjMaT2CW4wI=
github.com/bytecodealliance/wasmtime-go v0.38.1 h1:eqrJmy1nR/uyxZC4OydXWpvGeEHzprW1Fao6eXvNnEE=
github.com/bytecodealliance/wasmtime-go v0.38.1/go.mod h1:q320gUxqyI8yB+ZqRuaJOEnGkAnHh6WtJjMaT2CW4wI=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
Expand All @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/tetratelabs/wazero v0.0.0-20220529032218-029a79476b4f h1:bN4C2nSpz/ND03EbZoV+3xR8Ivc5rV6FBpoErU2uU14=
github.com/tetratelabs/wazero v0.0.0-20220529032218-029a79476b4f/go.mod h1:Y4X/zO4sC2dJjZG9GDYNRbJGogfqFYJY/BbyKlOxXGI=
github.com/tetratelabs/wazero v0.0.0-20220714084325-040736caac8f h1:MmGwq39JVO05i+4oj7TyZPJLMC5Sn+d2qqyywKVHEDc=
github.com/tetratelabs/wazero v0.0.0-20220714084325-040736caac8f/go.mod h1:Y4X/zO4sC2dJjZG9GDYNRbJGogfqFYJY/BbyKlOxXGI=
github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg=
github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q=
github.com/wasmerio/wasmer-go v1.0.4 h1:MnqHoOGfiQ8MMq2RF6wyCeebKOe84G88h5yv+vmxJgs=
Expand Down