JDK-8197967 : Make -Xshare:auto the default for server VM
  • Type: CSR
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P3
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 11
  • Submitted: 2018-02-14
  • Updated: 2018-08-30
  • Resolved: 2018-03-22
Related Reports
CSR :  
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](https://bugs.openjdk.java.net/browse/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.
Comments
Voting to Approved updated request.
22-03-2018

Updated the Specification to be clear about the proposed behavior change. Also added a note that the `-help` output is not affected.
22-03-2018

Please indicate what user-visible change is surfaced as part of the CSR and then Propose or Finalize the request for it to progress in the CSR process.
22-03-2018

Please add a specification section which indicates what is changing. For example, the -help output which should hopefully list the default. Procedually marked as pended until this is addressed.
07-03-2018

This is a welcome change. It is release note worthy so I've added the release-note label to the issue as a reminder. I assume the patch can be dropped from the Specification section, it's not needed for this CSR.
06-03-2018

Looks good. Reviewed.
05-03-2018