Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Commit

Permalink
Rename build tag to envoy instead of proxywasm (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
anuraaga authored Oct 24, 2023
1 parent 5d59f9b commit 2fc853c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ This library relies on WASI to implement certain functionality, for which Envoy'
is incomplete, and in addition, it's ABI, proxy-wasm has design issues that prevent working with
defaults appropriate for normal TinyGo applications. As this project is commonly used with Envoy,
we provide a build tag, to work around these issues. If building an Envoy plugin, add
`-tags=nottinygc_proxywasm` (or combine it with additional tags) to your TinyGo build flags. This
`-tags=nottinygc_envoy` (or combine it with additional tags) to your TinyGo build flags. This
will disable export of `malloc`/`free`/ and define a no-op `sched_yield` function.

Other hosts that implement WASI fully, such as [wazero][3] and ABIs with correct memory semantics,
such as [http-wasm][5], will not have any issue.
such as [http-wasm][5], will not have any issue. Implementations of proxy-wasm other than Envoy
may also work fine without the build tag.

## Performance

Expand Down
4 changes: 2 additions & 2 deletions bench/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ func TestExportsMalloc(t *testing.T) {
}
}

func TestProxyWasmDoesNotExportMalloc(t *testing.T) {
wasm, err := os.ReadFile(filepath.Join("..", "build", "bench_proxywasm.wasm"))
func TestEnvoyDoesNotExportMalloc(t *testing.T) {
wasm, err := os.ReadFile(filepath.Join("..", "build", "bench_envoy.wasm"))
if err != nil {
t.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion init_default.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright wasilibs authors
// SPDX-License-Identifier: MIT

//go:build tinygo && !nottinygc_proxywasm
//go:build tinygo && !nottinygc_envoy

package nottinygc

Expand Down
2 changes: 1 addition & 1 deletion init_proxywasm.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright wasilibs authors
// SPDX-License-Identifier: MIT

//go:build tinygo && nottinygc_proxywasm
//go:build tinygo && nottinygc_envoy

package nottinygc

Expand Down
2 changes: 1 addition & 1 deletion magefiles/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func buildBenchExecutable() error {
return err
}

if err := sh.RunV("tinygo", "build", "-gc=custom", "-tags='custommalloc nottinygc_proxywasm'", "-scheduler=none", "-target=wasi", "-o", "build/bench_proxywasm.wasm", "./bench"); err != nil {
if err := sh.RunV("tinygo", "build", "-gc=custom", "-tags='custommalloc nottinygc_envoy'", "-scheduler=none", "-target=wasi", "-o", "build/bench_envoy.wasm", "./bench"); err != nil {
return err
}

Expand Down

0 comments on commit 2fc853c

Please # to comment.