Skip to content

WIP: Support wasip2 in Go 1.24 #367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cm/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module go.bytecodealliance.org/cm

go 1.23.0
go 1.24.0
6 changes: 5 additions & 1 deletion cm/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func Some[T any](v T) Option[T] {
// followed by storage for the associated type T.
type option[T any] struct {
_ HostLayout
isSome uint8
isSome uint32
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why this change?

This will break ABI compatibility on TinyGo.

Copy link
Member Author

Choose a reason for hiding this comment

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

technically the uint8 isn't correct WRT the CM's canonical ABI, hence the change. Can you say how this breaks things on TinyGo? I'd assume that new code using newly generated bindings would continue to work as before?

(To be clear, I think it's fine to revert this, since the relevant bit will always reside in the same byte, whether the rest is filled with padding or is represented by the uint32.)

some T
}

Expand All @@ -47,6 +47,10 @@ func (o *option[T]) Some() *T {
return nil
}

func (o option[T]) IsSome() bool {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This grows the public API of Option[T]. Would consider this as a separate PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Entirely okay to revert.

return o.isSome == 1
}

// Value returns T if o represents the some case,
// or the zero value of T if o represents the none case.
// This does not have a pointer receiver, so it can be chained.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module go.bytecodealliance.org

go 1.23.0
go 1.24.0

require (
github.com/coreos/go-semver v0.3.1
Expand Down
2 changes: 1 addition & 1 deletion go.work
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
go 1.23.0
go 1.24.0

use (
.
Expand Down
2 changes: 1 addition & 1 deletion testdata/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This go.mod file exists to prevent the testdata directory from being included in module distribution.
module testdata

go 1.23.0
go 1.24.0
16 changes: 15 additions & 1 deletion testdata/issues/issue325.wit.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
}
},
"r": {
"type": 1
"type": 2
}
},
"exports": {},
Expand Down Expand Up @@ -101,6 +101,20 @@
"feature": "active"
}
}
},
{
"name": "r",
"kind": {
"type": 0
},
"owner": {
"world": 3
},
"stability": {
"unstable": {
"feature": "active"
}
}
}
],
"packages": [
Expand Down
96 changes: 90 additions & 6 deletions testdata/wit-parser/gated-include-use-with-stable.wit.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,13 @@
}
},
"stable-resource": {
"type": 3
"type": 6
},
"unversioned-resource": {
"type": 4
"type": 7
},
"unstable-resource": {
"type": 5
"type": 8
}
},
"exports": {},
Expand Down Expand Up @@ -219,13 +219,13 @@
}
},
"stable-resource": {
"type": 3
"type": 9
},
"unversioned-resource": {
"type": 4
"type": 10
},
"unstable-resource": {
"type": 5
"type": 11
}
},
"exports": {},
Expand Down Expand Up @@ -336,6 +336,90 @@
"feature": "active"
}
}
},
{
"name": "stable-resource",
"kind": {
"type": 2
},
"owner": {
"world": 5
},
"stability": {
"unstable": {
"feature": "active"
}
}
},
{
"name": "unversioned-resource",
"kind": {
"type": 1
},
"owner": {
"world": 5
},
"stability": {
"unstable": {
"feature": "active"
}
}
},
{
"name": "unstable-resource",
"kind": {
"type": 0
},
"owner": {
"world": 5
},
"stability": {
"unstable": {
"feature": "active"
}
}
},
{
"name": "stable-resource",
"kind": {
"type": 2
},
"owner": {
"world": 6
},
"stability": {
"unstable": {
"feature": "active"
}
}
},
{
"name": "unversioned-resource",
"kind": {
"type": 1
},
"owner": {
"world": 6
},
"stability": {
"unstable": {
"feature": "active"
}
}
},
{
"name": "unstable-resource",
"kind": {
"type": 0
},
"owner": {
"world": 6
},
"stability": {
"unstable": {
"feature": "active"
}
}
}
],
"packages": [
Expand Down

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

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

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

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

7 changes: 4 additions & 3 deletions tests/generated/wasi/filesystem/v0.2.0/types/types.wasm.go

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

7 changes: 4 additions & 3 deletions tests/generated/wasi/filesystem/v0.2.0/types/types.wit.go

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

6 changes: 5 additions & 1 deletion tests/generated/wasi/io/v0.2.0/error/error.wasm.go

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

3 changes: 2 additions & 1 deletion tests/generated/wasi/io/v0.2.0/error/error.wit.go

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

Loading
Loading