Summary
Deprecate the seldomly used flags related to CDS: UseSharedSpace, RequireSharedSpaces, DumpSharedSpaces, and DynamicSharedSpaces options.
Problem
Users should not be using the -XX:+UseSharedSpace, -XX:+RequireSharedSpaces, and -XX:+DumpSharedSpaces options. Instead, they should use the options -Xshare:off, -Xshare:auto, -Xshare:on, and -Xshare:dump, which are documented in https://docs.oracle.com/en/java/javase/17/vm/class-data-sharing.html
The -XX:+DynamicDumpSharedSpaces is useless because it is always overridden by the command line processing in Arguments::finalize_vm_init_args(). The feature related to the DynamicDumpSharedSpaces should be accessed using the -XX:ArchiveClassesAtExit option.
Solution
The solution is to deprecate these four command line options and eventually remove them.
Specification
Deprecating these options involves the following code change to arguments.cpp:
--- a/src/hotspot/share/runtime/arguments.cpp
+++ b/src/hotspot/share/runtime/arguments.cpp
@@ -528,6 +528,8 @@ static SpecialFlag const special_jvm_flags[] = {
{ "FlightRecorder", JDK_Version::jdk(13), JDK_Version::undefined(), JDK_Version::undefined() },
{ "FilterSpuriousWakeups", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::jdk(20) },
{ "MinInliningThreshold", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::jdk(20) },
+ { "UseSharedSpace", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::jdk(20) },
+ { "RequireSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::jdk(20) },
+ { "DumpSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::jdk(20) },
+ { "DynamicDumpSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::jdk(20) },
The flags are defined here. This code will be removed when the flags are removed:
product(bool, UseSharedSpaces, true, \
"Use shared spaces for metadata") \
product(bool, RequireSharedSpaces, false, \
"Require shared spaces for metadata") \
product(bool, DumpSharedSpaces, false, \
"Special mode: JVM reads a class list, loads classes, builds " \
"shared spaces, and dumps the shared spaces to a file to be " \
"used in future JVM runs") \
product(bool, DynamicDumpSharedSpaces, false, \
"Dynamic archive") \
- csr of
-
JDK-8276795 Deprecate seldom used CDS flags
-
- Resolved
-