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

Aleksey Shipilev shade at openjdk.java.net
Tue May 25 16:44:47 UTC 2021


On Fri, 21 May 2021 18:41:42 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
>
> Roman Kennke has updated the pull request incrementally with four additional commits since the last revision:
> 
>  - 32bit build fixes
>  - Assume compressed klass pointers in markWord::set_klass()
>  - Put back newline
>  - Remove superfluous assert

Looks fine for the experimental code.

-------------

Marked as reviewed by shade (Committer).

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


More information about the lilliput-dev mailing list