[master] RFR: Prepare for smaller-than-22-bit class pointers [v2]
Thomas Stuefe
stuefe at openjdk.org
Tue Jun 4 16:31:46 UTC 2024
On Tue, 30 Apr 2024 09:00:48 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> This PR prepares using arbitrary klass pointer sizes (e.g. 16). It cleans up a few places and corrects comments.
>>
>> The changes in detail:
>>
>> - exposes a new function `CompressedKlassPointers::max_encoding_range_size()` that returns the maximum possible size of the encoding range given the current nKlass geometry (e.g. 16 bit klass pointers with a max. shift of 10 bits can encode 64MB of class space).
>>
>> - In Metaspace::ergo_initialize(), where we ergo-adjust the CompressedClassSpaceSize, the maximum possible encoding range size flows into this adjustment now. We also print clearer warnings in case the user specifies CCS size explicitly, and we override that decision.
>>
>> - removed any hard-wiredness of a "max class space size/encoding range size of 4GB" since with smaller geometries that does not hold true anymore. Instead, we now use `CompressedKlassPointers::max_encoding_range_size()`.
>>
>> - made the requirements on klass_alignment_in_bytes clearer when setting up class space
>>
>> - removed remnant code (TinyClassPointerShift) left over from development
>>
>>
>> Note: One still unsolved problem—unsolved in Lilliput as well as upstream—is to correctly limit the compressed class space size in the presence of CDS. Upstream "solves" this by capping CCS size at 3GB, which leaves 1GB for CDS archives. There is no solution if CDS would ever exceed this limit, and it's a waste of space for CCS.
>>
>> In Lilliput, if we limit the class pointer size such that we drastically reduce the klass encoding range size, we need to be better at splitting that klass encoding range between CDS and class space. For example, we could map CDS and then use the remaining space completely for class space. But that would require more serious reshuffling for initialization code, and CDS setup is horrendously complex.
>>
>> For this patch, if one wants to reduce class pointer size, one may have to disable CDS to run.
>>
>> Tested: Mac m1, fastdebug, with 32, 22 and 16 bit class pointers. GHAs in process.
>
> Thomas Stuefe has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>
> - Merge branch 'master' into preparation-for-arbitrary-cp-sizes
> - Fix behavior when running with a very small MaxMetaspaceSize
> - start
keep open bot
-------------
PR Comment: https://git.openjdk.org/lilliput/pull/172#issuecomment-2147726536
More information about the lilliput-dev
mailing list