-
Notifications
You must be signed in to change notification settings - Fork 919
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
all: replace target=wasi with target=wasip1 #4175
Conversation
This eliminates the 'wasi' build tag in favor of 'GOOS=wasip1', introduced in Go 1.21. For backwards compatablity, -target=wasi is a synonym for -target=wasip1.
TODO: should Getpagesize on wasip1 just return wasmPageSize?
While I am in favor of the general idea, there is one problem: we already support wasip1 in a different way. This would add two separate ways of using wasip1 which I think is a bad idea. The other lives in the compiler, here (among others): https://github.com/tinygo-org/tinygo/blob/release/compileopts/target.go#L394 I don't have a strong opinion on either way, but I certainly would want to avoid this duplication. Either by always using the definition in target.go (and no separate JSON file), or by loading the JSON file when using |
The latter (loading the JSON file for particular That would avoid duplication of config between code and the JSON target files. I’m happy to sketch that out. |
Remove the duplication of config in target.go in favor of loading a target JSON file seems like a good idea, but that’s a bigger change. Separate PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed, looks good to me with some nits.
Remove the duplication of config in target.go in favor of loading a target JSON file seems like a good idea, but that’s a bigger change. Separate PR?
Seems fine by me.
// TODO: should this return runtime.wasmPageSize? | ||
func Getpagesize() int { | ||
return libc_getpagesize() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The WebAssembly page size is a fixed constant, and unless WebAssembly decides to introduce a major backwards compatibility break it's not going to change either. I don't think we need to define this in a single place and reuse everywhere (and if we needed to, libc getpagesize
would probably be the appropriate place anyway).
In any case, I think it's fine (in fact I'd say just use a numeric constant but a call is fine too).
Done! I’ll see about a second PR to eliminate the hard-coded target options. |
@aykevl any other feedback on this PR, or are we good to merge? |
Reminder to @aykevl on this PR, please. |
@ydnar you should be unblocked for this now. 😸 |
@ydnar is this something you're still going to do? |
Thanks for the nudge. I'll take a look. |
This eliminates the
wasi
build tag in favor ofGOOS=wasip1
, introduced in Go 1.21.For backwards compatibility,
-target=wasi
is a synonym for-target=wasip1
.