[master] RFR: Prepare for smaller-than-22-bit class pointers [v3]

Thomas Stuefe stuefe at openjdk.org
Tue Jun 18 09:36:06 UTC 2024


> 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 pull request now contains two commits:

 - Fix behavior when running with a very small MaxMetaspaceSize
 - start

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

Changes: https://git.openjdk.org/lilliput/pull/172/files
  Webrev: https://webrevs.openjdk.org/?repo=lilliput&pr=172&range=02
  Stats: 91 lines in 4 files changed: 46 ins; 26 del; 19 mod
  Patch: https://git.openjdk.org/lilliput/pull/172.diff
  Fetch: git fetch https://git.openjdk.org/lilliput.git pull/172/head:pull/172

PR: https://git.openjdk.org/lilliput/pull/172


More information about the lilliput-dev mailing list