About lemma 2 of hybrid write barrier

In https://github.com/golang/proposal/blob/master/design/17503-eliminate-rescan.md:

Lemma 2. If the object graph satisfies the modified tricolor invariant, then every white object reachable (directly or indirectly) from a black object is grey-protected by a heap object.

Proof. Let W be a white object reachable from black object B via simple path B → O₁ → ⋯ → Oₙ → W. Note that W and all Oᵢ and must be heap objects because stacks can only point to themselves (in which case it would not be a simple path) or heap objects, so O₁ must be a heap object, and by lemma 1, the rest of the path must be heap objects. Without loss of generality, we can assume none of Oᵢ are black; otherwise, we can simply reconsider using the shortest path suffix that starts with a black object.

I’m having trouble understanding why it says stacks can only point to themselves (in which case it would not be a simple path) , isn’t B -> stack object1 -> stack object2 -> ... -> heap object -> ... -> W also possible?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.