Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8276891

Deprecate seldomly used CDS command-line flags

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 18
    • hotspot
    • behavioral
    • minimal
    • Hide
      Users are most likely already using -Xshare:{off,on,auto,dump} so deprecating UseSharedSpaces/RequireSharedSpaces/DumpSharedSpaces should not have a significant impact. DynamicDumpSharedSpaces has always been ignored by the VM so deprecating it should not have any impact.
      Show
      Users are most likely already using -Xshare:{off,on,auto,dump} so deprecating UseSharedSpaces/RequireSharedSpaces/DumpSharedSpaces should not have a significant impact. DynamicDumpSharedSpaces has always been ignored by the VM so deprecating it should not have any impact.
    • add/remove/modify command line option

      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")                                                \

            hseigel Harold Seigel (Inactive)
            iklam Ioi Lam
            Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: