RFR: JDK-8307935: Class space argument processing can be simplified [v2]

Thomas Stuefe stuefe at openjdk.org
Fri May 12 05:39:47 UTC 2023


> [JDK-8299229](https://bugs.openjdk.org/browse/JDK-8299229) removed the last scenario that tied compressed klass pointers to compressed oops.
> 
> In argument.cpp, we can therefore remove comments that refer to this old dependency.
> 
> Furthermore, in `Arguments::set_use_compressed_klass_ptrs()`, we can remove the following code pieces:
> 
> 
>   if (FLAG_IS_DEFAULT(UseCompressedClassPointers)) {
>     FLAG_SET_ERGO(UseCompressedClassPointers, true);
>   }
> 
> 
> I think this is a remnant from the time where compressed class pointers depended on compressed oops. We can now just set UseCompressedClassPointers by default to true for 64-bit platforms, which has the same effect as above code and is more in line of how we maintain default values normally.
> 
> 
>   // Check the CompressedClassSpaceSize to make sure we use compressed klass ptrs.
>   if (UseCompressedClassPointers) {
>     if (CompressedClassSpaceSize > KlassEncodingMetaspaceMax) {
>       warning("CompressedClassSpaceSize is too large for UseCompressedClassPointers");
>       FLAG_SET_DEFAULT(UseCompressedClassPointers, false);
>     }
>   }
> 
> 
> This coding is unnecessary since the CompressedClassSpaceSize option is range-checked and capped at 3GB. KlassEncodingMetaspaceMax is 32GB, so we will never hit the above condition. Moreover, even if that check were effective, it would not be sufficient, since the encoding range size is shared between CDS and class space and therefore the space available depends on the (yet unknown) CDS archive size, modulo internal alignments. To reduce complexity, we may just remove this part.
> 
> (It makes sense to leave an assert here to counter-check the range check which is supposedly done beforehand).
> 
> Tests:
> - manually ran runtime/CommandLine, runtime/Metaspace, gc/Metaspace and all gtest variants on Linux x64 and x86.

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 'openjdk:master' into JDK-8307935-Class-space-argument-processing-can-be-simplified
 - modify assert
 - JDK-8307935-Class-space-argument-processing-can-be-simplified

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/13931/files
  - new: https://git.openjdk.org/jdk/pull/13931/files/38507a74..68b2b04c

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=13931&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13931&range=00-01

  Stats: 69448 lines in 750 files changed: 59646 ins; 4395 del; 5407 mod
  Patch: https://git.openjdk.org/jdk/pull/13931.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13931/head:pull/13931

PR: https://git.openjdk.org/jdk/pull/13931


More information about the hotspot-runtime-dev mailing list