JDK-8152356 : Change to -Xshare:auto for 32-bit platforms
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2016-03-21
  • Updated: 2016-12-19
  • Resolved: 2016-04-29
Related Reports
Relates :  
Relates :  
Relates :  
Sub Tasks
JDK-8152357 :  
Description
The following #ifdef block should be removed. The comments in there is no longer correct.

After JDK-8074345, bytecode rewriting is enabled for non-shared classes. So CDS should no longer affect the performance of benchmarks executed by C2.

----------
void Arguments::set_ergonomics_flags() {
  select_gc();

#if defined(COMPILER2) || INCLUDE_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 (!DumpSharedSpaces && !RequireSharedSpaces &&
      (FLAG_IS_DEFAULT(UseSharedSpaces) || !UseSharedSpaces)) {
    no_shared_spaces("COMPILER2 default: -Xshare:auto | off, have to manually setup to on.");
  }
#endif
------------
Comments
Just because -Xshare:auto is the default, it doesn't mean we have to generate an archive as part of the install process. That is an independent action/decision. This RFE is simply asking the question "if there exists an archive should we use it by default?"
18-04-2016

As for testing - I agree, we can use a trick, a simple test case that executes -Xshare:dump. If we execute this test case first, then the rest of the test group can take advantage of the archive. There are couple of things to watch out though: - the initial 'dump' operation can fail (mapping failure) - most of nightly/pit testing uses concurrent execution, where the first test in the test list / test group is not actually guaranteed to be first (but close enough) - Using -Xshare:on is not a good idea for nightly/pit, since we will get lot's of nightly failures when mapping fails
06-04-2016

If we make -Xshare:auto as default behavior for 'server' config, we may need to generate an archive as part of install/deploy process, for actual production use (not testing). This is a management decision of course, but we need to notify install&deploy team of potential impact. Also, we need to make sure that our class list is now optimized for server use case, which is usually a task for performance team.
06-04-2016