diff -r d204cee405b1 -r 7e2ece489a84 hotspot/src/share/vm/runtime/arguments.cpp --- a/hotspot/src/share/vm/runtime/arguments.cpp Wed Sep 26 09:54:11 2012 -0700 +++ b/hotspot/src/share/vm/runtime/arguments.cpp Wed Oct 10 14:28:08 2012 -0700 @@ -245,6 +245,18 @@ JDK_Version::jdk_update(6,27), JDK_Version::jdk(8) }, { "AllowTransitionalJSR292", JDK_Version::jdk(7), JDK_Version::jdk(8) }, { "UseCompressedStrings", JDK_Version::jdk(7), JDK_Version::jdk(8) }, + { "CMSPermGenPrecleaningEnabled", JDK_Version::jdk(8), JDK_Version::jdk(9) }, + { "CMSTriggerPermRatio", JDK_Version::jdk(8), JDK_Version::jdk(9) }, + { "CMSInitiatingPermOccupancyFraction", JDK_Version::jdk(8), JDK_Version::jdk(9) }, + { "AdaptivePermSizeWeight", JDK_Version::jdk(8), JDK_Version::jdk(9) }, + { "PermGenPadding", JDK_Version::jdk(8), JDK_Version::jdk(9) }, + { "PermMarkSweepDeadRatio", JDK_Version::jdk(8), JDK_Version::jdk(9) }, + { "PermSize", JDK_Version::jdk(8), JDK_Version::jdk(9) }, + { "MaxPermSize", JDK_Version::jdk(8), JDK_Version::jdk(9) }, + { "MinPermHeapExpansion", JDK_Version::jdk(8), JDK_Version::jdk(9) }, + { "MaxPermHeapExpansion", JDK_Version::jdk(8), JDK_Version::jdk(9) }, + { "CMSRevisitStackSize", JDK_Version::jdk(8), JDK_Version::jdk(9) }, + { "PrintRevisitStats", JDK_Version::jdk(8), JDK_Version::jdk(9) }, #ifdef PRODUCT { "DesiredMethodLimit", JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) }, @@ -1086,9 +1098,6 @@ } } if (UseParNewGC) { - // CDS doesn't work with ParNew yet - no_shared_spaces(); - // By default YoungPLABSize and OldPLABSize are set to 4096 and 1024 respectively, // these settings are default for Parallel Scavenger. For ParNew+Tenured configuration // we set them to 1024 and 1024. @@ -1332,10 +1341,10 @@ inline uintx max_heap_for_compressed_oops() { // Avoid sign flip. - if (OopEncodingHeapMax < MaxPermSize + os::vm_page_size()) { + if (OopEncodingHeapMax < ClassMetaspaceSize + os::vm_page_size()) { return 0; } - LP64_ONLY(return OopEncodingHeapMax - MaxPermSize - os::vm_page_size()); + LP64_ONLY(return OopEncodingHeapMax - ClassMetaspaceSize - os::vm_page_size()); NOT_LP64(ShouldNotReachHere(); return 0); } @@ -1354,11 +1363,6 @@ } void Arguments::set_ergonomics_flags() { - // Parallel GC is not compatible with sharing. If one specifies - // that they want sharing explicitly, do not set ergonomics flags. - if (DumpSharedSpaces || RequireSharedSpaces) { - return; - } if (os::is_server_class_machine()) { // If no other collector is requested explicitly, @@ -1368,13 +1372,19 @@ !UseConcMarkSweepGC && !UseG1GC && !UseParNewGC && - !DumpSharedSpaces && FLAG_IS_DEFAULT(UseParallelGC)) { if (should_auto_select_low_pause_collector()) { FLAG_SET_ERGO(bool, UseConcMarkSweepGC, true); } else { FLAG_SET_ERGO(bool, UseParallelGC, true); } + } + // Shared spaces work fine with other GCs but causes bytecode rewriting + // to be disabled, which hurts interpreter performance and decreases + // server performance. On server class machines, 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) { no_shared_spaces(); } } @@ -1402,6 +1412,30 @@ if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) { warning("Max heap size too large for Compressed Oops"); FLAG_SET_DEFAULT(UseCompressedOops, false); + FLAG_SET_DEFAULT(UseCompressedKlassPointers, false); + } + } + // UseCompressedOops must be on for UseCompressedKlassPointers to be on. + if (!UseCompressedOops) { + if (UseCompressedKlassPointers) { + warning("UseCompressedKlassPointers requires UseCompressedOops"); + } + FLAG_SET_DEFAULT(UseCompressedKlassPointers, false); + } else { + // Turn on UseCompressedKlassPointers too + // The compiler is broken for this so turn it on when the compiler is fixed. + // if (FLAG_IS_DEFAULT(UseCompressedKlassPointers)) { + // FLAG_SET_ERGO(bool, UseCompressedKlassPointers, true); + // } + // Set the ClassMetaspaceSize to something that will not need to be + // expanded, since it cannot be expanded. + if (UseCompressedKlassPointers && FLAG_IS_DEFAULT(ClassMetaspaceSize)) { + // 100,000 classes seems like a good size, so 100M assumes around 1K + // per klass. The vtable and oopMap is embedded so we don't have a fixed + // size per klass. Eventually, this will be parameterized because it + // would also be useful to determine the optimal size of the + // systemDictionary. + FLAG_SET_ERGO(uintx, ClassMetaspaceSize, 100*M); } } // Also checks that certain machines are slower with compressed oops @@ -1444,9 +1478,6 @@ if (FLAG_IS_DEFAULT(MarkSweepDeadRatio)) { FLAG_SET_DEFAULT(MarkSweepDeadRatio, 1); } - if (FLAG_IS_DEFAULT(PermMarkSweepDeadRatio)) { - FLAG_SET_DEFAULT(PermMarkSweepDeadRatio, 5); - } } } if (UseNUMA) { @@ -1470,7 +1501,6 @@ FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads()); } - no_shared_spaces(); if (FLAG_IS_DEFAULT(MarkStackSize)) { FLAG_SET_DEFAULT(MarkStackSize, 128 * TASKQUEUE_SIZE); @@ -1806,7 +1836,6 @@ status = status && verify_percentage(AdaptiveSizePolicyWeight, "AdaptiveSizePolicyWeight"); - status = status && verify_percentage(AdaptivePermSizeWeight, "AdaptivePermSizeWeight"); status = status && verify_percentage(ThresholdTolerance, "ThresholdTolerance"); status = status && verify_percentage(MinHeapFreeRatio, "MinHeapFreeRatio"); status = status && verify_percentage(MaxHeapFreeRatio, "MaxHeapFreeRatio"); @@ -1946,6 +1975,27 @@ status = status && verify_object_alignment(); + status = status && verify_min_value(ClassMetaspaceSize, 1*M, + "ClassMetaspaceSize"); + +#ifdef SPARC + if (UseConcMarkSweepGC || UseG1GC) { + // Issue a stern warning if the user has explicitly set + // UseMemSetInBOT (it is known to cause issues), but allow + // use for experimentation and debugging. + if (VM_Version::is_sun4v() && UseMemSetInBOT) { + assert(!FLAG_IS_DEFAULT(UseMemSetInBOT), "Error"); + warning("Experimental flag -XX:+UseMemSetInBOT is known to cause instability" + " on sun4v; please understand that you are using at your own risk!"); + } + } +#endif // SPARC + + if (PrintNMTStatistics && MemTracker::tracking_level() == MemTracker::NMT_off) { + warning("PrintNMTStatistics is disabled, because native memory tracking is not enabled"); + PrintNMTStatistics = false; + } + return status; } @@ -2385,13 +2435,7 @@ // -Xshare:dump } else if (match_option(option, "-Xshare:dump", &tail)) { -#ifdef TIERED - FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true); - set_mode_flags(_int); // Prevent compilation, which creates objects -#elif defined(COMPILER2) - vm_exit_during_initialization( - "Dumping a shared archive is not supported on the Server JVM.", NULL); -#elif defined(KERNEL) +#if defined(KERNEL) vm_exit_during_initialization( "Dumping a shared archive is not supported on the Kernel JVM.", NULL); #else @@ -2491,15 +2535,6 @@ // process space. The 64bit VM version of this function is a nop. initHeapSize = os::allocatable_physical_memory(initHeapSize); - // The perm gen is separate but contiguous with the - // object heap (and is reserved with it) so subtract it - // from the heap size. - if (initHeapSize > MaxPermSize) { - initHeapSize = initHeapSize - MaxPermSize; - } else { - warning("AggressiveHeap and MaxPermSize values may conflict"); - } - if (FLAG_IS_DEFAULT(MaxHeapSize)) { FLAG_SET_CMDLINE(uintx, MaxHeapSize, initHeapSize); FLAG_SET_CMDLINE(uintx, InitialHeapSize, initHeapSize); @@ -2904,39 +2939,25 @@ 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); + // CompressedOops cannot be used with CDS. The offsets of oopmaps and + // static fields are incorrect in the archive. With some more clever + // initialization, this restriction can probably be lifted. + // ??? UseLargePages might be okay now + const bool cannot_share = UseCompressedOops || + (UseLargePages && FLAG_IS_CMDLINE(UseLargePages)); if (cannot_share) { if (must_share) { - warning("selecting serial gc and disabling large pages %s" + warning("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)); + LP64_ONLY(FLAG_SET_CMDLINE(bool, UseCompressedKlassPointers, false)); } else { + // Prefer compressed oops and large pages to class data sharing if (UseSharedSpaces && Verbose) { - warning("turning off use of shared archive because of " - "choice of garbage collector or large pages"); + warning("turning off use of shared archive because of large pages%s", + "" LP64_ONLY(" and/or compressed oops")); } no_shared_spaces(); } @@ -2945,6 +2966,18 @@ // there may not even be a shared archive to use. FLAG_SET_DEFAULT(UseLargePages, false); } + + // Add 2M to any size for SharedReadOnlySize to get around the JPRT setting + if (DumpSharedSpaces && !FLAG_IS_DEFAULT(SharedReadOnlySize)) { + SharedReadOnlySize = 14*M; + } + + if (DumpSharedSpaces) { + if (RequireSharedSpaces) { + warning("cannot dump shared archive while using shared archive"); + } + UseSharedSpaces = false; + } } // Disable options not supported in this release, with a warning if they @@ -3103,12 +3136,6 @@ } ScavengeRootsInCode = 1; } - if (!JavaObjectsInPerm && ScavengeRootsInCode == 0) { - if (!FLAG_IS_DEFAULT(ScavengeRootsInCode)) { - warning("forcing ScavengeRootsInCode non-zero because JavaObjectsInPerm is false"); - } - ScavengeRootsInCode = 1; - } if (PrintGCDetails) { // Turn on -verbose:gc options as well @@ -3200,6 +3227,7 @@ FLAG_SET_DEFAULT(ProfileInterpreter, false); FLAG_SET_DEFAULT(UseBiasedLocking, false); LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedOops, false)); + LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedKlassPointers, false)); #endif // CC_INTERP #ifdef COMPILER2