Investigate a way to find which missing allocation sites would be beneficial to add
Categories
(Core :: JavaScript: GC, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox128 | --- | fixed |
People
(Reporter: jonco, Assigned: jonco)
References
(Blocks 1 open bug)
Details
Attachments
(6 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 |
Adding an allocation site to track GC thing tenuring is not simple and there are a huge number places where we could do this. Adding them also has an overhead in terms of tracking and updating the associated data structures. It would be great if there was a way to find out which sites could be added to get the most benefit.
Possibly we could have a way to automatically add alloc sites in debug builds or in a special build (it's likely that this wouldn't be efficient enough for production use) and then report which sites were most effective and finding pretenuring opportunities.
Updated•9 months ago
|
Assignee | ||
Updated•8 months ago
|
Assignee | ||
Comment 1•8 months ago
|
||
This is follow on from bug 1894012. This allows hash tables to be used as
keys and values in hash tables that are used with WeakCache as we'll do in
these patches.
Assignee | ||
Comment 2•8 months ago
|
||
So we can use the frame iterater effectively, compile this in GC zeal builds as
well as debug builds. I added a new macro for this feature,
JS_CHECK_UNSAFE_CALL_WITH_ABI.
Assignee | ||
Comment 3•8 months ago
|
||
Currently we work this out by other means but it's simpler to store it directly
using the top bits of the bytecode offset.
I figure it's OK to only use 30 bits to store the offset since we store it in
28 bits in RetAddrEntry, although I couldn't find it documented how many bits
are actually required.
Assignee | ||
Comment 4•8 months ago
|
||
This adds a new kind of 'missing' allocation site and uses them to replace the
unknown alloction site when used from baseline. These count allocations and
promotions like normal sites but do not actually pretenure anything. Since this
requires extra machinery it is only supported in GC zeal builds.
This feature is enabled by setting the generateMissingAllocSites GC pref.
Assignee | ||
Comment 5•8 months ago
|
||
This adds the script file basename and line number and the bytecode op to the
output and tidies up the format to make it more regular.
Assignee | ||
Comment 6•8 months ago
|
||
There can be a large number of these so it's useful to restict the ones
reported by filtering on their attributes.
Assignee | ||
Comment 7•8 months ago
|
||
The feature can be enabled by passing --gc-param generateMissingAllocSites=1
to the shell.
Reporting can be enabled by setting an environment variable to filter the sites to output, e.g. JS_GC_REPORT_PRETENURE=100,missing,long
Example output:
~/clone/dev/js/src$ JS_GC_REPORT_PRETENURE=100,missing,unknown,long ./opt-build/shell --gc-param generateMissingAllocSites=1 --no-ion ~/software/matrix-react-bench/dist/main.js > /dev/null
...
Pretenuring info after minor GC 3 for OUT_OF_NURSERY reason with promotion rate 65.8%:
Site Zone Location BytecodeOp SiteKind TraceKind NAllocs Promotes PRate State
0x78f3e127d550 0x78f3e384ae00 main.js:55 New missing JS Object 618 618 100.0% LongLived
0x78f3e123cbb0 0x78f3e384ae00 self-hosted:3917 Call missing JS Object 1299 1299 100.0% LongLived
0x78f3e384b5d8 0x78f3e384ae00 unknown JS Object 6925 6307 Unknown
0x78f3e384b628 0x78f3e384ae00 unknown JS String 9925 2842 Unknown
6 alloc sites created, 76 active, 2 pretenured, 0 invalidated
Pretenuring info after minor GC 4 for OUT_OF_NURSERY reason with promotion rate 93.5%:
Site Zone Location BytecodeOp SiteKind TraceKind NAllocs Promotes PRate State
0x78f3e127d0a0 0x78f3e384ae00 main.js:55 New missing JS Object 1237 1237 100.0% LongLived
0x78f3e127d550 0x78f3e384ae00 main.js:55 New missing JS Object 2807 2807 100.0% LongLived
0x78f3e384b5d8 0x78f3e384ae00 unknown JS Object 4049 4049 Unknown
0 alloc sites created, 7 active, 1 pretenured, 0 invalidated
...
Comment 9•8 months ago
|
||
Backed out for causing SM bustages in JSScript.h
- Backout link
- Push with failures
- Failure Log
- Failure line: /builds/worker/checkouts/gecko/js/src/vm/JSScript.h:1591:15: error: inline function 'js::BaseScript::hasBaselineScript' is not defined [-Werror,-Wundefined-inline]
Assignee | ||
Updated•8 months ago
|
Comment 10•8 months ago
|
||
Comment 11•8 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/041f7d0ceeb8
https://hg.mozilla.org/mozilla-central/rev/481ef9d2c08b
https://hg.mozilla.org/mozilla-central/rev/357acd25ef9e
https://hg.mozilla.org/mozilla-central/rev/e98c27b09176
https://hg.mozilla.org/mozilla-central/rev/65359d316b12
https://hg.mozilla.org/mozilla-central/rev/2c3eb3176e7b
Assignee | ||
Comment 12•8 months ago
|
||
Here are the results of running the speedometer3 benchmark with this enabled, with some post processing to summarize. This shows missing allocation sites that would have been pretenured, grouped by bytecode and trace kind:
BytecodeOp TraceKind Sites Allocs Promotions
New Object 351 306791 303885
Lambda Object 578 287667 287303
SuperCall Object 93 170621 170552
Call Object 278 160650 160543
PushLexicalE Object 100 40687 40623
Add String 57 17360 17193
Rest Object 11 17097 17097
StrictSetPro Object 17 3618 3616
GetElem Object 10 2000 2000
GetProp Object 1 1852 1852
SpreadSuperC Object 3 1352 1308
Iter String 9 1030 1030
PushVarEnv Object 1 176 176
Description
•