Re: Question about fixup_partial_loads at"Pause mark end" phase
Per Liden
per.liden at oracle.com
Fri Jan 18 09:32:37 UTC 2019
Hi Ryan,
On 1/18/19 2:47 AM, 彭 成寒 wrote:
> Hi Per,
>
> Sorry to distburb you. I am new to learn ZGC.
> I don't understand why we need ZHeap::fixup_partial_loads() at mark_end phase. I see the comment as below in the file:
>
> // C2 can generate code where a safepoint poll is inserted
> // between a load and the associated load barrier. To handle
> // this case we need to rescan the thread stack here to make
> // sure such oops are marked.
>
> From the comments, the compiled thread maybe be caused the mark leakage at safepoint poll. Which STW pahse for this polling? is it the mark_end phase? if yes, all the objects should be marked at concurrent mark phase?
Let me give you two examples to illustrate the problem.
1) Assume a Java thread loads an object reference to the last unmarked
object, just before a GC threads comes along and marks that object and
safepoints before the load barrier. In this cases all objects will be
marked, but the color (metadata bits) of that last root can still be
wrong, i.e. it might need to be remapped, etc.
2) Assume a Java thread loads and object reference, then detaches that
object from the graph, and then take a safepoint poll before we take the
load barrier. In this cases, the root would be the last reference to
that object and it would be incorrectly hidden from the GC.
fixup_partial_loads() is a workaround to solve these situations. The
real fix is to not allow C2 to generate a safepoint poll between the
load and the barrier. Work is in progress to fix this in C2, so we hope
to get rid of fixup_partial_loads() soon-ish.
cheers,
Per
> Could you help me understand this pece of code? Thank you very much!
>
>
> Ryan peng
>
> 发自我的华为手机
>
More information about the zgc-dev
mailing list