Make GC barrier wrappers atomic under concurrent marking
Categories
(Core :: JavaScript: GC, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox153 | --- | fixed |
People
(Reporter: jonco, Assigned: jonco)
References
(Blocks 1 open bug, Regressed 1 open bug)
Details
Attachments
(7 external files)
Most heap accesses in the VM go through GC barrier wrappers such as GCPtr. For data touched by concurrent making we need to ensure that main thread writes and marking thread reads are atomic. Therefore we can change barriers to:
- add atomic getters and setters
- make setters atomic by default in concurrent marking builds
- make the generic marking path use atomic getters (in this bug)
- make the marking fast path use atomic getters (will be handled in a later bug)
This only applies to data traced by core GC types (not object trace hooks). The cut point chosen is that HeapPtr is out and GCPtr, HeapSlot, GCBuffer and GCStruct are in.
| Assignee | ||
Comment 1•5 months ago
|
||
| Assignee | ||
Comment 2•5 months ago
|
||
This adds the AtomicMethods template to write up atomic accessors for the
various barriered types and adds BarrierOption_AtomicWrites to have
BarrieredPtrImpl make writes atomic.
| Assignee | ||
Comment 3•5 months ago
|
||
We're going to make GCPtr use atomic writes in concurrent marking builds but
that's a problem for wasm::Val because it's larger than 64 bits and so can't
support support atomic operations. Instead work around this by using HeapPtr
which will not be affected.
This does mean there will be an extra write barrier triggered on destruction of
WasmGlobalObject for the mutable value, but this shouldn't be a big cost. This
makes the barrier requirements slightly more broad and we need to allow setting
the value to invalid during destruction.
| Assignee | ||
Comment 4•5 months ago
|
||
| Assignee | ||
Comment 5•5 months ago
|
||
We don't just need atomic accesses to GC edges but also supplemenatal data used
in tracing (e.g. flags, element counts and the like) that may be touched by
both the main thread and the marking thread.
This adds GCData (like GCPtr) for this kind of data.
| Assignee | ||
Comment 6•5 months ago
|
||
This uses the new GCData to wrap non-pointer data that may be accessed by both
the main thread and the marking thread during concurrent marking.
This includes object flags and object slots and elements pointers, which are
not GC edges themselves since they are internal pointers.
| Assignee | ||
Comment 7•5 months ago
|
||
This makes the generic path use atomic loads to read edge pointers. Updates the
the marking fast path will be in a later bug.
https://hg.mozilla.org/mozilla-central/rev/fe39db3352d9
https://hg.mozilla.org/mozilla-central/rev/6085b3379a19
https://hg.mozilla.org/mozilla-central/rev/7e0f6a1dc16b
https://hg.mozilla.org/mozilla-central/rev/2f742b129a2b
https://hg.mozilla.org/mozilla-central/rev/bddac9ba98eb
https://hg.mozilla.org/mozilla-central/rev/1aa2c53c3cdc
https://hg.mozilla.org/mozilla-central/rev/132fabf569ea
https://hg.mozilla.org/mozilla-central/rev/e8b41d10df01
Description
•