Skip to content

Commit

Permalink
deps: updates wazero to 1.0.0-pre.4 (#13)
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Cole <[email protected]>
  • Loading branch information
codefromthecrypt authored Dec 1, 2022
1 parent 36abc42 commit f7d9444
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GOPATH := $(shell go env GOPATH)
GOBIN := $(if $(GOPATH),$(GOPATH)/bin,/usr/local/bin)

go_sources := $(shell find cmd encoding gen genid version wasm -name "*.go")
go_sources := $(shell find cmd encoding gen genid version wasm -name "*.go")

.PHONY: build
build: $(GOBIN)/protoc-gen-go-plugin
Expand All @@ -20,7 +20,6 @@ build.tests: $(tinygo_tests:.go=.wasm)
%.wasm: %.go $(GOBIN)/protoc-gen-go-plugin
tinygo build -o $@ -scheduler=none --no-debug --target=wasi $<


proto_files := $(shell find . -name "*.proto")
.PHONY: protoc
protoc: $(proto_files:.proto=.pb.go) $(proto_files:.proto=_vtproto.pb.go)
Expand Down
12 changes: 6 additions & 6 deletions examples/host-functions/greeting/greet_host.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions gen/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ func (gg *Generator) genHostFunctions(g *protogen.GeneratedFile, f *fileInfo) {
}`
for _, method := range f.hostService.Methods {
g.P(method.Comments.Leading, fmt.Sprintf(`
func (h %s) _%s(ctx %s, m %s, params []uint64) []uint64 {`,
func (h %s) _%s(ctx %s, m %s, stack []uint64) {`,
structName,
method.GoName,
g.QualifiedGoIdent(contextPackage.Ident("Context")),
g.QualifiedGoIdent(wazeroAPIPackage.Ident("Module")),
))
g.P("offset, size := uint32(params[0]), uint32(params[1])")
g.P("offset, size := uint32(stack[0]), uint32(stack[1])")
g.P("buf, err := ", g.QualifiedGoIdent(pluginWasmPackage.Ident("ReadMemory")), "(ctx, m, offset, size)")
g.P(errorHandling)

Expand All @@ -93,7 +93,7 @@ func (gg *Generator) genHostFunctions(g *protogen.GeneratedFile, f *fileInfo) {
g.P(errorHandling)

g.P("ptrLen := (ptr << uint64(32)) | uint64(len(buf))")
g.P("return []uint64{ptrLen}")
g.P("stack[0] = ptrLen")
g.P("}")
}
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.18
require (
github.com/planetscale/vtprotobuf v0.3.0
github.com/stretchr/testify v1.7.1
github.com/tetratelabs/wazero v1.0.0-pre.3
github.com/tetratelabs/wazero v1.0.0-pre.4
google.golang.org/protobuf v1.28.1
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/tetratelabs/wazero v1.0.0-pre.3 h1:Z5fbogMUGcERzaQb9mQU8+yJSy0bVvv2ce3dfR4wcZg=
github.com/tetratelabs/wazero v1.0.0-pre.3/go.mod h1:M8UDNECGm/HVjOfq0EOe4QfCY9Les1eq54IChMLETbc=
github.com/tetratelabs/wazero v1.0.0-pre.4 h1:RBJQT5OzmORkSp6MmZDWoFEr0zXjk4pmvMKAdeUnsaI=
github.com/tetratelabs/wazero v1.0.0-pre.4/go.mod h1:u8wrFmpdrykiFK0DFPiFm5a4+0RzsdmXYVtijBKqUVo=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
6 changes: 3 additions & 3 deletions tests/host-functions/proto/host_host.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f7d9444

Please sign in to comment.