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

Make -Xshare:auto the default for server VM

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P3
    • Resolution: Approved
    • Fix Version/s: 11
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      Some script may assume that the CDS archive is not used even if it's present inside the JDK. However, there will be no behavioral differences at the Java language level whether CDS is used or not.
    • Interface Kind:
      add/remove/modify command line option
    • Scope:
      Implementation

      Description

      Summary

      Currently the default class data sharing (CDS) setting for Server VM is -Xshare:off. Change the default to -Xshare:auto to make it easier to use CDS.

      Problem

      We expect CDS to be widely used with the Server VM. However, the current default CDS setting for Server VM is -Xshare:off. This makes it cumbersome to use CDS.

      Solution

      Change the default to -Xshare:auto, so as long as a CDS archive exists in the JDK, CDS will be automatically used without specifying extra flags.

      In JDK 8 and before, RewriteBytecodes was disabled when CDS was enabled. This caused performance degradation in the Server Compiler (aka C2). However this has been fixed in JDK-8074345 since JDK 9, so there's no longer need to disable CDS by default with the Server VM.

      Specification

      For the Server VM, if the -Xshare option is not explicitly specified in the command-line:

      • If the -XX:SharedArchiveFile=<file> option is specified, and <file> exists, the JVM will attempt to map <file> as the CDS archive, as if -Xshare:auto had been specified.
      • If the -XX:SharedArchiveFile option is not specified, the VM will attempt to map the default CDS archive ( $JAVA_HOME/lib/server/classes.jsa), as if -Xshare:auto had been specified.

      Note: no user visible changes are needed in the -help output because the current output for the server VM already says (incorrectly)

          -Xshare:auto      use shared class data if possible (default)
          -Xshare:off       do not attempt to use shared class data
          -Xshare:on        require using shared class data, otherwise fail.

      so in a way we are just changing the implementation to match the documentation.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                iklam Ioi Lam
                Reporter:
                iklam Ioi Lam
                Reviewed By:
                Alan Bateman, Calvin Cheung
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: