rust/src/test/run-make
Alex Crichton 482a3d06c3 rustc: Add a new wasm ABI
This commit implements the idea of a new ABI for the WebAssembly target,
one called `"wasm"`. This ABI is entirely of my own invention
and has no current precedent, but I think that the addition of this ABI
might help solve a number of issues with the WebAssembly targets.

When `wasm32-unknown-unknown` was first added to Rust I naively
"implemented an abi" for the target. I then went to write `wasm-bindgen`
which accidentally relied on details of this ABI. Turns out the ABI
definition didn't match C, which is causing issues for C/Rust interop.
Currently the compiler has a "wasm32 bindgen compat" ABI which is the
original implementation I added, and it's purely there for, well,
`wasm-bindgen`.

Another issue with the WebAssembly target is that it's not clear to me
when and if the default C ABI will change to account for WebAssembly's
multi-value feature (a feature that allows functions to return multiple
values). Even if this does happen, though, it seems like the C ABI will
be guided based on the performance of WebAssembly code and will likely
not match even what the current wasm-bindgen-compat ABI is today. This
leaves a hole in Rust's expressivity in binding WebAssembly where given
a particular import type, Rust may not be able to import that signature
with an updated C ABI for multi-value.

To fix these issues I had the idea of a new ABI for WebAssembly, one
called `wasm`. The definition of this ABI is "what you write
maps straight to wasm". The goal here is that whatever you write down in
the parameter list or in the return values goes straight into the
function's signature in the WebAssembly file. This special ABI is for
intentionally matching the ABI of an imported function from the
environment or exporting a function with the right signature.

With the addition of a new ABI, this enables rustc to:

* Eventually remove the "wasm-bindgen compat hack". Once this
  ABI is stable wasm-bindgen can switch to using it everywhere.
  Afterwards the wasm32-unknown-unknown target can have its default ABI
  updated to match C.

* Expose the ability to precisely match an ABI signature for a
  WebAssembly function, regardless of what the C ABI that clang chooses
  turns out to be.

* Continue to evolve the definition of the default C ABI to match what
  clang does on all targets, since the purpose of that ABI will be
  explicitly matching C rather than generating particular function
  imports/exports.

Naturally this is implemented as an unstable feature initially, but it
would be nice for this to get stabilized (if it works) in the near-ish
future to remove the wasm32-unknown-unknown incompatibility with the C
ABI. Doing this, however, requires the feature to be on stable because
wasm-bindgen works with stable Rust.
2021-04-08 08:03:18 -07:00
..
const_fn_mir only run RemoveZsts at mir-opt-level 3 and above 2021-03-22 18:30:56 -04:00
emit-shared-files change SourceSerifPro to SourceSerif4 in emit-shared-files test 2021-04-05 10:51:37 +02:00
env-dep-info proc_macro: Add API for tracked access to environment variables 2020-07-26 13:37:37 +03:00
fmt-write-bloat Add test to check for fmt::write bloat. 2020-11-29 11:38:51 +01:00
incr-prev-body-beyond-eof test: run-make: skip tests on unsupported platforms 2021-03-28 16:50:56 +01:00
issue-36710 test: run-make: skip tests on unsupported platforms 2021-03-28 16:50:56 +01:00
issue-83112-incr-test-moved-file test: run-make: skip tests on unsupported platforms 2021-03-28 16:50:56 +01:00
libtest-thread-limit [libtest] Run the test synchronously when hitting thread limit 2021-02-17 21:38:25 +08:00
llvm-outputs add test for issue #21335 2018-11-26 12:41:43 -05:00
rustc-macro-dep-files expand: Stop using nonterminals for passing tokens to attribute and derive macros 2020-07-01 13:13:21 +03:00
static-pie Fix src/test/run-make/static-pie/test-aslr.rs 2020-07-13 11:33:03 +02:00
thumb-none-cortex-m Provide bootstrap tools with RUSTC in environment 2020-09-20 16:39:13 -04:00
thumb-none-qemu fix shellcheck error of SC2148 2020-11-06 20:33:12 +09:00
unstable-flag-required Fix handling of --output-format json flag 2021-04-06 18:41:17 -04:00
wasm-abi rustc: Add a new wasm ABI 2021-04-08 08:03:18 -07:00
wasm-custom-section Upgrade Emscripten targets to use upstream LLVM backend 2019-10-16 17:06:48 -07:00
wasm-custom-sections-opt Upgrade Emscripten targets to use upstream LLVM backend 2019-10-16 17:06:48 -07:00
wasm-export-all-symbols Check for the entry kind 2020-01-08 10:05:44 +01:00
wasm-import-module Update tests for extern block linting 2021-01-13 07:49:16 -05:00
wasm-panic-small Use Cell::take in a couple places 2020-04-26 11:50:53 +02:00
wasm-stringify-ints-small Change opt-level from 2 back to 3 2020-01-30 15:40:14 -05:00
wasm-symbols-different-module Fix handling of wasm import modules and names 2019-12-16 14:43:46 -08:00
wasm-symbols-not-exported Upgrade Emscripten targets to use upstream LLVM backend 2019-10-16 17:06:48 -07:00
wasm-symbols-not-imported Upgrade Emscripten targets to use upstream LLVM backend 2019-10-16 17:06:48 -07:00
x86_64-fortanix-unknown-sgx-lvi fix shellcheck error of SC2148 2020-11-06 20:33:12 +09:00
git_clone_sha1.sh Remove licenses 2018-12-25 21:08:33 -07:00