[master] Integrated: Store (narrow) klass in object header

Roman Kennke rkennke at openjdk.java.net
Wed May 26 19:54:46 UTC 2021

On Fri, 21 May 2021 14:15:20 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

> This change stores compressed Klass* in the upper 32bits of the object header. It doesn't really use it, yet. But I added some code in heap-object-stats to verify that all objects receive it.
> It is implemented by storing the compressed Klass* into the prototype-header for each Klass, and use that to initialize objects, pretty much like we used to do for +BiasedLocking.
> It will take some serious effort to change all code to use this new location to find the Klass*:
> - We need to change all generated code (intepreter, c1, c2) to load Klass* from the header, and call to runtime when it encounters a displaced header word.
> - We need to change (sliding-compacting) GCs to be able to iterate heap while objects are forwarded. Most likely by using a forwarding table, but I'm not quite sure yet.
> - We need to change rest of runtime to load Klass* from header.
> In this change, I modified some code in G1 that deals with checking consistent header, the same asserts that we have seen in #6. This is rather ugly, but I actually expect those asserts to go away or be rewritten in a more useful way.
> CDS support is noteworthy because we need to ensure that we propagate the actual narrowKlass whenever we (re-)initialize object headers, because that may be encoded with a different base address for archived Klass instances than other Klass instances, and would create a mess if we would re-encode the Klass*.
> Testing
>  - [x] tier1
>  - [x] tier2

This pull request has now been integrated.

Changeset: 161e7c87
Author:    Roman Kennke <rkennke at openjdk.org>
URL:       https://git.openjdk.java.net/lilliput/commit/161e7c871b10677744c77de8c3ea0e753097a1d8
Stats:     128 lines in 19 files changed: 64 ins; 35 del; 29 mod

Store (narrow) klass in object header

Reviewed-by: shade


PR: https://git.openjdk.java.net/lilliput/pull/7

More information about the lilliput-dev mailing list