Optimize call_indirect for table64
Categories
(Core :: JavaScript: WebAssembly, enhancement, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox143 | --- | fixed |
People
(Reporter: rhunt, Assigned: bvisness)
References
Details
Attachments
(2 files, 1 obsolete file)
All table64 operations in JIT code put index parameters through a clamping operation to turn them UINT32_MAX if they are outside the 32-bit range. This let us keep our bounds checks the same. It works because our maximum table length at runtime is much less than UINT32_MAX. Most table operations are also not that performance sensitive at this time.
However, this extra overhead could be significant for call_indirect. We should measure and possibly optimize.
| Reporter | ||
Comment 1•1 year ago
|
||
We should try to do this sometime soon, now that we're shipping memory64.
| Assignee | ||
Comment 2•11 months ago
|
||
We currently do bounds checks for call_indirect at the masm level, and
always as 32-bit. This is not ideal now that we have table64, since it
forces us to clamp our address and length values down to 32 bits.
This patch removes the bounds check from masm and the corresponding
optimization logic from lowering. Instead, it moves the optimization
logic into MIR and LIR. Specifically:
- If the index is constant and less than the table's min size, the
bounds check is eliminated. (To be done in follow-up patch.) - If the table has a fixed length, a constant is emitted instead of a
load, and we will compare against an immediate instead of a register
or memory operand. - If the bounds check limit is an MWasmLoadInstance (as it is for
tables), then the load will be emitted at use as a memory operand to
the bounds check instead of a load to a register.
Updated•11 months ago
|
| Assignee | ||
Comment 3•10 months ago
|
||
This extends our existing WasmBCE pass to work for tables, and also
multiple memories.
| Assignee | ||
Comment 4•10 months ago
|
||
It seems like the phi path is actually not used. We can remove the code
to avoid future maintenance and bugs.
Updated•10 months ago
|
Updated•10 months ago
|
https://hg.mozilla.org/mozilla-central/rev/579959211efb
https://hg.mozilla.org/mozilla-central/rev/5c9abbdacf68
Updated•9 months ago
|
Description
•