ZBarrier::barrier

Gil Tene gil at azul.com
Wed Mar 13 17:32:02 UTC 2019


See section 2.2 ("Self Healing") in https://www.azul.com/files/c4_paper_acm1.pdf for a full explanation
2.2 Self Healing

LVB is a self-healing barrier. Since the LVB is always executed at reference load time, it has access not only to the reference value being verified, but to the memory address the value was loaded from as well. When an LVB triggers and takes corrective action, modifying a reference to meet the LVB invariants, it will also “heal” the source memory location that the reference was loaded from by (atomically) storing a copy of the reference back to the source location. This allows mutators to immediately self heal the root cause of each LVB trigger as it occurs, avoiding repeated triggers on the same loaded reference, and dramatically reducing the dynamic occurrence of read barrier triggers. Each reference memory storage location will trigger “at most once” (discounting minute levels of atomicity races in the healing process). Since the number of references in the heap is finite, single pass marking and single pass reference remapping are both guaranteed in a straight forward manner.

Self healing is uniquely enabled by the LVB’s semantic posi- tion in the code stream, immediately following the reference load operation, and preceding all uses or propagation of the loaded ref- erence value. This semantic proximity to the reference load opera- tion grants the LVB access to the loaded reference’s source address, which is required in order to perform the healing actions. Through Self Healing, LVB dramatically reduces the dynamic occurrence of read barrier triggering, making LVB significantly more efficient and predictable than both Brooks style and Baker style barriers, as well as other read barriers that will continue to trigger in the hot code path during certain GC phases..

> On Mar 13, 2019, at 4:59 AM, Andrew Haley <aph at redhat.com> wrote:
> 
> I'm trying to get my head around self-healing in ZGC.
> 
> In c1-compiled code, when we call ZBarrier::barrier(volatile oop* p, oop o),
> what does p point to?
> 
> --
> Andrew Haley
> Java Platform Lead Engineer
> Red Hat UK Ltd. <https://www.redhat.com>
> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671



More information about the zgc-dev mailing list