Cranellift: remove Baldrdash support and related features. (#4571)

* Cranellift: remove Baldrdash support and related features.

As noted in Mozilla's bugzilla bug 1781425 [1], the SpiderMonkey team
has recently determined that their current form of integration with
Cranelift is too hard to maintain, and they have chosen to remove it
from their codebase. If and when they decide to build updated support
for Cranelift, they will adopt different approaches to several details
of the integration.

In the meantime, after discussion with the SpiderMonkey folks, they
agree that it makes sense to remove the bits of Cranelift that exist
to support the integration ("Baldrdash"), as they will not need
them. Many of these bits are difficult-to-maintain special cases that
are not actually tested in Cranelift proper: for example, the
Baldrdash integration required Cranelift to emit function bodies
without prologues/epilogues, and instead communicate very precise
information about the expected frame size and layout, then stitched
together something post-facto. This was brittle and caused a lot of
incidental complexity ("fallthrough returns", the resulting special
logic in block-ordering); this is just one example. As another
example, one particular Baldrdash ABI variant processed stack args in
reverse order, so our ABI code had to support both traversal
orders. We had a number of other Baldrdash-specific settings as well
that did various special things.

This PR removes Baldrdash ABI support, the `fallthrough_return`
instruction, and pulls some threads to remove now-unused bits as a
result of those two, with the  understanding that the SpiderMonkey folks
will build new functionality as needed in the future and we can perhaps
find cleaner abstractions to make it all work.

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1781425

* Review feedback.

* Fix (?) DWARF debug tests: add `--disable-cache` to wasmtime invocations.

The debugger tests invoke `wasmtime` from within each test case under
the control of a debugger (gdb or lldb). Some of these tests started to
inexplicably fail in CI with unrelated changes, and the failures were
only inconsistently reproducible locally. It seems to be cache related:
if we disable cached compilation on the nested `wasmtime` invocations,
the tests consistently pass.

* Review feedback.
This commit is contained in:
Chris Fallin
2022-08-02 12:37:56 -07:00
committed by GitHub
parent ff37c9d8a4
commit 43f1765272
57 changed files with 221 additions and 1134 deletions

View File

@@ -405,7 +405,10 @@ retlist : paramlist
param : type [paramext] [paramspecial]
paramext : "uext" | "sext"
paramspecial : "sret" | "link" | "fp" | "csr" | "vmctx" | "sigid" | "stack_limit"
callconv : "fast" | "cold" | "system_v" | "fastcall" | "baldrdash_system_v" | "baldrdash_windows"
callconv : "fast" | "cold" | "system_v" | "windows_fastcall"
| "wasmtime_system_v" | "wasmtime_fastcall"
| "apple_aarch64" | "wasmtime_apple_aarch64"
| "probestack"
```
A function's calling convention determines exactly how arguments and return
@@ -430,8 +433,6 @@ system, a function's calling convention is only fully determined by a
| cold | not-ABI-stable convention for infrequently executed code |
| system_v | System V-style convention used on many platforms |
| fastcall | Windows "fastcall" convention, also used for x64 and ARM |
| baldrdash_system_v | SpiderMonkey WebAssembly convention on platforms natively using SystemV. |
| baldrdash_windows | SpiderMonkey WebAssembly convention on platforms natively using Windows. |
The "not-ABI-stable" conventions do not follow an external specification and
may change between versions of Cranelift.
@@ -682,7 +683,7 @@ H = dynamic Base, min MinBytes, bound BoundGV, offset_guard OffsetGuardBytes
#### Heap examples
The SpiderMonkey VM prefers to use fixed heaps with a 4 GB bound and 2 GB of
Some Wasm VMs prefer to use fixed heaps with a 4 GB bound and 2 GB of
offset-guard pages when running WebAssembly code on 64-bit CPUs. The combination
of a 4 GB fixed bound and 1-byte bounds checks means that no code needs to be
generated for bounds checks at all:
@@ -690,7 +691,7 @@ generated for bounds checks at all:
```
test verifier
function %add_members(i32, i64 vmctx) -> f32 baldrdash_system_v {
function %add_members(i32, i64 vmctx) -> f32 {
gv0 = vmctx
gv1 = load.i64 notrap aligned gv0+64
heap0 = static gv1, min 0x1000, bound 0x1_0000_0000, offset_guard 0x8000_0000
@@ -711,7 +712,7 @@ KB offset-guard page still has opportunities for sharing bounds checking code:
```
test verifier
function %add_members(i32, i32 vmctx) -> f32 baldrdash_system_v {
function %add_members(i32, i32 vmctx) -> f32 {
gv0 = vmctx
gv1 = load.i32 notrap aligned gv0+64
heap0 = static gv1, min 0x1000, bound 0x10_0000, offset_guard 0x1000
@@ -735,7 +736,7 @@ full bounds checking is required for each access:
```
test verifier
function %add_members(i32, i64 vmctx) -> f32 baldrdash_system_v {
function %add_members(i32, i64 vmctx) -> f32 {
gv0 = vmctx
gv1 = load.i64 notrap aligned gv0+64
gv2 = load.i32 notrap aligned gv0+72