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:
@@ -170,17 +170,8 @@ fn define_settings(shared: &SettingGroup) -> SettingGroup {
|
||||
// back in the shared SettingGroup, and use it in x86 instruction predicates.
|
||||
|
||||
let is_pic = shared.get_bool("is_pic");
|
||||
let emit_all_ones_funcaddrs = shared.get_bool("emit_all_ones_funcaddrs");
|
||||
settings.add_predicate("is_pic", predicate!(is_pic));
|
||||
settings.add_predicate("not_is_pic", predicate!(!is_pic));
|
||||
settings.add_predicate(
|
||||
"all_ones_funcaddrs_and_not_is_pic",
|
||||
predicate!(emit_all_ones_funcaddrs && !is_pic),
|
||||
);
|
||||
settings.add_predicate(
|
||||
"not_all_ones_funcaddrs_and_not_is_pic",
|
||||
predicate!(!emit_all_ones_funcaddrs && !is_pic),
|
||||
);
|
||||
|
||||
// Presets corresponding to x86 CPUs.
|
||||
|
||||
|
||||
@@ -332,24 +332,6 @@ fn define_control_flow(
|
||||
.is_terminator(true),
|
||||
);
|
||||
|
||||
let rvals = &Operand::new("rvals", &entities.varargs).with_doc("return values");
|
||||
ig.push(
|
||||
Inst::new(
|
||||
"fallthrough_return",
|
||||
r#"
|
||||
Return from the function by fallthrough.
|
||||
|
||||
This is a specialized instruction for use where one wants to append
|
||||
a custom epilogue, which will then perform the real return. This
|
||||
instruction has no encoding.
|
||||
"#,
|
||||
&formats.multiary,
|
||||
)
|
||||
.operands_in(vec![rvals])
|
||||
.is_return(true)
|
||||
.is_terminator(true),
|
||||
);
|
||||
|
||||
let FN = &Operand::new("FN", &entities.func_ref)
|
||||
.with_doc("function to call, declared by `function`");
|
||||
let args = &Operand::new("args", &entities.varargs).with_doc("call arguments");
|
||||
|
||||
@@ -88,8 +88,8 @@ pub(crate) fn define() -> SettingGroup {
|
||||
"avoid_div_traps",
|
||||
"Generate explicit checks around native division instructions to avoid their trapping.",
|
||||
r#"
|
||||
This is primarily used by SpiderMonkey which doesn't install a signal
|
||||
handler for SIGFPE, but expects a SIGILL trap for division by zero.
|
||||
Generate explicit checks around native division instructions to
|
||||
avoid their trapping.
|
||||
|
||||
On ISAs like ARM where the native division instructions don't trap,
|
||||
this setting has no effect - explicit checks are always inserted.
|
||||
@@ -175,8 +175,6 @@ pub(crate) fn define() -> SettingGroup {
|
||||
vec!["none", "elf_gd", "macho", "coff"],
|
||||
);
|
||||
|
||||
// Settings specific to the `baldrdash` calling convention.
|
||||
|
||||
settings.add_enum(
|
||||
"libcall_call_conv",
|
||||
"Defines the calling convention to use for LibCalls call expansion.",
|
||||
@@ -196,29 +194,10 @@ pub(crate) fn define() -> SettingGroup {
|
||||
"system_v",
|
||||
"windows_fastcall",
|
||||
"apple_aarch64",
|
||||
"baldrdash_system_v",
|
||||
"baldrdash_windows",
|
||||
"baldrdash_2020",
|
||||
"probestack",
|
||||
],
|
||||
);
|
||||
|
||||
settings.add_num(
|
||||
"baldrdash_prologue_words",
|
||||
"Number of pointer-sized words pushed by the baldrdash prologue.",
|
||||
r#"
|
||||
Functions with the `baldrdash` calling convention don't generate their
|
||||
own prologue and epilogue. They depend on externally generated code
|
||||
that pushes a fixed number of words in the prologue and restores them
|
||||
in the epilogue.
|
||||
|
||||
This setting configures the number of pointer-sized words pushed on the
|
||||
stack when the Cranelift-generated code is entered. This includes the
|
||||
pushed return address on x86.
|
||||
"#,
|
||||
0,
|
||||
);
|
||||
|
||||
settings.add_bool(
|
||||
"enable_llvm_abi_extensions",
|
||||
"Enable various ABI extensions defined by LLVM's behavior.",
|
||||
@@ -277,15 +256,6 @@ pub(crate) fn define() -> SettingGroup {
|
||||
false,
|
||||
);
|
||||
|
||||
// BaldrMonkey requires that not-yet-relocated function addresses be encoded
|
||||
// as all-ones bitpatterns.
|
||||
settings.add_bool(
|
||||
"emit_all_ones_funcaddrs",
|
||||
"Emit not-yet-relocated function addresses as all-ones bit patterns.",
|
||||
"",
|
||||
false,
|
||||
);
|
||||
|
||||
// Stack probing options.
|
||||
|
||||
settings.add_bool(
|
||||
|
||||
Reference in New Issue
Block a user