src/share/vm/runtime/arguments.cpp

changeset 2644
a2c2eac1ca62
parent 2584
da091bb67459
child 2648
1fb790245268
     1.1 --- a/src/share/vm/runtime/arguments.cpp	Fri Mar 04 17:13:19 2011 -0500
     1.2 +++ b/src/share/vm/runtime/arguments.cpp	Sun Mar 06 11:37:18 2011 -0800
     1.3 @@ -242,6 +242,7 @@
     1.4                             JDK_Version::jdk_update(6,24), JDK_Version::jdk(8) },
     1.5    { "MaxLiveObjectEvacuationRatio",
     1.6                             JDK_Version::jdk_update(6,24), JDK_Version::jdk(8) },
     1.7 +  { "ForceSharedSpaces",   JDK_Version::jdk_update(6,25), JDK_Version::jdk(8) },
     1.8    { NULL, JDK_Version(0), JDK_Version(0) }
     1.9  };
    1.10  
    1.11 @@ -1003,28 +1004,6 @@
    1.12    }
    1.13  }
    1.14  
    1.15 -void Arguments::check_compressed_oops_compat() {
    1.16 -#ifdef _LP64
    1.17 -  assert(UseCompressedOops, "Precondition");
    1.18 -  // Is it on by default or set on ergonomically
    1.19 -  bool is_on_by_default = FLAG_IS_DEFAULT(UseCompressedOops) || FLAG_IS_ERGO(UseCompressedOops);
    1.20 -
    1.21 -  // If dumping an archive or forcing its use, disable compressed oops if possible
    1.22 -  if (DumpSharedSpaces || RequireSharedSpaces) {
    1.23 -    if (is_on_by_default) {
    1.24 -      FLAG_SET_DEFAULT(UseCompressedOops, false);
    1.25 -      return;
    1.26 -    } else {
    1.27 -      vm_exit_during_initialization(
    1.28 -        "Class Data Sharing is not supported with compressed oops yet", NULL);
    1.29 -    }
    1.30 -  } else if (UseSharedSpaces) {
    1.31 -    // UseSharedSpaces is on by default. With compressed oops, we turn it off.
    1.32 -    FLAG_SET_DEFAULT(UseSharedSpaces, false);
    1.33 -  }
    1.34 -#endif
    1.35 -}
    1.36 -
    1.37  void Arguments::set_tiered_flags() {
    1.38    if (FLAG_IS_DEFAULT(CompilationPolicyChoice)) {
    1.39      FLAG_SET_DEFAULT(CompilationPolicyChoice, 2);
    1.40 @@ -1382,7 +1361,7 @@
    1.41  void Arguments::set_ergonomics_flags() {
    1.42    // Parallel GC is not compatible with sharing. If one specifies
    1.43    // that they want sharing explicitly, do not set ergonomics flags.
    1.44 -  if (DumpSharedSpaces || ForceSharedSpaces) {
    1.45 +  if (DumpSharedSpaces || RequireSharedSpaces) {
    1.46      return;
    1.47    }
    1.48  
    1.49 @@ -1845,33 +1824,6 @@
    1.50  
    1.51    status = status && verify_percentage(GCHeapFreeLimit, "GCHeapFreeLimit");
    1.52  
    1.53 -  // Check whether user-specified sharing option conflicts with GC or page size.
    1.54 -  // Both sharing and large pages are enabled by default on some platforms;
    1.55 -  // large pages override sharing only if explicitly set on the command line.
    1.56 -  const bool cannot_share = UseConcMarkSweepGC || CMSIncrementalMode ||
    1.57 -          UseG1GC || UseParNewGC || UseParallelGC || UseParallelOldGC ||
    1.58 -          UseLargePages && FLAG_IS_CMDLINE(UseLargePages);
    1.59 -  if (cannot_share) {
    1.60 -    // Either force sharing on by forcing the other options off, or
    1.61 -    // force sharing off.
    1.62 -    if (DumpSharedSpaces || ForceSharedSpaces) {
    1.63 -      jio_fprintf(defaultStream::error_stream(),
    1.64 -                  "Using Serial GC and default page size because of %s\n",
    1.65 -                  ForceSharedSpaces ? "-Xshare:on" : "-Xshare:dump");
    1.66 -      force_serial_gc();
    1.67 -      FLAG_SET_DEFAULT(UseLargePages, false);
    1.68 -    } else {
    1.69 -      if (UseSharedSpaces && Verbose) {
    1.70 -        jio_fprintf(defaultStream::error_stream(),
    1.71 -                    "Turning off use of shared archive because of "
    1.72 -                    "choice of garbage collector or large pages\n");
    1.73 -      }
    1.74 -      no_shared_spaces();
    1.75 -    }
    1.76 -  } else if (UseLargePages && (UseSharedSpaces || DumpSharedSpaces)) {
    1.77 -    FLAG_SET_DEFAULT(UseLargePages, false);
    1.78 -  }
    1.79 -
    1.80    status = status && check_gc_consistency();
    1.81    status = status && check_stack_pages();
    1.82  
    1.83 @@ -2412,9 +2364,6 @@
    1.84      } else if (match_option(option, "-Xshare:on", &tail)) {
    1.85        FLAG_SET_CMDLINE(bool, UseSharedSpaces, true);
    1.86        FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true);
    1.87 -#ifdef TIERED
    1.88 -      FLAG_SET_CMDLINE(bool, ForceSharedSpaces, true);
    1.89 -#endif // TIERED
    1.90      // -Xshare:auto
    1.91      } else if (match_option(option, "-Xshare:auto", &tail)) {
    1.92        FLAG_SET_CMDLINE(bool, UseSharedSpaces, true);
    1.93 @@ -2915,6 +2864,36 @@
    1.94    return JNI_OK;
    1.95  }
    1.96  
    1.97 +void Arguments::set_shared_spaces_flags() {
    1.98 +  // Check whether class data sharing settings conflict with GC, compressed oops
    1.99 +  // or page size, and fix them up.  Explicit sharing options override other
   1.100 +  // settings.
   1.101 +  const bool cannot_share = UseConcMarkSweepGC || CMSIncrementalMode ||
   1.102 +    UseG1GC || UseParNewGC || UseParallelGC || UseParallelOldGC ||
   1.103 +    UseCompressedOops || UseLargePages && FLAG_IS_CMDLINE(UseLargePages);
   1.104 +  const bool must_share = DumpSharedSpaces || RequireSharedSpaces;
   1.105 +  const bool might_share = must_share || UseSharedSpaces;
   1.106 +  if (cannot_share) {
   1.107 +    if (must_share) {
   1.108 +      warning("selecting serial gc and disabling large pages %s"
   1.109 +              "because of %s", "" LP64_ONLY("and compressed oops "),
   1.110 +              DumpSharedSpaces ? "-Xshare:dump" : "-Xshare:on");
   1.111 +      force_serial_gc();
   1.112 +      FLAG_SET_CMDLINE(bool, UseLargePages, false);
   1.113 +      LP64_ONLY(FLAG_SET_CMDLINE(bool, UseCompressedOops, false));
   1.114 +    } else {
   1.115 +      if (UseSharedSpaces && Verbose) {
   1.116 +        warning("turning off use of shared archive because of "
   1.117 +                "choice of garbage collector or large pages");
   1.118 +      }
   1.119 +      no_shared_spaces();
   1.120 +    }
   1.121 +  } else if (UseLargePages && might_share) {
   1.122 +    // Disable large pages to allow shared spaces.  This is sub-optimal, since
   1.123 +    // there may not even be a shared archive to use.
   1.124 +    FLAG_SET_DEFAULT(UseLargePages, false);
   1.125 +  }
   1.126 +}
   1.127  
   1.128  // Parse entry point called from JNI_CreateJavaVM
   1.129  
   1.130 @@ -3062,9 +3041,7 @@
   1.131    // Set flags based on ergonomics.
   1.132    set_ergonomics_flags();
   1.133  
   1.134 -  if (UseCompressedOops) {
   1.135 -    check_compressed_oops_compat();
   1.136 -  }
   1.137 +  set_shared_spaces_flags();
   1.138  
   1.139    // Check the GC selections again.
   1.140    if (!check_gc_consistency()) {

mercurial