hotspot/src/share/vm/runtime/arguments.cpp
changeset 8727 1642a45f024f
parent 8725 8c1e3dd5fe1b
child 9177 fe622b63b368
child 8883 5569135acca3
child 9130 7d6aa04b56c1
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Mon Mar 21 14:06:50 2011 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Mon Mar 21 18:38:00 2011 -0700
@@ -2819,22 +2819,38 @@
 }
 
 void Arguments::set_shared_spaces_flags() {
+  const bool must_share = DumpSharedSpaces || RequireSharedSpaces;
+  const bool might_share = must_share || UseSharedSpaces;
+
+  // The string table is part of the shared archive so the size must match.
+  if (!FLAG_IS_DEFAULT(StringTableSize)) {
+    // Disable sharing.
+    if (must_share) {
+      warning("disabling shared archive %s because of non-default "
+              "StringTableSize", DumpSharedSpaces ? "creation" : "use");
+    }
+    if (might_share) {
+      FLAG_SET_DEFAULT(DumpSharedSpaces, false);
+      FLAG_SET_DEFAULT(RequireSharedSpaces, false);
+      FLAG_SET_DEFAULT(UseSharedSpaces, false);
+    }
+    return;
+  }
+
   // Check whether class data sharing settings conflict with GC, compressed oops
   // or page size, and fix them up.  Explicit sharing options override other
   // settings.
   const bool cannot_share = UseConcMarkSweepGC || CMSIncrementalMode ||
     UseG1GC || UseParNewGC || UseParallelGC || UseParallelOldGC ||
     UseCompressedOops || UseLargePages && FLAG_IS_CMDLINE(UseLargePages);
-  const bool must_share = DumpSharedSpaces || RequireSharedSpaces;
-  const bool might_share = must_share || UseSharedSpaces;
   if (cannot_share) {
     if (must_share) {
-      warning("selecting serial gc and disabling large pages %s"
-              "because of %s", "" LP64_ONLY("and compressed oops "),
-              DumpSharedSpaces ? "-Xshare:dump" : "-Xshare:on");
-      force_serial_gc();
-      FLAG_SET_CMDLINE(bool, UseLargePages, false);
-      LP64_ONLY(FLAG_SET_CMDLINE(bool, UseCompressedOops, false));
+        warning("selecting serial gc and disabling large pages %s"
+                "because of %s", "" LP64_ONLY("and compressed oops "),
+                DumpSharedSpaces ? "-Xshare:dump" : "-Xshare:on");
+        force_serial_gc();
+        FLAG_SET_CMDLINE(bool, UseLargePages, false);
+        LP64_ONLY(FLAG_SET_CMDLINE(bool, UseCompressedOops, false));
     } else {
       if (UseSharedSpaces && Verbose) {
         warning("turning off use of shared archive because of "