JDK-8318485 : Narrow klass shift should be zero if encoding range extends to 0x1_0000_0000
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 17,21,22
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-10-19
  • Updated: 2025-02-17
  • Resolved: 2023-10-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 22
22 b21Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
If we map such that the class space ends at 0x1_0000_0000, we will use shift=3. We should use shift=0.

Repro:

```
thomas@starfish $ ./images/jdk/bin/java -XX:+UnlockDiagnosticVMOptions -XX:CompressedClassSpaceBaseAddress=0xc0000000 -XX:CompressedClassSpaceSize=1g -Xlog:metaspace* -Xshare:off 
[0.017s][info][metaspace] Successfully forced class space address to 0x00000000c0000000
[0.017s][info][gc,metaspace] CDS archive(s) not mapped
[0.017s][info][gc,metaspace] Compressed class space mapped at: 0x00000000c0000000-0x0000000100000000, reserved size: 1073741824
[0.017s][info][gc,metaspace] Narrow klass base: 0x0000000000000000, Narrow klass shift: 3, Narrow klass range: 0x100000000
                                                                                                                                                ^^^
```
Comments
Changeset: 5ba9705d Author: Thomas Stuefe <stuefe@openjdk.org> Date: 2023-10-23 21:10:52 +0000 URL: https://git.openjdk.org/jdk/commit/5ba9705d60fb3e3bab832aadd989b738471fcaf5
23-10-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/16261 Date: 2023-10-19 07:50:11 +0000
20-10-2023