Closed Bug 1934692 Opened 1 year ago Closed 1 year ago

Improve codegen for wasm subtype checks

Categories

(Core :: JavaScript: WebAssembly, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
139 Branch
Tracking Status
firefox139 --- fixed

People

(Reporter: rhunt, Assigned: bvisness)

References

(Blocks 2 open bugs)

Details

Attachments

(2 files, 2 obsolete files)

When we cast, we generate a testing node which is branched on at the MIR level. The failure case for the cast goes to a basic block with a single wasm trap node. We should find a way to ensure that block gets moved away from all other code in the function. Essentially move it 'out of line'.

Tweak the masm so that the final conditional branch in a cast goes
to the caller specified 'label' instead of the 'cast success' branch.

This lets us eliminate a jump instruction in the case that we're
trying to branch OOL on cast failure.

Assignee: nobody → rhunt
Status: NEW → ASSIGNED
Depends on: 1949860
Blocks: 1949860
No longer depends on: 1949860
Depends on: 1949849

Besides the improvements Ryan mentioned above, we can also improve codegen in our masm routines to avoid unnecessary jumps.

Assignee: rhunt → bvisness
Summary: Move traps for casting OOL → Improve codegen for wasm casts

Cleans up codegen for wasm subtype checks to avoid unnecessary short
jumps and to branch directly to the destination on the most common
paths.

Depends on D239958

Attachment #9467776 - Attachment is obsolete: true
Attachment #9469026 - Attachment is obsolete: true
No longer depends on: 1949849
Blocks: 1951158

This bug ended up with two chunks of work that have turned out to be independent: moving the trap from bug 1949849's MWasmRefCast out of line, and tweaking the masm for the subtype checks to avoid unnecessary jumps. The former seems to be better done in bug 1949849 (and currently resides there anyway), and the latter can be done at any time. Therefore I'm shuffling the dependencies so we can land this tiny tweak more quickly.

Blocks: wasm-ref-mir
No longer blocks: 1949860, 1951158
Summary: Improve codegen for wasm casts → Improve codegen for wasm subtype checks
Pushed by bvisness@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/01ba02821657 wasm: Avoid unnecessary branches in casts. r=rhunt https://hg.mozilla.org/integration/autoland/rev/d36f5081af48 Add a fast path to STV checks. r=rhunt
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 139 Branch
QA Whiteboard: [qa-triage-done-c140/b139]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: