Skip to content

Commit

Permalink
Merge pull request #1 from codefromthecrypt/wazero-update
Browse files Browse the repository at this point in the history
updates wazero
  • Loading branch information
mrg0lden authored Jul 1, 2022
2 parents 6d0b12b + ced4750 commit 7602eee
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.18

require (
github.com/alecthomas/assert/v2 v2.0.2
github.com/tetratelabs/wazero v0.0.0-20220510030018-8dd797e108db
github.com/tetratelabs/wazero v0.0.0-20220630052417-63f6b2231142
github.com/yeqown/go-qrcode/v2 v2.2.1
github.com/yeqown/go-qrcode/writer/standard v1.2.1
golang.org/x/exp v0.0.0-20220428152302-39d4317da171
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/tetratelabs/wazero v0.0.0-20220510030018-8dd797e108db h1:HQDOsOFGBdhO6c163iIT0NEod1uenfxTLJWkaUTD42k=
github.com/tetratelabs/wazero v0.0.0-20220510030018-8dd797e108db/go.mod h1:Y4X/zO4sC2dJjZG9GDYNRbJGogfqFYJY/BbyKlOxXGI=
github.com/tetratelabs/wazero v0.0.0-20220630052417-63f6b2231142 h1:ZnK50yYXmYRlAOpOzYw6Xu/QWU2kP8bDeVLQDzQtTas=
github.com/tetratelabs/wazero v0.0.0-20220630052417-63f6b2231142/go.mod h1:Y4X/zO4sC2dJjZG9GDYNRbJGogfqFYJY/BbyKlOxXGI=
github.com/yeqown/go-qrcode/v2 v2.2.1 h1:Jc1Q916fwC05R8C7mpWDbrT9tyLPaLLKDABoC5XBCe8=
github.com/yeqown/go-qrcode/v2 v2.2.1/go.mod h1:2Qsk2APUCPne0TsRo40DIkI5MYnbzYKCnKGEFWrxd24=
github.com/yeqown/go-qrcode/writer/standard v1.2.1 h1:FMRZiur5yApUIe4fqtqmcdl/XQTZAZWt2DhkPx4VIW0=
Expand Down
11 changes: 6 additions & 5 deletions zbar.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

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

var (
Expand All @@ -20,12 +20,13 @@ var (
)

func newZbarInstance() (wazero.Runtime, api.Module) {
r := wazero.NewRuntimeWithConfig(wazero.NewRuntimeConfigJIT())
must(wasi.InstantiateSnapshotPreview1(ctx, r))
r := wazero.NewRuntimeWithConfig(wazero.NewRuntimeConfigCompiler())
must(wasi_snapshot_preview1.Instantiate(ctx, r))
// TODO: replace with wazero impl after https://github.com/tetratelabs/wazero/issues/601
must(r.NewModuleBuilder("env").
ExportFunction("emscripten_notify_memory_growth", func(int32) {}).
Instantiate(ctx))
zbar := must(r.InstantiateModuleFromCode(ctx, zbarWasm))
Instantiate(ctx, r))
zbar := must(r.InstantiateModuleFromBinary(ctx, zbarWasm))
return r, zbar
}

Expand Down

0 comments on commit 7602eee

Please sign in to comment.