Wasm Exception Handling in Wasm-baseline: tests failing involving a call_indirect rethrowing
Categories
(Core :: JavaScript: WebAssembly, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox97 | --- | fixed |
People
(Reporter: idimitriou, Assigned: idimitriou)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
Currently the following tests fail for the Wasm exception handling implementation in Wasm-baseline:
function failureCallingTestFunction() {
let exports = wasmEvalText(
`(module
(tag $exn (export "exn"))
(func $throwExn (export "throwExn")
;; Note that this does not fail if this function body is a plain (throw $exn).
(try
(do (throw $exn)))))`
).exports;
let mod =
`(module
(type $exnType (func))
(type $indirectFunctype (func))
(import "m" "exn" (tag $exn (type $exnType)))
(import "m" "throwExn" (func $throwExn (type $indirectFunctype)))
(table funcref (elem $throwExn))
(func (export "testFunc") (result i32)
(try
(do (call_indirect (type $indirectFunctype) (i32.const 0)))
(catch_all))
(i32.const 1)))`;
let testFunction = wasmEvalText(mod, { m : exports}).exports.testFunc;
testFunction();
};
function failureRethrow1() {
let exports = wasmEvalText(
`(module
(tag $exn (export "exn"))
(func $throwExn (export "throwExn")
(try
(do (throw $exn))
(catch_all
(try
(do (throw $exn))
(catch_all (rethrow 1)))))))`
).exports;
let mod =
`(module
(type $exnType (func))
(type $indirectFunctype (func))
(import "m" "exn" (tag $exn (type $exnType)))
(import "m" "throwExn" (func $throwExn (type $indirectFunctype)))
(table funcref (elem $throwExn))
(func (export "testFunc") (result i32)
(try
(do (call_indirect (type $indirectFunctype) (i32.const 0)))
(catch_all))
(i32.const 1)))`;
let testFunction = wasmEvalText(mod, { m : exports}).exports.testFunc;
testFunction();
};
failureCallingTestFunction();
failureRethrow1();
I will be attaching a WIP patch with a partial solution, based on suggestions by @lth and @rhunt for the revisions in Core-Wasm-EH-Ion (bug 1695778), which solves the first test failure caused by failureCallingTestFunction()
.
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 1•2 years ago
|
||
This is a partial fix for failing test cases from WebAssembly exceptions
being thrown, caught, and then rethrown in imported functions called
indirectly.
Added a test file with the tests that fail without this partial fix, from
this bug's description. Note that these tests don't even contain assertions,
and with this partial fix, only the second call (to failureRethrow1()
)
fails and only when gczeal(2,1)
is uncommented.
Added an extended test file with the flag gczeal(2,1)
which partially
fails only in debug builds.
None of the tests fail in non-debug builds with this partial fix.
This solution was originally part of Core-Wasm-EH-Ion part 1 (bug 1695778),
and works well with those patches (no errors from Ion there, even with
debug builds).
Updated•2 years ago
|
Assignee | ||
Comment 2•2 years ago
|
||
It seems that these tests were not failing before the call_indirect optimisations, so I talked to @dbezhetskov about this and he came up with the solution to complete the WIP patch. Will be uploading shortly.
Sent to try, together with the patches in bug 1695778 (Core-Wasm-EH-Ion): https://treeherder.mozilla.org/jobs?repo=try&revision=d1772434dfc2ce459d1d8e756b830bccaee1dd9d
Updated•2 years ago
|
Assignee | ||
Comment 3•2 years ago
|
||
I had forgotten to put v128
related parts of the last test 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
Pushed by rhunt@eqrion.net: https://hg.mozilla.org/integration/autoland/rev/f44ea03ca037 Wasm-EH: fix call_indirect rethrows in Wasm-baseline. r=lth
Comment 5•2 years ago
|
||
bugherder |
Description
•