Closed Bug 1657836 Opened 5 years ago Closed 4 years ago

Add a per-zone gray root callback

Categories

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

task

Tracking

()

RESOLVED WONTFIX

People

(Reporter: jonco, Assigned: jonco)

Details

Attachments

(1 obsolete file)

Currently there is a single callback to allow the embedding to supply gray roots.

Since the browser now knows which zone some of its roots are in, we can have a separate callback to get the roots for a particular zone. This will allow us to fetch the gray roots in parallel by zone where there is more than one zone being collected.

This allows the embedding to register a per-zone gray root callback, as well the existing one. This will enable getting the gray roots in parallel for multiple zones. From the comments in the patch:

The embedding can supply callbacks to tell the GC about roots that are gray
(that is, that are reachable from the embedding but may not be reachable from
any JS roots).

When the GC needs to trace the gray roots in a set of zones, it first calls
any the tracer registered with JS_SetGrayGCRootsTracer and then calls any
tracer registered with JS_SetPerZoneGrayGCRootsTracer once for each zone.

Either, both or neither of these callbacks may be supplied.

There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:jonco, could you have a look please?
For more information, please visit auto_nag documentation.

Flags: needinfo?(jcoppeard)
Attachment #9168830 - Attachment is obsolete: true

Why did you decide that incremental grey root scanning is more promising than parallel, out of curiosity?

We can only parallelise by zone, and within a single GC slice. It wouldn't fix the problem of having to complete it in one slice and it wouldn't help at all if there is only one zone being collected.

Doing this incrementally means we can split it across multiple slices. This is likely to reduce impact on users (i.e. jank due to blowing the slice budget) even though main thread GC time will remain the same as it is currently.

Flags: needinfo?(jcoppeard)

That makes sense. I'd assume the bulk of gray roots are in the big hashtable, and presumably you could do something like freeze the main hash table and then have two separate sets for objects added and removed while the iteration is in progress, or something like that.

Closing this as we're not planning to take this approach.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: