Quote from “Real World OCaml” on color in value header:
... Gray Reachable, but its fields have not been scanned Black Reachable, and its fields have been scanned ...
However, it seems that the gray color is only used in
... - Gray words are the encoding of pointers in inverted lists. ...
For instance, in
mark_slice_darken never even checks for gray values, it just blackens the white values immediately and pushes it onto stack.
In fact, I’ve always wondered why a gray color is needed in the implementation of a mark & sweep GC, if we are pushing the gray values onto a stack/worklist already. (I think it’s conceptually helpful but redundant in practice)
Thus my question: is it correct to say that the gray color in the OCaml GC is used for compaction only?