Add br_on_cast_fail instruction to baseline
Categories
(Core :: JavaScript: WebAssembly, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox107 | --- | fixed |
People
(Reporter: rhunt, Assigned: jseward)
References
Details
Attachments
(3 files)
Implement the following concrete casting instructions in baseline:
br_on_cast
br_on_cast_fail
All of these take a type index, there are some casting operations that operate on a heap type but those will be in a separate bug. ref.cast/test
are already implemented in baseline.
Reporter | ||
Comment 1•2 years ago
|
||
Whoah, I completely forgot that I already implemented br_on_cast. The work in this bug will be just to implement the inverted version then.
Assignee | ||
Comment 2•2 years ago
|
||
WIP patch with some initial cleanups and comments. See commit message in patch for details.
Assignee | ||
Comment 3•2 years ago
|
||
This is a cleanup change created while studying what it would take to implement
br_on_cast_fail for wasm baseline. Currently WasmOpIter.h has routines
OpIter<Policy>::popThenPushType and OpIter<Policy>::topWithTypeAndPush which
are almost identical, and neither is well documented.
The names are particularly confusing because they imply different behaviour
with respect to the total number of elements in the stack (pop vs top) whereas
in fact neither routine removes elements from the stack.
This patch merges them and renames the resulting routine
OpIter<Policy>::checkTopTypeMatches, which describes better what it does.
Comments have also been added.
Related small ridealong fix: js::wasm::TypeAndValueT: removed ::typeRef() and
added ::setType() for consistency with ::value/::setValue. And because names
involving "ref" and "type" are a potential source of confusion.
Updated•2 years ago
|
Assignee | ||
Comment 4•2 years ago
|
||
This patch implements br_on_cast_fail for wasm baseline, in a way which shares
almost all code with the existing br_on_cast. Main changes:
-
BaseCompiler::emitBrOnCast: renamed to ::emitBrOnCastCOMMON, which handles
both the on-cast-success and on-cast-failure cases. -
OpIter<Policy>::checkCastedBranchValueAndPush has been removed and then
reinstated (with changes) as ::readBrOnCastCOMMON, which as above handles
both the on-cast-success and on-cast-failure cases. Removal of this (in
effect, inlining it into its one-and-only caller) means the validation logic
and associated comments are located in only one place rather than two. -
OpIter<Policy>::readBrOnCastCOMMON: add comments to explain the types
involved, and the validation and run-time checks required. These are then
implemented. -
new test case tests/wasm/gc/br-on-cast-fail.js
Depends on D158492
Comment 6•2 years ago
|
||
bugherder |
Comment 8•2 years ago
|
||
bugherder |
Description
•