Closed Bug 1927795 Opened 1 year ago Closed 1 year ago

Reduce the size of ArenaLists by using a smaller linked list implementation

Categories

(Core :: JavaScript: GC, task, P3)

task

Tracking

()

RESOLVED FIXED
134 Branch
Tracking Status
firefox134 --- fixed

People

(Reporter: jonco, Assigned: jonco)

References

Details

Attachments

(3 files)

Currently ArenaLists contains two linked lists per AllocKind (one for the arenas currently being allocated from and one for those being processed by the GC). The current list implementation uses two words per list, so that's currently four words per AllocKind. Work on bug 1911537 will add a bunch more more AllocKinds so I'd like to reduce the space that these take up.

Currently ArenaLists takes 1576 bytes on 64 bit Linux, of which 1120 bytes is used for these lists. Using a linked list implementation that only uses one word per list reduces that to 1016 bytes.

Not related to the main changes here but this code is touched in a later patch
so it makes sense to simplify it first.

The idea is to implement ArenaList with SinglyLinkedList, which only uses a
single word of storage.

This adds a couple of new methods that we'll need on the list representation.

removeRange is kinda awkward but is needed for compacting where we will have to
remove a section of the list.

iterFrom is used for incremental sweeping.

This replaces ArenaList (two words) with SinglyLinkedList (one word). This
removes the arena cursor, a pointer that indicates where in the list we take
arenas from to use for allocation.

Instead this rearranges the list so that that this point is now the start of
the list. Since it is also a circular linked list it is just as efficient since to
take an element from the front of the list and move it to the back just
requires updating what we think the first element is.

Hopefully this makes the implementation of arena lists simpler by implementing
them in terms of more standard list primitives. It does make the compacting
code a little more complex since that now needs to remove a segment from the
middle of the list rather than being able to remove everthing up to the end of
the list.

It also means that list iteration needs to use the iterator provided to avoid
an infinite loop. That is mostly a simple change except in one or two places.

Attachment #9434042 - Attachment description: Bug 1927795 - Part 2: A SinglyLinkedList::removeRange and iterFrom methods r?sfink → Bug 1927795 - Part 2: Add SinglyLinkedList::removeRange and iterFrom methods r?sfink
Pushed by jcoppeard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a80feb43f965 Part 1: Remove unused ArenasToUpdate constructor r=sfink https://hg.mozilla.org/integration/autoland/rev/3f4228000112 Part 2: Add SinglyLinkedList::removeRange and iterFrom methods r=sfink https://hg.mozilla.org/integration/autoland/rev/07438f1f283c Part 3: Use SinglyLinkedList to implement ArenaList r=sfink https://hg.mozilla.org/integration/autoland/rev/248e8e68096f apply code formatting via Lando
Regressions: 1929302
Regressions: 1929336
Regressions: 1929431

Appears to have improved Base content JS by 0.1%

Regressions: 1929551
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: