Compatibility Risk Description:A new VM option is added.
Interface Kind:add/remove/modify command line option
Add a diagnostic VM option to control CDS archive relocation at runtime.
If the CDS archive cannot be mapped at the desired address, JDK-8234052 will relocate the archive to an alternative location. Relocation can cause a small degradation of start-up time and memory footprint (when compared to mapping the archive without relocation), however, usually, it should still have better start-up and similar memory footprint when compared to disabling CDS altogether.
However, since CDS archive relocation is a new feature, it may cause unexpected performance degradation in some cases that we have not tested.
As a precaution, we should add a VM option to control when/if archive relocation happens.
We add a new diagnostic VM option, ArchiveRelocationMode, which is an integer with the following valid values:
- 0: (default) first map at preferred address, and if unsuccessful, map to alternative address;
- 1: always map to alternative address;
- 2: always map at preferred address, and if unsuccessful, do not map the archive;
The value 1 is for forcing relocation in the regression test suite (because relocation happens rarely in our test environment), as well as for easy performance measurement.
The value 2 is for avoiding potential regression that may be introduced by relocation (this revert the VM to JDK 13 behavior).