Description
If CDS archived heap objects can be loaded at their "requested addresses", we can avoid relocation of their oop fields.
The calculation of the requested addresses is too complicated with -XX:-UseCompressedOops. We first pick a point close to the top of the *dumptime* heap:
https://github.com/openjdk/jdk/blob/0c86c31bccd676e1cfbd35898ee16e89d5752688/src/hotspot/share/cds/archiveHeapWriter.cpp#L342
Then, we find out where this point would be if the *runtime* heap starts at 0x10000000:
https://github.com/openjdk/jdk/blob/0c86c31bccd676e1cfbd35898ee16e89d5752688/src/hotspot/share/cds/heapShared.cpp#L1695-L1720
The problem is for -XX:-UseCompressedOops, the word "requested address" has two different meaning (between the two blocks of code referenced above). This difference is not explained in the comments here:
https://github.com/openjdk/jdk/blob/0c86c31bccd676e1cfbd35898ee16e89d5752688/src/hotspot/share/cds/archiveHeapWriter.hpp#L73
==============================
With -XX:-UseCompressedOops, the OS will randomly pick a range for the runtime heap, so we will always need to relocate anyway. We can greatly simplify the dumping code by writing the first archived heap object at 0x10000000.
The calculation of the requested addresses is too complicated with -XX:-UseCompressedOops. We first pick a point close to the top of the *dumptime* heap:
https://github.com/openjdk/jdk/blob/0c86c31bccd676e1cfbd35898ee16e89d5752688/src/hotspot/share/cds/archiveHeapWriter.cpp#L342
Then, we find out where this point would be if the *runtime* heap starts at 0x10000000:
https://github.com/openjdk/jdk/blob/0c86c31bccd676e1cfbd35898ee16e89d5752688/src/hotspot/share/cds/heapShared.cpp#L1695-L1720
The problem is for -XX:-UseCompressedOops, the word "requested address" has two different meaning (between the two blocks of code referenced above). This difference is not explained in the comments here:
https://github.com/openjdk/jdk/blob/0c86c31bccd676e1cfbd35898ee16e89d5752688/src/hotspot/share/cds/archiveHeapWriter.hpp#L73
==============================
With -XX:-UseCompressedOops, the OS will randomly pick a range for the runtime heap, so we will always need to relocate anyway. We can greatly simplify the dumping code by writing the first archived heap object at 0x10000000.
Attachments
Issue Links
- relates to
-
JDK-8308903 Print detailed info for Java objects in -Xlog:cds+map
- Resolved
-
JDK-8296263 Uniform APIs for mapping archived heap regions
- Closed
-
JDK-8310823 CDS archived object streaming
- Closed