Closed Bug 1800263 Opened 2 years ago Closed 1 year ago

Avoid setting compartment's 'hasMarkedCells' flag outside root marking

Categories

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

task

Tracking

()

RESOLVED FIXED
109 Branch
Tracking Status
firefox109 --- fixed

People

(Reporter: jonco, Assigned: jonco)

References

(Blocks 1 open bug)

Details

Attachments

(5 files)

To support ensuring we collect zones that we suspect are dead we set a flag on compartments when we certain GC things in that compartment (currently objects and scripts).

We only need to do this when marking roots because most children will be in the same compartment and we handle CCWs separately anyway. However currently we do this for all marking.

This is a slight issue for parallel marking because writing this flag can race where there is more than one thread marking. It is also sub-optimal since most marking time is spent outside of root marking.

Previously GCMarker was a JSTracer. This separates out the impelmentation of
the tracer interface into another class.

The idea here is that we will change the tracer class used in different phases
of the GC. This will allow us to skip setting this compartment flag outside
root marker, and later allow us to select a different way of accessing the mark
bits for parallel marking.

Depends on D162393

This adds a new marking mode for root marking and templates MarkingTracer on a
options bitmask. The GCMarker's tracer becomes a variant and we change the
constructed variant when the mode changes.

The templating allows us to make parts of the marking path conditional using if
constexpr on the marking options.

Depends on D162394

As a further optimisation we can move the flag update into
GCMarker::markAndTraverse so we don't set the flag for thing we've already
marked.

Depends on D162395

This class has become pretty complicated. I've tried to reorder the methods in
a way that groups related methods together and to make methods private where
possible.

Depends on D162396

Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1bca4e782410
Part 1: Tidup, make MarkingState a private enum inside GCMarker r=sfink
https://hg.mozilla.org/integration/autoland/rev/969822745d98
Part 2: Add MarkingTracer as a member of GCMarker r=sfink
https://hg.mozilla.org/integration/autoland/rev/ba6cf596552d
Part 3: Add a root marking mode with its own tracer r=sfink
https://hg.mozilla.org/integration/autoland/rev/beeb51f05f78
Part 4: Push marking options through markAndTraverse to avoid setting the flag for things we've already marked r=sfink
https://hg.mozilla.org/integration/autoland/rev/eee37f3bfaba
Part 5: Tidyup GCMarker interface and make methods private where possible r=sfink
Regressions: 1802298
Regressions: 1802478
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: