Lazy tiering: replace signal-based tier-up requests with compiled code
Categories
(Core :: JavaScript: WebAssembly, enhancement, P1)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox130 | --- | fixed |
People
(Reporter: jseward, Assigned: jseward)
References
Details
Attachments
(4 files)
Bug 1907151 provides an initial implementation of lazy tiering. Tier-up
requests are done by generating SIGILL (or OSX/Windows equivalents) and
handling the request in the signal handler. This is expensive and inflexible.
This bug is for replacing that mechanism with a compiled-code solution similar
to how debug-breakpoint trapping is done.
| Assignee | ||
Comment 1•1 year ago
|
||
For the pieces of code that wasm-baseline uses for debugging, we use a
confusing mismash of terms: debug-trap/stub/breakpoint. Also, it isn't clear
from the naming that there are two kinds of code fragments involved:
per-function and per-module fragments.
This patch reworks some names and comments, so that
-
pieces of code are referred to as "stubs"
-
"trap" is restricted to denoting the general event of temporarily leaving
baseline execution so as to enter the debug trap handler -
the distinction between per-function and per-module stubs is clearer, and
better documented
All of the above changes are for debug-support only events. There is no
change to terminology/names for other "trap" style events.
There are no functional changes at all.
| Assignee | ||
Comment 2•1 year ago
|
||
This implements lazy tier-up requesting by:
-
adding a new routine, WasmHandleRequestTierUp, which handles tier-up
requests -
creating a "request tier-up stub" in each module, which calls to on to the
above routine; this is similar to how debug-breakpoint requests are handled -
reimplementing BaseCompiler::addHotnessCheck, so as to call to the above
stub when required.
The code for the hotness check has been streamlined.
The previous SIGILL-based implementation remains in place, partially commented
out. It will be removed by the next patch in this series.
| Assignee | ||
Comment 3•1 year ago
|
||
This removes wasm::Trap::CheckHotness, the code that generates that trap, and
the code that handles it. This mechanism has been replaced by a call-based
scheme in the previous patch in this series.
| Assignee | ||
Comment 4•1 year ago
|
||
Currently WasmHandleRequestTierUp calls GetNearestEffectiveInstance to find
the relevant Instance*. This can be very expensive if the stack is deep.
It's also pointless, because the tier-up request it is responding to itself
knows the Instance*. So this patch merely causes the request-tier-up stub to
pass the value in InstanceReg as a parameter. This is easy to do because
we're guaranteed that InstanceReg has the right value at the start of the
request-tier-up, even on targets where it isn't pinned.
Comment 6•1 year ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/d126e058b96e
https://hg.mozilla.org/mozilla-central/rev/ab7cabbd6494
https://hg.mozilla.org/mozilla-central/rev/b86ce0e6556b
https://hg.mozilla.org/mozilla-central/rev/b26822e772f3
https://hg.mozilla.org/mozilla-central/rev/d231ea667322
Description
•