[master] RFR: Store (narrow) klass in object header
rkennke at openjdk.java.net
Fri May 21 14:28:12 UTC 2021
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*.
- [x] tier1
- [x] tier2
- Store (narrow) klass in object header
Stats: 128 lines in 19 files changed: 64 ins; 35 del; 29 mod
Fetch: git fetch https://git.openjdk.java.net/lilliput pull/7/head:pull/7
More information about the lilliput-dev