Cranelift aarch64: support multi-values
Categories
(Core :: JavaScript: WebAssembly, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox79 | --- | fixed |
People
(Reporter: bbouvier, Assigned: cfallin)
References
Details
Attachments
(4 files, 2 obsolete files)
Opening this bug to put up a WIP patch to support multi-value in Baldrdash, based on Chris's PR: https://github.com/bytecodealliance/wasmtime/pull/1774
Reporter | ||
Comment 1•5 years ago
|
||
Reporter | ||
Comment 2•5 years ago
|
||
Reporter | ||
Comment 3•5 years ago
|
||
Ah, actually we need to pass a proper ModuleTranslationState
which contains function types, which will need to be duplicated.
Reporter | ||
Comment 4•5 years ago
|
||
Updated patch; there's now an error in Cranelift, which might be a preexisting one. To be investigated more!
Reporter | ||
Comment 5•5 years ago
|
||
Note: to make it work, this is also needed on the wasmtime's side:
diff --git a/cranelift/wasm/src/state/module_state.rs b/cranelift/wasm/src/state/module_state.rs
index e99730585..52c650b5e 100644
--- a/cranelift/wasm/src/state/module_state.rs
+++ b/cranelift/wasm/src/state/module_state.rs
@@ -3,8 +3,7 @@ use cranelift_entity::PrimaryMap;
use std::boxed::Box;
/// Map of signatures to a function's parameter and return types.
-pub(crate) type WasmTypes =
- PrimaryMap<SignatureIndex, (Box<[wasmparser::Type]>, Box<[wasmparser::Type]>)>;
+pub type WasmTypes = PrimaryMap<SignatureIndex, (Box<[wasmparser::Type]>, Box<[wasmparser::Type]>)>;
/// Contains information decoded from the Wasm module that must be referenced
/// during each Wasm function's translation.
@@ -28,4 +27,9 @@ impl ModuleTranslationState {
wasm_types: PrimaryMap::new(),
}
}
+
+ /// Creates a new ModuleTranslationState with the given signature types.
+ pub fn with_sig_types(wasm_types: WasmTypes) -> Self {
+ Self { wasm_types }
+ }
}
Also: this was an experiment to make it work, and should not land as is. There are a few back and forths between types here (from Spidermonkey's types to Cranelift's types to wasmparser types), and I think we should propose to rework the ModuleTranslationState
(e.g. make it a trait) before doing this the proper way.
Updated•5 years ago
|
Assignee | ||
Comment 6•5 years ago
•
|
||
Assignee | ||
Comment 7•5 years ago
|
||
To briefly note here, the plan is to land multivalue support for aarch64 on the Cranelift side first (Wasmtime PR #1774), then version-bump Cranelift and make use of the multivalue support in one patch on the mozilla-central side. We have some new test failures in Spidermonkey-using-Cranelift, and these need multivalue support to resolve, so unfortunately the three issues (current CL failures, version bump of CL, and multivalue support) are intertwined.
Assignee | ||
Comment 8•5 years ago
|
||
DO NOT COMMIT as-is: we need to get the above commit into mainline
Wasmtime first.
Updated•5 years ago
|
Assignee | ||
Comment 9•5 years ago
|
||
This is an updated version of Ben Bouvier's patch D77227.
Co-authored-by: Benjamin Bouvier <benj@benj.me>
Depends on D78587
Assignee | ||
Comment 10•5 years ago
|
||
This is an adaptation of @bbouvier's patch D77228, updated to avoid
passing wasmparser types across the API boundary between SpiderMonkey
and Cranelift.
Co-authored-by: Benjamin Bouvier <benj@benj.me>
Depends on D78588
Assignee | ||
Comment 11•5 years ago
|
||
Just added a patch series that is an updated of Ben's patches together with a version-bump of Cranelift.
This depends on the Cranelift PR to be merged first; once that happens, I'll update D78587 (the vendoring patch) with the proper commit hash from bytecodealliance/wasmtime.
I've modified Ben's patch a bit to not pass wasmparser
types over the API boundary; if there are better ways to do this then we can clean it up further, of course.
With these patches, we pass all Wasm tests except for the 3 interrupt-test failures noted in Bug 1641264.
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Comment 12•5 years ago
|
||
Comment 13•5 years ago
•
|
||
Backed out for build bustages.
Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=305994046&repo=autoland&lineNumber=24829
Backout: https://hg.mozilla.org/integration/autoland/rev/0de2b561c2d857895ef02ae774b84e83f8368b77
Assignee | ||
Comment 14•5 years ago
|
||
Argh, sorry about that: it seems that the build on CI uses an older version of Rust, and a few uses of matches!()
(a newer feature) have crept into the Cranelift codebase. I'll fix it on the CL side and then revendor.
Updated•5 years ago
|
Comment 15•5 years ago
|
||
Comment 16•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/7b4f55719649
https://hg.mozilla.org/mozilla-central/rev/23fd1073665e
https://hg.mozilla.org/mozilla-central/rev/3a1b105a612c
Description
•