RFR: 8338526: Don't store abstract and interface Klasses in class metaspace [v6]

John R Rose jrose at openjdk.org
Wed Oct 9 06:10:05 UTC 2024


On Fri, 6 Sep 2024 16:20:52 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> This change stores InstanceKlass for interface and abstract classes in the non-class metaspace, since class metaspace will have limits on number of classes that can be represented when Lilliput changes go in.  Classes that have no instances created for them don't require compressed class pointers.  The generated LambdaForm classes are also AllStatic, and changing them to abstract moves them to non-class metaspace too.  It's not technically great to make them abstract and not final but you can't have both.  Java classfile access flags have no way of specifying something like AllStatic.
>> 
>> Tested with tier1-8.
>
> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Replace Metaspace::is_compressed_klass_ptr with CompressedKlassPointers::is_in_encoding_range.

If the interfaces had a compact numbering, and there were a side table mapping the compact numbers to interface Klass* pointers, then I think Andrew's code would still work (with natural adjustments).

But managing such a side table is at least as complicated as just doing the pointer compression stuff we do.  (Hence my comment that we haven't had to invent side tables yet.)

Because of CDS I don't think we can treat concretes and abstracts (or even just classes and interfaces) as disjoint metadata types with separate independent compression tactics or representations.  I think we need a subtype/supertype relation between the "narrowest" and merely "narrower" klass IDs.

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

PR Comment: https://git.openjdk.org/jdk/pull/19157#issuecomment-2401391441


More information about the core-libs-dev mailing list