[master] RFR: Prepare for smaller-than-22-bit class pointers
Thomas Stuefe
stuefe at openjdk.org
Sat Apr 27 07:50:34 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 specified 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 for when the CDS archives would exceed this limit, and its a waste of space for CCS.
In Lilliput, if we limit the class pointer size such that we end up with drastically reduces klass encoding range size, we need to be better at splitting that klass encoding range between CDS and class space. E.g., to map CDS and then use the remaining space completely for class space. But that would need more serious reshuffling for initialization code and CDS setup is horrendously complex.
For this patch it means, 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.
-------------
Commit messages:
- start
Changes: https://git.openjdk.org/lilliput/pull/172/files
Webrev: https://webrevs.openjdk.org/?repo=lilliput&pr=172&range=00
Stats: 92 lines in 4 files changed: 48 ins; 26 del; 18 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