Add a new, unstable, "wasm-multivalue" ABI#157334
Conversation
This commit adds a new ABI string to the Rust compiler, "wasm-multivalue", which corresponds to a new ABI for WebAssembly defined at WebAssembly/tool-conventions#268. The purpose of this ABI is to enable Rust code compiled to WebAssembly to be able to work with WebAssembly functions that have multiple results in their type signature. Currently, despite the `multivalue` target feature being stable, this is not possible. The reason this isn't possible is that the original "C" ABI was created before multivalue and then there's no realistic means to change it. This new ABI is intended to enable all preexisting targets to use this ABI. One day this may become the default ABI for WebAssembly, but we aren't there yet. This adds various bits of plumbing and such throughout the compiler to support the new `wasm-multivalue` ABI. This is only supported with LLVM 23 and later due to required changes in LLVM. This ABI additionally requires the `multivalue` target feature to be enabled to use it.
|
I'll note that I'm creating this as a draft at this time because this requires changes to LLVM which haven't yet landed upstream in LLVM. I hope to land the changes in time for LLVM 23, but we'll see. In the meantime I wanted to at least provide this as a reference point for some discussions I'm having. I don't plan on marking this as ready-for-review until the in-tree version of LLVM supports this new ABI. |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
| Variants::Empty | Variants::Multiple { .. } => return None, | ||
|
|
||
| // Fall through to go see further... | ||
| Variants::Single { .. } => {} |
There was a problem hiding this comment.
This would also match enums where a single variant is inhabited. This should probably check that the type is actually a struct.
|
☔ The latest upstream changes (presumably #157558) made this pull request unmergeable. Please resolve the merge conflicts. |
This commit adds a new ABI string to the Rust compiler, "wasm-multivalue", which corresponds to a new ABI for WebAssembly defined at WebAssembly/tool-conventions#268. The purpose of this ABI is to enable Rust code compiled to WebAssembly to be able to work with WebAssembly functions that have multiple results in their type signature. Currently, despite the
multivaluetarget feature being stable, this is not possible. The reason this isn't possible is that the original "C" ABI was created before multivalue and then there's no realistic means to change it. This new ABI is intended to enable all preexisting targets to use this ABI. One day this may become the default ABI for WebAssembly, but we aren't there yet.This adds various bits of plumbing and such throughout the compiler to support the new
wasm-multivalueABI. This is only supported with LLVM 23 and later due to required changes in LLVM. This ABI additionally requires themultivaluetarget feature to be enabled to use it.