Skip to content

wazero v1.0.0-pre.5

Pre-release
Pre-release
Compare
Choose a tag to compare
@codefromthecrypt codefromthecrypt released this 15 Dec 07:08
· 1149 commits to main since this release
5f7467b

wazero v1.0.0-pre.5 improves debugability. It also makes some API changes that reduce its surface area.

We did an early release to allow the few folks impacted by API changes to test them prior to our normal month-end release. Most users should wait for v1.0.0-pre.6, which will include better performance, as well the ability to create new files.

On that note, we'll remind we have a gophers slack #wazero channel for support, updates and conversation! Note: You may need an invite to join gophers. If you like what we are doing, please star our repo as folks appreciate it.

Better stack traces

Those who compile "debug" wasm will appreciate better looking stack traces on error.

Before, a stack trace message looks like:

wasm stack trace:
        .runtime._panic(i32)
        .c()
        .b()
        .a()
        .main.main()
        .runtime.run()
        ._start()

Now, if the %.wasm includes DWARF debug info (usually a debug build), stack traces look a lot more precise:

wasm stack trace:
        .runtime._panic(i32)
                0x16e2: /opt/homebrew/Cellar/tinygo/0.26.0/src/runtime/runtime_tinygowasm.go:73:6 (inlined)
                        /opt/homebrew/Cellar/tinygo/0.26.0/src/runtime/panic.go:52:7
        .c()
                0x1911: /Users/mathetake/wazero/internal/testing/dwarftestdata/testdata/tinygo/main.go:19:7
        .b()
                0x1901: /Users/mathetake/wazero/internal/testing/dwarftestdata/testdata/tinygo/main.go:14:3
        .a()
                0x18f7: /Users/mathetake/wazero/internal/testing/dwarftestdata/testdata/tinygo/main.go:9:3
        .main.main()
                0x18ed: /Users/mathetake/wazero/internal/testing/dwarftestdata/testdata/tinygo/main.go:4:3
        .runtime.run()
                0x18cc: /opt/homebrew/Cellar/tinygo/0.26.0/src/runtime/scheduler_none.go:26:10
        ._start()
                0x18b6: /opt/homebrew/Cellar/tinygo/0.26.0/src/runtime/runtime_wasm_wasi.go:22:5

Many thanks to @mathetake for the work on this, which was easier due to standard libraries in Go.

Moreover, we added logging.NewHostLoggingListenerFactory for those only interested in host function calls. This reduces the volume of logging considerably for those trying to troubleshoot their custom functions.

Thanks to @codefromthecrypt for the work making things easier to understand.

API Changes

As we near 1.0, we made some decisions to cancel some features that either weren't used or aren't worth their performance impact.

Notably, we canceled the ability to change the filesystem without re-instantiating the module (experimental.WithFS). This was a complicated feature and made function calls slower also. Instead, folks should re-instantiate or otherwise lock the file system if it needs to change dynamically between calls. Feel free to ask us on gophers slack #wazero channel if you need advice.

We also removed the ctx parameter from fine grained calls such as memory reads. This sounded like a nice design idea to have it, but it introduced overhead and also wasn't really actionable except in host functions. This is because most memory accesses are from native code, which don't use go's context. Instead, we left the ctx parameter on function calls and lifecycle methods.