Closed Bug 1735296 Opened 4 months ago Closed 4 months ago

Improve weak edge tracing APIs in preparation for replacing uses of IsAboutToBeFinalized


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




95 Branch
Tracking Status
firefox95 --- fixed


(Reporter: jonco, Assigned: jonco)




(6 files)

To allow most uses of IsAboutToBeFinalized to be replaced with tracing we need to improve the infrastructure a little.

One issue is that when tracing a weak edge you may need to initial referent of the edge after it has been traced and potentially cleared (e.g. to perform some cleanup on it). But you may also need the updated edge if it has been updated. This is currently possible but makes the code more complex than it needs to be.

Another thing we'll need is a sweeping tracer for nursery collections.

Finally it would be good to remove as many sweeping functions as possible from the public API since some of these are unused or only used internally.

With the following patches, this lets us remove public GCPolicy APIs for
sweeping raw pointers.

This is also required to remove some public GCPolicy methods for bare pointer

Depends on D128257

This was a minor optimisation to remove unnecessary barriers but it probably
makes negligable difference.

Depends on D128258

This should make it hader for users of the public API to put unbarriered
pointers in hash tables.

Depends on D128259

This is intended to be a simple as possible so that compilers can optimise away
the bits that aren't used after inlining. The result value includes the edge
state before and after update and there are runtime checks that you only use
the right one, depending on whether the edge was removed or not.

The signature of TraceWeakEdge changes to allow any barriered type because in
practice we have weak edges that are no WeakHeapPtr in cases where we don't
want the read barrier (e.g. WeakMap keys).

Depends on D128260

Analagous to the sweeping tracer, this checks whether nursery things have been
moved and updates the edge as necessary.

Depends on D128261

Pushed by
Part 1: Use HeapPtrObject in NonshrinkingGCObjectVector r=sfink
Part 2: Add an UnsafeBarePtr wrapper for use in NurseryAwareHashMap r=sfink
Part 3: Change Zone::RttValueObjectSet to use HeapPtrObject r=sfink
Part 4: Remove unused public APIs for sweeping pointers r=sfink
Part 5: Add a result value for TraceWeakEdge that encapsulates all relevant information r=sfink
Part 6: Add minor sweeping tracer r=sfink
You need to log in before you can comment on or make changes to this bug.