Add support for rtt based downcasting
Categories
(Core :: JavaScript: WebAssembly, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox88 | --- | fixed |
People
(Reporter: rhunt, Assigned: rhunt)
References
Details
Attachments
(6 files)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review |
Add support for the rtt value type, constructing types with an rtt, and downcasting values to an rtt.
| Assignee | ||
Comment 1•4 years ago
|
||
Clean up from class-scoped enum to enum class and use switches as
appropriate.
| Assignee | ||
Comment 2•4 years ago
|
||
The baseline compiler assumes the struct type given to an instruction
can be used to determine if the input value will be an inline or
outline struct. This is incorrect with subtyping. A test is added
and struct instructions are made dynamic upon the kind of TypedObject
given. Longer term we should optimize this further, but this was
simplest.
Depends on D104265
| Assignee | ||
Comment 3•4 years ago
|
||
This commit replaces the struct.new instruction with the
struct.new_with_rtt and rtt.canon instructions. The new struct
instruction takes an rtt value as an operand. An rtt value is defined
to be the TypeDescr JSObject currently used by the constructor of
TypedObject's. This gives rtt values the same representation as
our reference values, although this doesn't need to be the case
in the future. rtt.canon is then implemented as a load of the
TypeDescr* stored in the TlsData global area for the specific
type index. When we implement type canonicalization, the
initialization of the instance will be changed to store the
canonical TypeDescr* for each type index in each slot.
The ValType representation is changed in this commit to support
the depth field of an rtt. As we're now packing 5 separate fields
in PackedTypeCode, the approach of manual shifts and masks isn't
scaling anymore. The PackedTypeCode representation is changed to
a POD union with bitfields to make access easier. The bit width
was increased to 64 to support a reasonable amount of depth
values. If we can decrease any of the other fields we may be
able to bring the size back down to 32.
Depends on D104266
| Assignee | ||
Comment 4•4 years ago
|
||
This makes the purpose of these objects explicit.
Depends on D104267
| Assignee | ||
Comment 5•4 years ago
|
||
This commit adds rtt.sub as an instruction to form new RttValue's with
an explicit subtyping chain. This is implemented as a link from sub
rtt to parent rtt. Validation ensures that chains can only be formed
from a T <: U. Each execution of an rtt.sub instruction creates a new
rtt value. This may be changed in the future to align with the proper
spec semantics.
With rtt.sub, we can now implement ref.test/ref.cast/br_on_cast
instructions that operate on structs with an rtt. The subtyping
check is implemented as an instance call performing a linear
search through rtt chains.
Depends on D104268
| Assignee | ||
Comment 6•4 years ago
|
||
The struct.narrow instruction is no longer needed as we have the
ref.test/cast/br_on_null instructions.
Depends on D104269
Comment 8•4 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/fb5c84ab0c29
https://hg.mozilla.org/mozilla-central/rev/65719287d608
https://hg.mozilla.org/mozilla-central/rev/96a269bbe333
https://hg.mozilla.org/mozilla-central/rev/b2574104dc48
https://hg.mozilla.org/mozilla-central/rev/c2ff9297a1ab
https://hg.mozilla.org/mozilla-central/rev/a49689e0154a
Description
•