In CompressedKlassPointers::initialize() we assert that
CompressedKlassPointers::is_valid_base() returns true passing the start address
of the compressed class space (ccs) as parameter instead of the encoding base as
expected by the method. This is not directly wrong but overly strict.
The call in Metaspace::global_initialize() has the same issue.
On AArch64 it is the encoding base that must be 4G aligned. For most locations
of the ccs below 32G this will be the case because the encoding base will be 0
so the current implementation is overly strict.
As a consequence it is for example not possible to get an unscaled encoding on
AArch64, meaning encoding base and shift are both set to 0 as expected if
UseCompressedOops are disabled (e.g. because ZGC is selected) and CDS is off.
Linux x86_64
------------
java -XX:-UseCompressedOops -Xshare:off -Xlog:gc+metaspace=trace,cds=trace -version
[0.093s][info][gc,metaspace] CDS disabled.
[0.093s][info][gc,metaspace] Compressed class space mapped at: 0x0000000080000000-0x00000000c0000000, reserved size: 1073741824
[0.093s][info][gc,metaspace] Narrow klass base: 0x0000000000000000, Narrow klass shift: 0, Narrow klass range: 0xc0000000
openjdk version "17.0.0.1-internal" 2020-12-19
OpenJDK Runtime Environment (fastdebug build 17.0.0.1-internal+0-adhoc.openjdk.jdk-dev)
OpenJDK 64-Bit Server VM (fastdebug build 17.0.0.1-internal+0-adhoc.openjdk.jdk-dev, mixed mode)
Unscaled: narrow klass base and shift are both 0
Linux aarch64
-------------
java -XX:+UseCompressedOops -Xshare:off -Xlog:gc+metaspace=trace,cds=trace -version
[0.013s][info][gc,metaspace] CDS disabled.
[0.013s][info][gc,metaspace] Compressed class space mapped at: 0x0000000100000000-0x0000000140000000, reserved size: 1073741824
[0.013s][info][gc,metaspace] Narrow klass base: 0x0000000000000000, Narrow klass shift: 3, Narrow klass range: 0x140000000
openjdk version "17.0.0.1-internal" 2020-12-19
OpenJDK Runtime Environment (build 17.0.0.1-internal+0-adhoc..jdk-dev)
OpenJDK 64-Bit Server VM (build 17.0.0.1-internal+0-adhoc..jdk-dev, mixed mode)
_Not_ unscaled. Narrow klass shift is 3. This is because 2G is considered an
invalid location for ccs.
See also https://mail.openjdk.java.net/pipermail/hotspot-dev/2020-December/047592.html
CompressedKlassPointers::is_valid_base() returns true passing the start address
of the compressed class space (ccs) as parameter instead of the encoding base as
expected by the method. This is not directly wrong but overly strict.
The call in Metaspace::global_initialize() has the same issue.
On AArch64 it is the encoding base that must be 4G aligned. For most locations
of the ccs below 32G this will be the case because the encoding base will be 0
so the current implementation is overly strict.
As a consequence it is for example not possible to get an unscaled encoding on
AArch64, meaning encoding base and shift are both set to 0 as expected if
UseCompressedOops are disabled (e.g. because ZGC is selected) and CDS is off.
Linux x86_64
------------
java -XX:-UseCompressedOops -Xshare:off -Xlog:gc+metaspace=trace,cds=trace -version
[0.093s][info][gc,metaspace] CDS disabled.
[0.093s][info][gc,metaspace] Compressed class space mapped at: 0x0000000080000000-0x00000000c0000000, reserved size: 1073741824
[0.093s][info][gc,metaspace] Narrow klass base: 0x0000000000000000, Narrow klass shift: 0, Narrow klass range: 0xc0000000
openjdk version "17.0.0.1-internal" 2020-12-19
OpenJDK Runtime Environment (fastdebug build 17.0.0.1-internal+0-adhoc.openjdk.jdk-dev)
OpenJDK 64-Bit Server VM (fastdebug build 17.0.0.1-internal+0-adhoc.openjdk.jdk-dev, mixed mode)
Unscaled: narrow klass base and shift are both 0
Linux aarch64
-------------
java -XX:+UseCompressedOops -Xshare:off -Xlog:gc+metaspace=trace,cds=trace -version
[0.013s][info][gc,metaspace] CDS disabled.
[0.013s][info][gc,metaspace] Compressed class space mapped at: 0x0000000100000000-0x0000000140000000, reserved size: 1073741824
[0.013s][info][gc,metaspace] Narrow klass base: 0x0000000000000000, Narrow klass shift: 3, Narrow klass range: 0x140000000
openjdk version "17.0.0.1-internal" 2020-12-19
OpenJDK Runtime Environment (build 17.0.0.1-internal+0-adhoc..jdk-dev)
OpenJDK 64-Bit Server VM (build 17.0.0.1-internal+0-adhoc..jdk-dev, mixed mode)
_Not_ unscaled. Narrow klass shift is 3. This is because 2G is considered an
invalid location for ccs.
See also https://mail.openjdk.java.net/pipermail/hotspot-dev/2020-December/047592.html
- relates to
-
JDK-8262895 [macos_aarch64] runtime/CompressedOops/CompressedClassPointers.java fails with 'Narrow klass base: 0x0000000000000000' missing from stdout/stderr
- Resolved
-
JDK-8258576 Try to get zerobased CCS if heap is above 32 and CDS is disabled
- Resolved