Forwarding pointer elimination questions

Aleksey Shipilev shade at redhat.com
Wed May 8 09:56:17 UTC 2019


On 5/8/19 11:42 AM, Simone Bordet wrote:
> On Wed, May 8, 2019 at 11:14 AM Aleksey Shipilev <shade at redhat.com> wrote:
>> https://mail.openjdk.java.net/pipermail/shenandoah-dev/2019-April/009203.html
>>
>> LRB = LoadReferenceBarrier. LRB intercepts heap accesses at load-reference time, evacuates the
>> object then.
> 
> This is quite similar to the ZGC and C4 barrier, right?

No, it is not. The placement for barrier is similar, but the way forwarding data is encoded and how
the relocation is handled is still Shenandoah. LRB basically does what WB used to do, but in
different place: check the GC state, cset status, existing forwarding, and evacuate the object if
needed.

> Is the LRB used only during evacuation, or also in the other phases
> (marking, update_reference)?

LRB basically does what our WB used to do, it does not do anything new. SATB barrier is used to
support marking, as usual.

> Are you storing metadata on the side when the mutator triggers the
> LRB, so that the CAS is now performed on the side data structure
> rather than the forwarding pointer?

No. LRB still uses the same forwarding pointer slot as WB used before. Forwarding pointer *is*
metadata. New patch "just" moves the forwarding data that used to occupy the separate slot into the
mark word slot in the from-space object. (It requires some simple decoding to disambiguate fwdptr
from the "vanilla" mark word in not-yet-forwarded object).

> What's the LRB looking like in ASM?

https://mail.openjdk.java.net/pipermail/shenandoah-dev/2019-March/008995.html

> Feels like you just moved from a Brooks pointer algorithm to a C4-like
> algorithm (as described in the C4 paper - perhaps not exactly the same
> as C4 or ZGC implementation wise).

No, I would not say so. What is "Brooks pointer algorithm"? I assume you mean in-object indirection
pointer that points to the actual copy. It is still there: in mark word slot of the from-space
object. LRB only changes where that pointer is consulted with: with LRB, on the read side, rather
than both on read and write sides, as it used to be before.

-Aleksey





More information about the shenandoah-dev mailing list