MPS issue job004023

TitleSummary-based write barrier invariant won't cope with pre-flip scanning
Assigned userRichard Brooksby
DescriptionThe current invariant for the write barrier is that we write-protect a segment if its summary is not universal. This works for maintaining the summaries accurately, so that they can be used to eliminate segments from the grey set at trace start. However, if we scan a segment before the flip and it happens by coincidence to have a universal summary, then it won't be write protected even though it is black (no longer refers to white objects). The MPS will then fail to take note if the mutator writes a pointer to a white object into the segment, leading to possible premature recycling.
AnalysisThe write barrier invariant is not strong enough to maintain the reference partition of garbage collection. To do that, we'll need to raise the barrier on segments that are black for unflipped traces. We can do this by keeping extra colour bits in the segment descriptor, indicating that a segment contains black objects. Note that we can't reliably infer that a segment is black just because it is not white or grey, because in general it might contain objects of all three colours.
The invariant: The write barrier is raised when the segment summary is not inversal OR the segment is black for an unflipped trace.
Introduce black colour bits in the segment, and methods like SegBlack, SetSetBlack, which implement the invariant.
See also job004022 concerning maintenance of the pre-flip grey list.
How foundinspection
EvidenceRaised during whiteboard discussion between RB and DL, 2016-04-27.
Created byRichard Brooksby
Created on2016-04-28 12:05:46
Last modified byRichard Brooksby
Last modified on2016-04-28 12:07:18
History2016-04-28 RB Created.