Closed Bug 1935289 Opened 11 months ago Closed 10 months ago

Offthread Baseline: initial implementation

Categories

(Core :: JavaScript Engine: JIT, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
136 Branch
Tracking Status
firefox136 --- fixed

People

(Reporter: iain, Assigned: iain)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

Attachments

(13 files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

I have a mostly working version of offthread baseline compilation. This bug is for landing that, disabled by default. In subsequent bugs, I'll work on improving the performance enough to turn it on.

This will no longer be Warp-specific.

I tried to isolate most of the mechanical boilerplate into its own patch. This is based on IonCompileTask.

This is no longer Ion-specific.

This performs the actual off-thread compilation. Making the result available on the main thread comes later.

In latin1/date.js, test() has actually been broken in Ion since bug 1784023 added support for removing unused calls to indexOf. If lat1 + '\u1200' does not fit in an inline string, then we will create a rope. If indexOf is optimized away, then substr on the unflattened rope will only look at the right child, and will return a latin1 string, triggering the assertion. For reasons that aren't entirely clear to me, running the test with --baseline-offthread-compile=on --ion-offthread-compile=off exposed the bug by getting us into Ion at the right time.

recoverObjects.js expects us to always inline particular callees. If offthread baseline compilation takes long enough, then we may have already exceeded the trial inlining warmup threshold by the time we finish the baseline compile, meaning that we won't do any inlining. In the long run it would be good to fix this by guaranteeing that we don't skip inlining. That's somewhat tricky, though. I considered triggering trial inlining while finishing a compilation on the main thread in cases where the warmup counter had already exceeded the threshold, but we do trial inlining per ICScript, not per JSScript, so that doesn't work for recursive inlining.

BaselineCompiler::emitDebugTrap uses the Debug API to find breakpoints. It can't be accessed from the main thread.

We could include a list of breakpoints in the snapshot, but baseline compilation performance is not that important when debugging.

TSAN doesn't like it when we access mutable script flags offthread.

Blocks: 1937672
Pushed by iireland@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/26673c9ed156 Add BaselineSnapshot r=jandem https://hg.mozilla.org/integration/autoland/rev/ebc7affe24f6 Rename WarpGCPtr to OffthreadGCPtr r=jandem https://hg.mozilla.org/integration/autoland/rev/9c8ba30f7c13 Add skeleton of BaselineCompileTask r=jandem https://hg.mozilla.org/integration/autoland/rev/7a6623672119 Rename IonHeapMacroAssembler to OffThreadMacroAssembler r=jandem https://hg.mozilla.org/integration/autoland/rev/de20bf596703 Implement BaselineCompileTask::runTask r=jandem https://hg.mozilla.org/integration/autoland/rev/60ee7cd1a632 Add BaselineCompilingScriptPtr r=jandem https://hg.mozilla.org/integration/autoland/rev/0160e0fc01a0 Finish offthread baseline compilation on main thread r=jandem https://hg.mozilla.org/integration/autoland/rev/804e4fb521ce Support cancelling off-thread baseline compilations r=jandem https://hg.mozilla.org/integration/autoland/rev/92f7637737c1 Add prefs r=jandem https://hg.mozilla.org/integration/autoland/rev/f4948f1d7709 Compile baseline code offthread r=jandem https://hg.mozilla.org/integration/autoland/rev/195268c19e9b Fix testcases r=jandem https://hg.mozilla.org/integration/autoland/rev/229417824fbb Disable offthread compilation for debug mode r=jandem https://hg.mozilla.org/integration/autoland/rev/e11e64eee863 Fix TSAN complaints r=jandem
Regressions: 1943901
Depends on: 1952778
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: