Skip to content

Conversation

@ydnar
Copy link
Contributor

@ydnar ydnar commented Oct 17, 2024

This updates the version of github.com/bytecodealliance/wasm-tools-go to v0.3.0 and regenerates the WASI 0.2 bindings in packages internal/wasi/* and internal/cm. This is a cherry-pick from #4501. cc @deadprogram

Copy link
Member

@deadprogram deadprogram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am using this same version of wasm-tools-go elsewhere quite successfully so far.

@deadprogram
Copy link
Member

Now merging, thanks for update @ydnar

@deadprogram deadprogram merged commit d5f1953 into tinygo-org:dev Oct 17, 2024
17 checks passed
Copy link
Member

@dgryski dgryski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM to merge with the exception of some comments about the generated code (but those shouldn't block merging this..)

// [uint64]: https://pkg.go.dev/builtin#uint64
// [float32]: https://pkg.go.dev/builtin#float32
// [Canonical ABI]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md
func U64ToF32(v uint64) float32 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment should probably apply to the upstream generator, but note that math already has

[func Float32bits(f float32) uint32](https://pkg.go.dev/math#Float32bits)
[func Float32frombits(b uint32) float32](https://pkg.go.dev/math#Float32frombits)
[func Float64bits(f float64) uint64](https://pkg.go.dev/math#Float64bits)
[func Float64frombits(b uint64) float64](https://pkg.go.dev/math#Float64frombits)

Copy link
Contributor Author

@ydnar ydnar Oct 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Memorializing IRL conversation this past week in San Francisco:

"We duplicate functionality from package math here to avoid a potential circular dependency in package runtime. Package cm intentionally depends only on unsafe."


// String implements [fmt.Stringer], returning the variant case name of v.
func (v StreamError) String() string {
return stringsStreamError[v.Tag()]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again a comment for the generator here: should we be handling "unknown" types (Tag() >= 2) or just assume that will "never happen" and a crash regardless?

Copy link
Contributor Author

@ydnar ydnar Oct 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Memorializing IRL conversation this past week in San Francisco:

"Invalid variant cases are a bug, and a panic/crash is the intended behavior."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants