Investigate pretenuring strings by allocation site
Categories
(Core :: JavaScript: GC, enhancement, P3)
Tracking
()
People
(Reporter: sfink, Assigned: jonco)
References
(Blocks 1 open bug)
Details
Attachments
(9 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 |
Currently, string pretenuring is done on a whole-Zone basis (if too many strings are getting tenured, we permanently stop allocating them from the nursery and allocate directly in the tenured heap). This is a very coarse heuristic. It would be far better to be able to make the decision per allocation site. We can only do that for objects right now, because their ObjectGroup is tied to an allocation site, but strings do not have anything analogous.
https://ai.google/research/pubs/pub43823 describes V8's implementation of this. They associate a "memento" with nursery-allocated items created by the baseline compiler (only), and accumulate statistics during tenuring (at which time the memento is discarded.)
We are already carrying extra data with JSStrings (the Zone*), so it would be fairly straightforward to add a memento. One option for the memento would be script pointer + bytecode offset, or a hash derived from that. Another option would be to just generate sequential or random ids and embed them in our Baseline-compiled code only, and propagate them through to the Ion-compiled code (to choose where to allocate; Ion presumably would not continue to collect allocate site-specific counts.)
The V8 system appears to record both total allocations at a site, as well as counting up how many were tenured, so they have a true percentage tenured per allocation site.
Note that if we do deduplication during string tenuring, then we really want an allocation site that produces lots of duplicates to allocate in the nursery. We might want to factor that into the heuristic, in addition to the allocation count and tenure percentage. But that's a lesser-order consideration that only matters for moderately high tenuring percentages.
| Assignee | ||
Updated•6 years ago
|
| Assignee | ||
Updated•4 years ago
|
| Assignee | ||
Updated•4 years ago
|
| Assignee | ||
Comment 1•4 years ago
|
||
I've implemented most of this but don't yet have data to show that it's a win over what we already have. I'll post the patches I have so far.
| Assignee | ||
Comment 2•4 years ago
|
||
This tests whether certain kinds of allocation produce tenured or nursery
allocations (whereas existing tests check the number of major/minor GCs).
| Assignee | ||
Comment 3•4 years ago
|
||
Depends on D121949
| Assignee | ||
Comment 4•4 years ago
|
||
Depends on D121950
| Assignee | ||
Comment 5•4 years ago
|
||
Depends on D121951
| Assignee | ||
Comment 6•4 years ago
|
||
Depends on D121952
| Assignee | ||
Comment 7•4 years ago
|
||
Depends on D121954
| Assignee | ||
Comment 8•4 years ago
|
||
Depends on D121955
| Assignee | ||
Comment 9•4 years ago
|
||
Depends on D121956
| Assignee | ||
Comment 10•4 years ago
|
||
Depends on D121957
Updated•4 years ago
|
Updated•4 years ago
|
Updated•3 years ago
|
Description
•