JDK-8188105 : Make -Xshare:auto the default for server VM
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9,10
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2017-09-28
  • Updated: 2019-06-20
  • Resolved: 2018-04-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11
11 b11Fixed
Related Reports
CSR :  
Relates :  
Relates :  
Relates :  
Description
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.

We should 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.

The proposed change is to remove this block of code
http://hg.openjdk.java.net/jdk/hs/file/eebf559c9e0d/src/hotspot/share/runtime/arguments.cpp#l1819

#if COMPILER2_OR_JVMCI
  // Shared spaces work fine with other GCs but causes bytecode rewriting
  // to be disabled, which hurts interpreter performance and decreases
  // server performance.  When -server is specified, keep the default off
  // unless it is asked for.  Future work: either add bytecode rewriting
  // at link time, or rewrite bytecodes in non-shared methods.
  if (is_server_compilation_mode_vm() && !DumpSharedSpaces && !RequireSharedSpaces &&
      (FLAG_IS_DEFAULT(UseSharedSpaces) || !UseSharedSpaces)) {
    no_shared_spaces("COMPILER2 default: -Xshare:auto | off, have to manually setup to on.");
  }
#endif

Comments
The use of -Xshare:auto and -Xshare:on needs to be better thought out. Let's defer to the next release.
09-11-2017