Closed Bug 1947614 Opened 1 year ago Closed 1 year ago

Improve code generation of struct accesses

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
137 Branch
Tracking Status
firefox137 --- fixed

People

(Reporter: rhunt, Assigned: rhunt)

References

Details

Attachments

(1 file)

struct.get generates keep alive uses even when not strictly necessary and this leads to some intense register pressure on some benchmarks.

We only need to emit a keepAlive register constraint for structs if we're
accessing outline data. But right now we always unconditionally do this
and it leads to extra register pressure.

The way we used to have an optional keepAlive was by having a separate
MIR node. This commit changes it so that if you pass the same 'base'
and 'keepAlive' values, that lowering skips emitting the keepAlive
node. This lets us drop one MIR node, and then drop all the 'KA'
suffixes from our MIR nodes as they all take an optional keepAlive.

And some other cleanups while I'm here.

  • fieldIndex becomes structFieldIndex, and optional. Don't use it for
    exception nodes, as they do not participate in SRA.
  • Fix some warnings about using std::move with TrapSiteDesc.
  • Rename ka to keepAlive, and make it the final operand.
  • Rename obj/data/etc, to just be 'base' for all nodes.

One other important change here is to 'useRegisterAtStart' for the
'base' parameter of the struct load MIR node. This lets the register
allocator re-use the base register for the output register.

Pushed by rhunt@eqrion.net: https://hg.mozilla.org/integration/autoland/rev/270bbd6b41bb wasm: Don't emit MKeepAlive for struct.get if not needed. r=bvisness
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 137 Branch
Regressions: 2024918
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: