Implement the core wasm exception handling instructions in the optimizing compiler
Categories
(Core :: JavaScript: WebAssembly, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox97 | --- | fixed |
People
(Reporter: idimitriou, Assigned: idimitriou)
References
(Blocks 1 open bug)
Details
Attachments
(4 files)
For the WebAssembly Exception Handling proposal, extend support for try-catch and throw to the Ion compiler.
Comment 1•3 years ago
|
||
Note that we're in the process of landing Ion on ARM64 (bug 1678097) and until it lands you'll not have test coverage on that platform.
Assignee | ||
Comment 2•3 years ago
|
||
Adds support for the core of the WebAssembly Exception Handling instructions, try-catch/catch_all and throw.
This initial patch does not add support for WebAssembly values of type reftype inside exception packages.
This patch also does not implement the instructions rethrow
or delegate
, which will be part of a different bug.
Due to this, the tests that are targeting these two instructions are made conditional on the test being run with the baseline compiler.
There are tests added for side effects in try blocks, and tests with complex control flow with exceptions thrown from calls.
This builds on the current, landed version of Wasm EH, without the latest spec changes,
according to which try
can have no catches and event
s are renamed to tag
s.
When the relevant bugs for baseline are closed (1716869, 1716041, 1716043, 1717118),
I will update this patch accordingly.
Assignee | ||
Comment 3•3 years ago
|
||
The latest update implements catchless try blocks, since bug 1716043 has landed.
Updated•3 years ago
|
Assignee | ||
Comment 4•3 years ago
|
||
Adds tests mentioned in Bug 1727953.
Depends on D118283
Assignee | ||
Comment 5•3 years ago
|
||
Implements the instruction try-delegate
from the WebAssembly Exception Handling proposal, and enables try-delegate
related tests for the optimizing compiler.
Changes:
- Adds a try-tracker which notes the try-depths of all surrounding
Wasm-labels. - Shifts the pad-patches vector by 1, so patches delegated to the
function body get collected at padsPatches_[0]. - When EmitEnd has LabelKind::Body, any above pad patches are bound to a
landing pad that just rethrows the exception. - Once we read
delegate l
at a try-depth (sayd0
), we calculate the
try-depth for relative depth l (sayd1
), and we move padsPatches[d0] to
append them to padsPatches[d1], thus "tunnelling" any exceptions thrown
in the delegate's try block to the target landing pad.
Depends on D123884
Assignee | ||
Comment 6•3 years ago
•
|
||
I updated the revisions to the current stand, and added some documentation, in comments and in the commit messages. I also added part 3, which implements try-delegate.
The revision stack is now dependent on revision D124550, and part-1 adds the Ion parts in that implementation of the suggestions from the latest review comment.
Only one revision is now missing, support for reftype values in exceptions. A first implementation I have locally stills fails tests when gczeal(2, 1)
is enabled (the last test in reftypes.js).
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Assignee | ||
Comment 7•2 years ago
|
||
This patch concludes support for the WebAssembly Exception Handling proposal.
Spec: https://github.com/WebAssembly/exception-handling
Changes:
- Mirroring the Baseline approach, and the Ion approach for numeric values,
this patch adds two MIR and LIR nodes:- WasmExceptionRefsPointer to get a pointer to the ArrayObject REFS of a
WasmExceptionObject, and - WasmLoadExceptionRefsValue to get a RefOrNull value from a
WasmExceptionRefsPointer
- WasmExceptionRefsPointer to get a pointer to the ArrayObject REFS of a
- Storing a RefOrNull value in the exception is done via the instance call
SASigPushRefIntoExn. Since this pushes the value in the Refs Array, we
iterate backwards. - The above mentioned instance call is changed to follow this review
comment on part 1 of this patchset:
https://phabricator.services.mozilla.com/D118283#inline-716841 - Enables all tests in .../wasm/exceptions/, and adds reftypes in some
existing tests.
Depends on D126425
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Assignee | ||
Comment 8•2 years ago
•
|
||
With the help of @dbezhetskov, we fixed the issues with Wasm-baseline (bug 1744663).
Everything should be working now and I think all review comments are addressed.
Just did a mach try auto
with this patchset, including the patch from bug 1744663:
https://treeherder.mozilla.org/jobs?repo=try&revision=d1772434dfc2ce459d1d8e756b830bccaee1dd9d
Assignee | ||
Comment 9•2 years ago
|
||
I had forgotten to put v128 related parts of the last test in bug-1744663-extended.js
under the flag wasmSimdEnabled, which caused test failures.
Fixed this and rebased to the current tip. Some failing tests in the try, not sure how these failures are related to the code in these patches:
https://treeherder.mozilla.org/jobs?repo=try&revision=a8e469b98477c8054032f8894658d938929e8760
Comment 10•2 years ago
|
||
Pushed by rhunt@eqrion.net: https://hg.mozilla.org/integration/autoland/rev/6823e921b023 (Core-Wasm-EH-Ion) part 1: try-catch/throw without reftypes. r=rhunt https://hg.mozilla.org/integration/autoland/rev/4f1b07ddbdd5 (Core-Wasm-EH-Ion) part 2: rethrow. r=lth https://hg.mozilla.org/integration/autoland/rev/6af2787fb743 (Core-Wasm-EH-Ion) part 3: try-delegate. r=lth https://hg.mozilla.org/integration/autoland/rev/9f3a22091abd (Core-Wasm-EH-Ion) part 4: Support reftypes in exceptions. r=rhunt
Comment 11•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/6823e921b023
https://hg.mozilla.org/mozilla-central/rev/4f1b07ddbdd5
https://hg.mozilla.org/mozilla-central/rev/6af2787fb743
https://hg.mozilla.org/mozilla-central/rev/9f3a22091abd
Description
•