Closed Bug 1823857 Opened 2 years ago Closed 2 years ago

Minor tuning for wasm-gc code running on the arm64 simulator

Categories

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

ARM64
Unspecified
enhancement

Tracking

()

RESOLVED FIXED
113 Branch
Tracking Status
firefox113 --- fixed

People

(Reporter: jseward, Assigned: jseward)

Details

Attachments

(2 files)

Wasm-gc code (compiled by baseline) on the arm64 simulator runs
very slowly; a factor of 500 slowdown compared to natively. Here are
two minor fixes which improve performance marginally.

  • Code::lookupTrap: lift uint32_t target = ((uint8_t*)pc) - segment(t).base()
    out of a loop in which it is invariant; the compiler does not appear to do so.

  • The arm64 simulator: inline a couple of small routines which are very
    hot -- used for every simulated memory access.

Code::lookupTrap has

uint32_t target = ((uint8_t*)pc) - segment(t).base();

in a loop in which it is invariant. This patch lifts it out of the loop since
the clang++ 15.0.7 does not appear to do so, even at -O2. Reduces (host)
instruction count by around 10% on some artificial small wasm-gc tests.

The routines are used for loads and stores, so this minor improvement is
widely applicable. Reduces (host) instruction count by around 2% for
wasm-baseline generated arm64 code.

Depends on D173275

Pushed by jseward@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/774db827a9db part 1: Code::lookupTrap: lift an invariant expression out of a hot loop. r=rhunt. https://hg.mozilla.org/integration/autoland/rev/91aab2296ba3 part 2: arm64 simulator: inline a couple of small routines that are hot. r=rhunt.
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 113 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: