Skip to content
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

Stabilize WebAssembly multivalue and reference-types target features #131080

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alexcrichton
Copy link
Member

This commit is similar to #117457 in that it's stabilizing target features specific to WebAssembly targets. The previous PR left out these features because they weren't expected to change much about compiled code so it was unclear what the rationale was. It has since been discovered that reference-types can be useful as it changes the binary format of the call_indirect instruction. Additionally on Zulip there's a use case of detecting these features at compile time and generating a compile error to better warn users about features not supported on engines.

A test has been added here not only for these two features but other WebAssembly features as well to showcase that they're usable without feature gates in stable Rust.

This commit is similar to rust-lang#117457 in that it's stabilizing target
features specific to WebAssembly targets. The previous PR left out these
features because they weren't expected to change much about compiled
code so it was unclear what the rationale was. It has [since been
discovered][blog] that `reference-types` can be useful as it changes the
binary format of the `call_indirect` instruction. Additionally [on
Zulip][zulip] there's a use case of detecting these features at compile
time and generating a compile error to better warn users about features
not supported on engines.

A test has been added here not only for these two features but other
WebAssembly features as well to showcase that they're usable without
feature gates in stable Rust.

[blog]: https://blog.rust-lang.org/2024/09/24/webassembly-targets-change-in-default-target-features.html
[zulip]: https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/wasm32.20reference-types.20.2F.20multivalue.20in.201.2E82-beta.20not.20enabled/near/473893987
@rustbot
Copy link
Collaborator

rustbot commented Oct 1, 2024

r? @petrochenkov

rustbot has assigned @petrochenkov.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 1, 2024
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

The changes LGTM. As far as I understand it, this stabilizes multivalue and reference-types target features (aka wasm proposals) which are already enabled-by-default through the llvm 19 update.

But let's also have someone on T-compiler double-check.

EDIT: this definitely needs relnotes

@jieyouxu jieyouxu self-assigned this Oct 1, 2024
@alexcrichton
Copy link
Member Author

In case anyone's curious, this is a longer description of what stabilization of these features mean and for multivalue and reference-types there's some more info in this post but the general tl;dr; is that multivalue and reference-types don't affect generated code too too much except for reference-types currently changing the encoding of indirect call instructions. The main motivation for this is to enable users to test for this in Wasm code and emit early-errors if the engine the code is intended to run in doesn't support either proposal.

@ehuss
Copy link
Contributor

ehuss commented Oct 1, 2024

Whenever you get a chance, can you also post a PR to update the docs at https://github.com/rust-lang/reference/blob/9c21beeaa59566d87191392548c421cc7baa941a/src/attributes/codegen.md?plain=1#L276-L284?

@alexcrichton
Copy link
Member Author

certainly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants