7 ms·
It's great all this additions on Cranelift for supporting multi-value returns. We will update Wasmer soon to support it as well. Here's the multivalue return pr
by syrusakbary 7y ago
It's great all this additions on Cranelift for supporting multi-value returns. We will update Wasmer soon to support it as well.
Here's the multivalue return proposal (Phase 3 in the WebAssembly proposals): https://github.com/WebAssembly/multi-value https://github.com/WebAssembly/multi-value
Quick question: Is multivalue return supported in LLVM?
Or said in other way ...code compiled from Rust or C/C++ will output Wasm with multivalue returns? Or only written-by-hand WebAssembly can take advantage of this at the moment?
EDIT: after reading the article more thoroughly: LLVM doesn't support multivalue returns in Wasm yet. They are using Walrus to do wasm to wasm transformation from the return metadata info they have in wasm-bindgen (Rust).
- feniv 7y agoI'm looking forward to seeing this supported in Wasmer as well. A lot of these announcements seem to target wasmtime as the default standalone runtime (and it has come a long way, especially with the addition of the JIT) but having the option to compile WASM to native code ahead-of-time is still very valuable.
- mnemonik 7y agoBoth Wasmtime and Lucet can AOT compile Wasm, for what it's worth.
- feniv 7y agoTIL! Lucet is being switched over to Wasmtime as well [1]. I'll have to take another look at it. [1] https://hacks.mozilla.org/2019/11/announcing-the-bytecode-alliance/ https://hacks.mozilla.org/2019/11/announcing-the-bytecode-al...
- jedisct1 7y agoWAVM can also compile WebAssembly code to an optimized, native object file. It can also embed the compiled code into the WebAssembly module, so that the same module can directly run the precompiled code (when using WAVM) or be executed as a standard module by another runtime.
- tlively 7y agoI am currently working on multivalue in both LLVM and Binaryen. Watch for celebratory tweets when I finish ;) Rust will be able to benefit immediately once LLVM has multivalue function support since they use their own ABI internally. But C, C++, and Rust extern functions will not be able to benefit until we additionally define a new C ABI that takes advantage of multivalue returns. It's also worth noting that multivalue blocks only bring a code size win of a couple percent on real wasm modules, so those are much lower priority. WebAssembly features are all different in how difficult they are to add to the specification, engines, and tools. Multivalue is unique in that it is trivial for the spec and for engines, but is extremely difficult to implement in tools.