243 JDK_Version::jdk_update(6,27), JDK_Version::jdk(8) }, |
243 JDK_Version::jdk_update(6,27), JDK_Version::jdk(8) }, |
244 { "UseParallelOldGCDensePrefix", |
244 { "UseParallelOldGCDensePrefix", |
245 JDK_Version::jdk_update(6,27), JDK_Version::jdk(8) }, |
245 JDK_Version::jdk_update(6,27), JDK_Version::jdk(8) }, |
246 { "AllowTransitionalJSR292", JDK_Version::jdk(7), JDK_Version::jdk(8) }, |
246 { "AllowTransitionalJSR292", JDK_Version::jdk(7), JDK_Version::jdk(8) }, |
247 { "UseCompressedStrings", JDK_Version::jdk(7), JDK_Version::jdk(8) }, |
247 { "UseCompressedStrings", JDK_Version::jdk(7), JDK_Version::jdk(8) }, |
|
248 { "CMSPermGenPrecleaningEnabled", JDK_Version::jdk(8), JDK_Version::jdk(9) }, |
|
249 { "CMSTriggerPermRatio", JDK_Version::jdk(8), JDK_Version::jdk(9) }, |
|
250 { "CMSInitiatingPermOccupancyFraction", JDK_Version::jdk(8), JDK_Version::jdk(9) }, |
|
251 { "AdaptivePermSizeWeight", JDK_Version::jdk(8), JDK_Version::jdk(9) }, |
|
252 { "PermGenPadding", JDK_Version::jdk(8), JDK_Version::jdk(9) }, |
|
253 { "PermMarkSweepDeadRatio", JDK_Version::jdk(8), JDK_Version::jdk(9) }, |
|
254 { "PermSize", JDK_Version::jdk(8), JDK_Version::jdk(9) }, |
|
255 { "MaxPermSize", JDK_Version::jdk(8), JDK_Version::jdk(9) }, |
|
256 { "MinPermHeapExpansion", JDK_Version::jdk(8), JDK_Version::jdk(9) }, |
|
257 { "MaxPermHeapExpansion", JDK_Version::jdk(8), JDK_Version::jdk(9) }, |
|
258 { "CMSRevisitStackSize", JDK_Version::jdk(8), JDK_Version::jdk(9) }, |
|
259 { "PrintRevisitStats", JDK_Version::jdk(8), JDK_Version::jdk(9) }, |
248 #ifdef PRODUCT |
260 #ifdef PRODUCT |
249 { "DesiredMethodLimit", |
261 { "DesiredMethodLimit", |
250 JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) }, |
262 JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) }, |
251 #endif // PRODUCT |
263 #endif // PRODUCT |
252 { NULL, JDK_Version(0), JDK_Version(0) } |
264 { NULL, JDK_Version(0), JDK_Version(0) } |
1084 FLAG_SET_DEFAULT(UseParNewGC, false); |
1096 FLAG_SET_DEFAULT(UseParNewGC, false); |
1085 FLAG_SET_DEFAULT(ParallelGCThreads, 0); |
1097 FLAG_SET_DEFAULT(ParallelGCThreads, 0); |
1086 } |
1098 } |
1087 } |
1099 } |
1088 if (UseParNewGC) { |
1100 if (UseParNewGC) { |
1089 // CDS doesn't work with ParNew yet |
|
1090 no_shared_spaces(); |
|
1091 |
|
1092 // By default YoungPLABSize and OldPLABSize are set to 4096 and 1024 respectively, |
1101 // By default YoungPLABSize and OldPLABSize are set to 4096 and 1024 respectively, |
1093 // these settings are default for Parallel Scavenger. For ParNew+Tenured configuration |
1102 // these settings are default for Parallel Scavenger. For ParNew+Tenured configuration |
1094 // we set them to 1024 and 1024. |
1103 // we set them to 1024 and 1024. |
1095 // See CR 6362902. |
1104 // See CR 6362902. |
1096 if (FLAG_IS_DEFAULT(YoungPLABSize)) { |
1105 if (FLAG_IS_DEFAULT(YoungPLABSize)) { |
1352 } |
1361 } |
1353 return false; |
1362 return false; |
1354 } |
1363 } |
1355 |
1364 |
1356 void Arguments::set_ergonomics_flags() { |
1365 void Arguments::set_ergonomics_flags() { |
1357 // Parallel GC is not compatible with sharing. If one specifies |
|
1358 // that they want sharing explicitly, do not set ergonomics flags. |
|
1359 if (DumpSharedSpaces || RequireSharedSpaces) { |
|
1360 return; |
|
1361 } |
|
1362 |
1366 |
1363 if (os::is_server_class_machine()) { |
1367 if (os::is_server_class_machine()) { |
1364 // If no other collector is requested explicitly, |
1368 // If no other collector is requested explicitly, |
1365 // let the VM select the collector based on |
1369 // let the VM select the collector based on |
1366 // machine class and automatic selection policy. |
1370 // machine class and automatic selection policy. |
1367 if (!UseSerialGC && |
1371 if (!UseSerialGC && |
1368 !UseConcMarkSweepGC && |
1372 !UseConcMarkSweepGC && |
1369 !UseG1GC && |
1373 !UseG1GC && |
1370 !UseParNewGC && |
1374 !UseParNewGC && |
1371 !DumpSharedSpaces && |
|
1372 FLAG_IS_DEFAULT(UseParallelGC)) { |
1375 FLAG_IS_DEFAULT(UseParallelGC)) { |
1373 if (should_auto_select_low_pause_collector()) { |
1376 if (should_auto_select_low_pause_collector()) { |
1374 FLAG_SET_ERGO(bool, UseConcMarkSweepGC, true); |
1377 FLAG_SET_ERGO(bool, UseConcMarkSweepGC, true); |
1375 } else { |
1378 } else { |
1376 FLAG_SET_ERGO(bool, UseParallelGC, true); |
1379 FLAG_SET_ERGO(bool, UseParallelGC, true); |
1377 } |
1380 } |
|
1381 } |
|
1382 // Shared spaces work fine with other GCs but causes bytecode rewriting |
|
1383 // to be disabled, which hurts interpreter performance and decreases |
|
1384 // server performance. On server class machines, keep the default |
|
1385 // off unless it is asked for. Future work: either add bytecode rewriting |
|
1386 // at link time, or rewrite bytecodes in non-shared methods. |
|
1387 if (!DumpSharedSpaces && !RequireSharedSpaces) { |
1378 no_shared_spaces(); |
1388 no_shared_spaces(); |
1379 } |
1389 } |
1380 } |
1390 } |
1381 |
1391 |
1382 #ifndef ZERO |
1392 #ifndef ZERO |
1400 #endif // _WIN64 |
1410 #endif // _WIN64 |
1401 } else { |
1411 } else { |
1402 if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) { |
1412 if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) { |
1403 warning("Max heap size too large for Compressed Oops"); |
1413 warning("Max heap size too large for Compressed Oops"); |
1404 FLAG_SET_DEFAULT(UseCompressedOops, false); |
1414 FLAG_SET_DEFAULT(UseCompressedOops, false); |
|
1415 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false); |
|
1416 } |
|
1417 } |
|
1418 // UseCompressedOops must be on for UseCompressedKlassPointers to be on. |
|
1419 if (!UseCompressedOops) { |
|
1420 if (UseCompressedKlassPointers) { |
|
1421 warning("UseCompressedKlassPointers requires UseCompressedOops"); |
|
1422 } |
|
1423 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false); |
|
1424 } else { |
|
1425 // Turn on UseCompressedKlassPointers too |
|
1426 // The compiler is broken for this so turn it on when the compiler is fixed. |
|
1427 // if (FLAG_IS_DEFAULT(UseCompressedKlassPointers)) { |
|
1428 // FLAG_SET_ERGO(bool, UseCompressedKlassPointers, true); |
|
1429 // } |
|
1430 // Set the ClassMetaspaceSize to something that will not need to be |
|
1431 // expanded, since it cannot be expanded. |
|
1432 if (UseCompressedKlassPointers && FLAG_IS_DEFAULT(ClassMetaspaceSize)) { |
|
1433 // 100,000 classes seems like a good size, so 100M assumes around 1K |
|
1434 // per klass. The vtable and oopMap is embedded so we don't have a fixed |
|
1435 // size per klass. Eventually, this will be parameterized because it |
|
1436 // would also be useful to determine the optimal size of the |
|
1437 // systemDictionary. |
|
1438 FLAG_SET_ERGO(uintx, ClassMetaspaceSize, 100*M); |
1405 } |
1439 } |
1406 } |
1440 } |
1407 // Also checks that certain machines are slower with compressed oops |
1441 // Also checks that certain machines are slower with compressed oops |
1408 // in vm_version initialization code. |
1442 // in vm_version initialization code. |
1409 #endif // _LP64 |
1443 #endif // _LP64 |
1441 // Par compact uses lower default values since they are treated as |
1475 // Par compact uses lower default values since they are treated as |
1442 // minimums. These are different defaults because of the different |
1476 // minimums. These are different defaults because of the different |
1443 // interpretation and are not ergonomically set. |
1477 // interpretation and are not ergonomically set. |
1444 if (FLAG_IS_DEFAULT(MarkSweepDeadRatio)) { |
1478 if (FLAG_IS_DEFAULT(MarkSweepDeadRatio)) { |
1445 FLAG_SET_DEFAULT(MarkSweepDeadRatio, 1); |
1479 FLAG_SET_DEFAULT(MarkSweepDeadRatio, 1); |
1446 } |
|
1447 if (FLAG_IS_DEFAULT(PermMarkSweepDeadRatio)) { |
|
1448 FLAG_SET_DEFAULT(PermMarkSweepDeadRatio, 5); |
|
1449 } |
1480 } |
1450 } |
1481 } |
1451 } |
1482 } |
1452 if (UseNUMA) { |
1483 if (UseNUMA) { |
1453 if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) { |
1484 if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) { |
1468 Abstract_VM_Version::parallel_worker_threads()); |
1499 Abstract_VM_Version::parallel_worker_threads()); |
1469 if (ParallelGCThreads == 0) { |
1500 if (ParallelGCThreads == 0) { |
1470 FLAG_SET_DEFAULT(ParallelGCThreads, |
1501 FLAG_SET_DEFAULT(ParallelGCThreads, |
1471 Abstract_VM_Version::parallel_worker_threads()); |
1502 Abstract_VM_Version::parallel_worker_threads()); |
1472 } |
1503 } |
1473 no_shared_spaces(); |
|
1474 |
1504 |
1475 if (FLAG_IS_DEFAULT(MarkStackSize)) { |
1505 if (FLAG_IS_DEFAULT(MarkStackSize)) { |
1476 FLAG_SET_DEFAULT(MarkStackSize, 128 * TASKQUEUE_SIZE); |
1506 FLAG_SET_DEFAULT(MarkStackSize, 128 * TASKQUEUE_SIZE); |
1477 } |
1507 } |
1478 if (PrintGCDetails && Verbose) { |
1508 if (PrintGCDetails && Verbose) { |
1804 status = false; |
1834 status = false; |
1805 } |
1835 } |
1806 |
1836 |
1807 status = status && verify_percentage(AdaptiveSizePolicyWeight, |
1837 status = status && verify_percentage(AdaptiveSizePolicyWeight, |
1808 "AdaptiveSizePolicyWeight"); |
1838 "AdaptiveSizePolicyWeight"); |
1809 status = status && verify_percentage(AdaptivePermSizeWeight, "AdaptivePermSizeWeight"); |
|
1810 status = status && verify_percentage(ThresholdTolerance, "ThresholdTolerance"); |
1839 status = status && verify_percentage(ThresholdTolerance, "ThresholdTolerance"); |
1811 status = status && verify_percentage(MinHeapFreeRatio, "MinHeapFreeRatio"); |
1840 status = status && verify_percentage(MinHeapFreeRatio, "MinHeapFreeRatio"); |
1812 status = status && verify_percentage(MaxHeapFreeRatio, "MaxHeapFreeRatio"); |
1841 status = status && verify_percentage(MaxHeapFreeRatio, "MaxHeapFreeRatio"); |
1813 |
1842 |
1814 if (MinHeapFreeRatio > MaxHeapFreeRatio) { |
1843 if (MinHeapFreeRatio > MaxHeapFreeRatio) { |
1943 // expression. |
1972 // expression. |
1944 status = status && verify_interval(TLABWasteTargetPercent, |
1973 status = status && verify_interval(TLABWasteTargetPercent, |
1945 1, 100, "TLABWasteTargetPercent"); |
1974 1, 100, "TLABWasteTargetPercent"); |
1946 |
1975 |
1947 status = status && verify_object_alignment(); |
1976 status = status && verify_object_alignment(); |
|
1977 |
|
1978 status = status && verify_min_value(ClassMetaspaceSize, 1*M, |
|
1979 "ClassMetaspaceSize"); |
|
1980 |
|
1981 #ifdef SPARC |
|
1982 if (UseConcMarkSweepGC || UseG1GC) { |
|
1983 // Issue a stern warning if the user has explicitly set |
|
1984 // UseMemSetInBOT (it is known to cause issues), but allow |
|
1985 // use for experimentation and debugging. |
|
1986 if (VM_Version::is_sun4v() && UseMemSetInBOT) { |
|
1987 assert(!FLAG_IS_DEFAULT(UseMemSetInBOT), "Error"); |
|
1988 warning("Experimental flag -XX:+UseMemSetInBOT is known to cause instability" |
|
1989 " on sun4v; please understand that you are using at your own risk!"); |
|
1990 } |
|
1991 } |
|
1992 #endif // SPARC |
|
1993 |
|
1994 if (PrintNMTStatistics && MemTracker::tracking_level() == MemTracker::NMT_off) { |
|
1995 warning("PrintNMTStatistics is disabled, because native memory tracking is not enabled"); |
|
1996 PrintNMTStatistics = false; |
|
1997 } |
1948 |
1998 |
1949 return status; |
1999 return status; |
1950 } |
2000 } |
1951 |
2001 |
1952 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore, |
2002 bool Arguments::is_bad_option(const JavaVMOption* option, jboolean ignore, |
2383 // for testing the compiler; turn off all flags that inhibit compilation |
2433 // for testing the compiler; turn off all flags that inhibit compilation |
2384 set_mode_flags(_comp); |
2434 set_mode_flags(_comp); |
2385 |
2435 |
2386 // -Xshare:dump |
2436 // -Xshare:dump |
2387 } else if (match_option(option, "-Xshare:dump", &tail)) { |
2437 } else if (match_option(option, "-Xshare:dump", &tail)) { |
2388 #ifdef TIERED |
2438 #if defined(KERNEL) |
2389 FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true); |
|
2390 set_mode_flags(_int); // Prevent compilation, which creates objects |
|
2391 #elif defined(COMPILER2) |
|
2392 vm_exit_during_initialization( |
|
2393 "Dumping a shared archive is not supported on the Server JVM.", NULL); |
|
2394 #elif defined(KERNEL) |
|
2395 vm_exit_during_initialization( |
2439 vm_exit_during_initialization( |
2396 "Dumping a shared archive is not supported on the Kernel JVM.", NULL); |
2440 "Dumping a shared archive is not supported on the Kernel JVM.", NULL); |
2397 #else |
2441 #else |
2398 FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true); |
2442 FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true); |
2399 set_mode_flags(_int); // Prevent compilation, which creates objects |
2443 set_mode_flags(_int); // Prevent compilation, which creates objects |
2488 total_memory - (julong)160*M); |
2532 total_memory - (julong)160*M); |
2489 |
2533 |
2490 // Make sure that if we have a lot of memory we cap the 32 bit |
2534 // Make sure that if we have a lot of memory we cap the 32 bit |
2491 // process space. The 64bit VM version of this function is a nop. |
2535 // process space. The 64bit VM version of this function is a nop. |
2492 initHeapSize = os::allocatable_physical_memory(initHeapSize); |
2536 initHeapSize = os::allocatable_physical_memory(initHeapSize); |
2493 |
|
2494 // The perm gen is separate but contiguous with the |
|
2495 // object heap (and is reserved with it) so subtract it |
|
2496 // from the heap size. |
|
2497 if (initHeapSize > MaxPermSize) { |
|
2498 initHeapSize = initHeapSize - MaxPermSize; |
|
2499 } else { |
|
2500 warning("AggressiveHeap and MaxPermSize values may conflict"); |
|
2501 } |
|
2502 |
2537 |
2503 if (FLAG_IS_DEFAULT(MaxHeapSize)) { |
2538 if (FLAG_IS_DEFAULT(MaxHeapSize)) { |
2504 FLAG_SET_CMDLINE(uintx, MaxHeapSize, initHeapSize); |
2539 FLAG_SET_CMDLINE(uintx, MaxHeapSize, initHeapSize); |
2505 FLAG_SET_CMDLINE(uintx, InitialHeapSize, initHeapSize); |
2540 FLAG_SET_CMDLINE(uintx, InitialHeapSize, initHeapSize); |
2506 // Currently the minimum size and the initial heap sizes are the same. |
2541 // Currently the minimum size and the initial heap sizes are the same. |
2902 |
2937 |
2903 void Arguments::set_shared_spaces_flags() { |
2938 void Arguments::set_shared_spaces_flags() { |
2904 const bool must_share = DumpSharedSpaces || RequireSharedSpaces; |
2939 const bool must_share = DumpSharedSpaces || RequireSharedSpaces; |
2905 const bool might_share = must_share || UseSharedSpaces; |
2940 const bool might_share = must_share || UseSharedSpaces; |
2906 |
2941 |
2907 // The string table is part of the shared archive so the size must match. |
2942 // CompressedOops cannot be used with CDS. The offsets of oopmaps and |
2908 if (!FLAG_IS_DEFAULT(StringTableSize)) { |
2943 // static fields are incorrect in the archive. With some more clever |
2909 // Disable sharing. |
2944 // initialization, this restriction can probably be lifted. |
2910 if (must_share) { |
2945 // ??? UseLargePages might be okay now |
2911 warning("disabling shared archive %s because of non-default " |
2946 const bool cannot_share = UseCompressedOops || |
2912 "StringTableSize", DumpSharedSpaces ? "creation" : "use"); |
2947 (UseLargePages && FLAG_IS_CMDLINE(UseLargePages)); |
2913 } |
|
2914 if (might_share) { |
|
2915 FLAG_SET_DEFAULT(DumpSharedSpaces, false); |
|
2916 FLAG_SET_DEFAULT(RequireSharedSpaces, false); |
|
2917 FLAG_SET_DEFAULT(UseSharedSpaces, false); |
|
2918 } |
|
2919 return; |
|
2920 } |
|
2921 |
|
2922 // Check whether class data sharing settings conflict with GC, compressed oops |
|
2923 // or page size, and fix them up. Explicit sharing options override other |
|
2924 // settings. |
|
2925 const bool cannot_share = UseConcMarkSweepGC || CMSIncrementalMode || |
|
2926 UseG1GC || UseParNewGC || UseParallelGC || UseParallelOldGC || |
|
2927 UseCompressedOops || UseLargePages && FLAG_IS_CMDLINE(UseLargePages); |
|
2928 if (cannot_share) { |
2948 if (cannot_share) { |
2929 if (must_share) { |
2949 if (must_share) { |
2930 warning("selecting serial gc and disabling large pages %s" |
2950 warning("disabling large pages %s" |
2931 "because of %s", "" LP64_ONLY("and compressed oops "), |
2951 "because of %s", "" LP64_ONLY("and compressed oops "), |
2932 DumpSharedSpaces ? "-Xshare:dump" : "-Xshare:on"); |
2952 DumpSharedSpaces ? "-Xshare:dump" : "-Xshare:on"); |
2933 force_serial_gc(); |
|
2934 FLAG_SET_CMDLINE(bool, UseLargePages, false); |
2953 FLAG_SET_CMDLINE(bool, UseLargePages, false); |
2935 LP64_ONLY(FLAG_SET_CMDLINE(bool, UseCompressedOops, false)); |
2954 LP64_ONLY(FLAG_SET_CMDLINE(bool, UseCompressedOops, false)); |
|
2955 LP64_ONLY(FLAG_SET_CMDLINE(bool, UseCompressedKlassPointers, false)); |
2936 } else { |
2956 } else { |
|
2957 // Prefer compressed oops and large pages to class data sharing |
2937 if (UseSharedSpaces && Verbose) { |
2958 if (UseSharedSpaces && Verbose) { |
2938 warning("turning off use of shared archive because of " |
2959 warning("turning off use of shared archive because of large pages%s", |
2939 "choice of garbage collector or large pages"); |
2960 "" LP64_ONLY(" and/or compressed oops")); |
2940 } |
2961 } |
2941 no_shared_spaces(); |
2962 no_shared_spaces(); |
2942 } |
2963 } |
2943 } else if (UseLargePages && might_share) { |
2964 } else if (UseLargePages && might_share) { |
2944 // Disable large pages to allow shared spaces. This is sub-optimal, since |
2965 // Disable large pages to allow shared spaces. This is sub-optimal, since |
2945 // there may not even be a shared archive to use. |
2966 // there may not even be a shared archive to use. |
2946 FLAG_SET_DEFAULT(UseLargePages, false); |
2967 FLAG_SET_DEFAULT(UseLargePages, false); |
|
2968 } |
|
2969 |
|
2970 // Add 2M to any size for SharedReadOnlySize to get around the JPRT setting |
|
2971 if (DumpSharedSpaces && !FLAG_IS_DEFAULT(SharedReadOnlySize)) { |
|
2972 SharedReadOnlySize = 14*M; |
|
2973 } |
|
2974 |
|
2975 if (DumpSharedSpaces) { |
|
2976 if (RequireSharedSpaces) { |
|
2977 warning("cannot dump shared archive while using shared archive"); |
|
2978 } |
|
2979 UseSharedSpaces = false; |
2947 } |
2980 } |
2948 } |
2981 } |
2949 |
2982 |
2950 // Disable options not supported in this release, with a warning if they |
2983 // Disable options not supported in this release, with a warning if they |
2951 // were explicitly requested on the command-line |
2984 // were explicitly requested on the command-line |
3198 #ifdef CC_INTERP |
3225 #ifdef CC_INTERP |
3199 // Clear flags not supported by the C++ interpreter |
3226 // Clear flags not supported by the C++ interpreter |
3200 FLAG_SET_DEFAULT(ProfileInterpreter, false); |
3227 FLAG_SET_DEFAULT(ProfileInterpreter, false); |
3201 FLAG_SET_DEFAULT(UseBiasedLocking, false); |
3228 FLAG_SET_DEFAULT(UseBiasedLocking, false); |
3202 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedOops, false)); |
3229 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedOops, false)); |
|
3230 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedKlassPointers, false)); |
3203 #endif // CC_INTERP |
3231 #endif // CC_INTERP |
3204 |
3232 |
3205 #ifdef COMPILER2 |
3233 #ifdef COMPILER2 |
3206 if (!UseBiasedLocking || EmitSync != 0) { |
3234 if (!UseBiasedLocking || EmitSync != 0) { |
3207 UseOptoBiasInlining = false; |
3235 UseOptoBiasInlining = false; |