[master] RFR: Implement self-forwarding of objects that preserves header bits
John R Rose
jrose at openjdk.java.net
Thu Jul 1 01:46:33 UTC 2021
On Wed, 30 Jun 2021 09:22:16 GMT, Roman Kennke <rkennke at openjdk.org> wrote:
> For this PR, I'd like to take the BL bit. But I believe it should be ok, because it's only relevant during GC and only if the lowest two bits are also set, when doing self-forwarding in case of a promotion failure. In this scenario, the header bits would be overwritten anyway, and GC would have to ensure that the header (including the BL bit) is preserved if there is anything interesting in the lower header bits.
I think I agree, given that the BL bit will be used only while the header is in the special forwarding state and/or during a safepoint.
Except for the larval marking (which is akin to a locking state), these Valhalla header bits are really hoisted copies of properties that can be reconstituted from the `Klass` block associated with the object. So, worst case, the GC might blow them away in favor of a forwarding pointer, and then "heal" them by re-fetching header bits from the `Klass`. The larval marking should probably be healed (if necessary) by whatever mechanism takes care of lock states.
More information about the lilliput-dev