comparison src/share/vm/runtime/arguments.cpp @ 7482:989155e2d07a

Merge with hs25-b15.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Wed, 16 Jan 2013 01:34:24 +0100
parents 2912b72d840a f1c06dcee0b5
children 3ac7d10a6572
comparison
equal deleted inserted replaced
7381:6761a8f854a4 7482:989155e2d07a
1099 } 1099 }
1100 FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false); 1100 FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false);
1101 } 1101 }
1102 } 1102 }
1103 1103
1104 // If the user has chosen ParallelGCThreads > 0, we set UseParNewGC
1105 // if it's not explictly set or unset. If the user has chosen
1106 // UseParNewGC and not explicitly set ParallelGCThreads we
1107 // set it, unless this is a single cpu machine.
1108 void Arguments::set_parnew_gc_flags() { 1104 void Arguments::set_parnew_gc_flags() {
1109 assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC, 1105 assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC,
1110 "control point invariant"); 1106 "control point invariant");
1111 assert(UseParNewGC, "Error"); 1107 assert(UseParNewGC, "Error");
1112 1108
1113 // Turn off AdaptiveSizePolicy for parnew until it is complete. 1109 // Turn off AdaptiveSizePolicy for parnew until it is complete.
1114 disable_adaptive_size_policy("UseParNewGC"); 1110 disable_adaptive_size_policy("UseParNewGC");
1115 1111
1116 if (ParallelGCThreads == 0) { 1112 if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
1117 FLAG_SET_DEFAULT(ParallelGCThreads, 1113 FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads());
1118 Abstract_VM_Version::parallel_worker_threads()); 1114 assert(ParallelGCThreads > 0, "We should always have at least one thread by default");
1119 if (ParallelGCThreads == 1) { 1115 } else if (ParallelGCThreads == 0) {
1120 FLAG_SET_DEFAULT(UseParNewGC, false); 1116 jio_fprintf(defaultStream::error_stream(),
1121 FLAG_SET_DEFAULT(ParallelGCThreads, 0); 1117 "The ParNew GC can not be combined with -XX:ParallelGCThreads=0\n");
1122 } 1118 vm_exit(1);
1123 } 1119 }
1124 if (UseParNewGC) { 1120
1125 // By default YoungPLABSize and OldPLABSize are set to 4096 and 1024 respectively, 1121 // By default YoungPLABSize and OldPLABSize are set to 4096 and 1024 respectively,
1126 // these settings are default for Parallel Scavenger. For ParNew+Tenured configuration 1122 // these settings are default for Parallel Scavenger. For ParNew+Tenured configuration
1127 // we set them to 1024 and 1024. 1123 // we set them to 1024 and 1024.
1128 // See CR 6362902. 1124 // See CR 6362902.
1129 if (FLAG_IS_DEFAULT(YoungPLABSize)) { 1125 if (FLAG_IS_DEFAULT(YoungPLABSize)) {
1130 FLAG_SET_DEFAULT(YoungPLABSize, (intx)1024); 1126 FLAG_SET_DEFAULT(YoungPLABSize, (intx)1024);
1131 } 1127 }
1132 if (FLAG_IS_DEFAULT(OldPLABSize)) { 1128 if (FLAG_IS_DEFAULT(OldPLABSize)) {
1133 FLAG_SET_DEFAULT(OldPLABSize, (intx)1024); 1129 FLAG_SET_DEFAULT(OldPLABSize, (intx)1024);
1134 } 1130 }
1135 1131
1136 // AlwaysTenure flag should make ParNew promote all at first collection. 1132 // AlwaysTenure flag should make ParNew promote all at first collection.
1137 // See CR 6362902. 1133 // See CR 6362902.
1138 if (AlwaysTenure) { 1134 if (AlwaysTenure) {
1139 FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, 0); 1135 FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, 0);
1140 } 1136 }
1141 // When using compressed oops, we use local overflow stacks, 1137 // When using compressed oops, we use local overflow stacks,
1142 // rather than using a global overflow list chained through 1138 // rather than using a global overflow list chained through
1143 // the klass word of the object's pre-image. 1139 // the klass word of the object's pre-image.
1144 if (UseCompressedOops && !ParGCUseLocalOverflow) { 1140 if (UseCompressedOops && !ParGCUseLocalOverflow) {
1145 if (!FLAG_IS_DEFAULT(ParGCUseLocalOverflow)) { 1141 if (!FLAG_IS_DEFAULT(ParGCUseLocalOverflow)) {
1146 warning("Forcing +ParGCUseLocalOverflow: needed if using compressed references"); 1142 warning("Forcing +ParGCUseLocalOverflow: needed if using compressed references");
1147 } 1143 }
1148 FLAG_SET_DEFAULT(ParGCUseLocalOverflow, true); 1144 FLAG_SET_DEFAULT(ParGCUseLocalOverflow, true);
1149 } 1145 }
1150 assert(ParGCUseLocalOverflow || !UseCompressedOops, "Error"); 1146 assert(ParGCUseLocalOverflow || !UseCompressedOops, "Error");
1151 }
1152 } 1147 }
1153 1148
1154 // Adjust some sizes to suit CMS and/or ParNew needs; these work well on 1149 // Adjust some sizes to suit CMS and/or ParNew needs; these work well on
1155 // sparc/solaris for certain applications, but would gain from 1150 // sparc/solaris for certain applications, but would gain from
1156 // further optimization and tuning efforts, and would almost 1151 // further optimization and tuning efforts, and would almost
1347 // It does not make sense to have big object alignment 1342 // It does not make sense to have big object alignment
1348 // since a space lost due to alignment will be greater 1343 // since a space lost due to alignment will be greater
1349 // then a saved space from compressed oops. 1344 // then a saved space from compressed oops.
1350 if ((int)ObjectAlignmentInBytes > 256) { 1345 if ((int)ObjectAlignmentInBytes > 256) {
1351 jio_fprintf(defaultStream::error_stream(), 1346 jio_fprintf(defaultStream::error_stream(),
1352 "error: ObjectAlignmentInBytes=%d must not be greater then 256\n", 1347 "error: ObjectAlignmentInBytes=%d must not be greater than 256\n",
1353 (int)ObjectAlignmentInBytes); 1348 (int)ObjectAlignmentInBytes);
1354 return false; 1349 return false;
1355 } 1350 }
1356 // In case page size is very small. 1351 // In case page size is very small.
1357 if ((int)ObjectAlignmentInBytes >= os::vm_page_size()) { 1352 if ((int)ObjectAlignmentInBytes >= os::vm_page_size()) {
1358 jio_fprintf(defaultStream::error_stream(), 1353 jio_fprintf(defaultStream::error_stream(),
1359 "error: ObjectAlignmentInBytes=%d must be less then page size %d\n", 1354 "error: ObjectAlignmentInBytes=%d must be less than page size %d\n",
1360 (int)ObjectAlignmentInBytes, os::vm_page_size()); 1355 (int)ObjectAlignmentInBytes, os::vm_page_size());
1361 return false; 1356 return false;
1362 } 1357 }
1363 return true; 1358 return true;
1364 } 1359 }
1475 } 1470 }
1476 FLAG_SET_DEFAULT(UseParallelGC, true); 1471 FLAG_SET_DEFAULT(UseParallelGC, true);
1477 1472
1478 // If no heap maximum was requested explicitly, use some reasonable fraction 1473 // If no heap maximum was requested explicitly, use some reasonable fraction
1479 // of the physical memory, up to a maximum of 1GB. 1474 // of the physical memory, up to a maximum of 1GB.
1480 if (UseParallelGC) { 1475 FLAG_SET_DEFAULT(ParallelGCThreads,
1481 FLAG_SET_DEFAULT(ParallelGCThreads, 1476 Abstract_VM_Version::parallel_worker_threads());
1482 Abstract_VM_Version::parallel_worker_threads()); 1477 if (ParallelGCThreads == 0) {
1483 1478 jio_fprintf(defaultStream::error_stream(),
1484 // If InitialSurvivorRatio or MinSurvivorRatio were not specified, but the 1479 "The Parallel GC can not be combined with -XX:ParallelGCThreads=0\n");
1485 // SurvivorRatio has been set, reset their default values to SurvivorRatio + 1480 vm_exit(1);
1486 // 2. By doing this we make SurvivorRatio also work for Parallel Scavenger. 1481 }
1487 // See CR 6362902 for details. 1482
1488 if (!FLAG_IS_DEFAULT(SurvivorRatio)) { 1483
1489 if (FLAG_IS_DEFAULT(InitialSurvivorRatio)) { 1484 // If InitialSurvivorRatio or MinSurvivorRatio were not specified, but the
1490 FLAG_SET_DEFAULT(InitialSurvivorRatio, SurvivorRatio + 2); 1485 // SurvivorRatio has been set, reset their default values to SurvivorRatio +
1491 } 1486 // 2. By doing this we make SurvivorRatio also work for Parallel Scavenger.
1492 if (FLAG_IS_DEFAULT(MinSurvivorRatio)) { 1487 // See CR 6362902 for details.
1493 FLAG_SET_DEFAULT(MinSurvivorRatio, SurvivorRatio + 2); 1488 if (!FLAG_IS_DEFAULT(SurvivorRatio)) {
1494 } 1489 if (FLAG_IS_DEFAULT(InitialSurvivorRatio)) {
1495 } 1490 FLAG_SET_DEFAULT(InitialSurvivorRatio, SurvivorRatio + 2);
1496 1491 }
1497 if (UseParallelOldGC) { 1492 if (FLAG_IS_DEFAULT(MinSurvivorRatio)) {
1498 // Par compact uses lower default values since they are treated as 1493 FLAG_SET_DEFAULT(MinSurvivorRatio, SurvivorRatio + 2);
1499 // minimums. These are different defaults because of the different 1494 }
1500 // interpretation and are not ergonomically set. 1495 }
1501 if (FLAG_IS_DEFAULT(MarkSweepDeadRatio)) { 1496
1502 FLAG_SET_DEFAULT(MarkSweepDeadRatio, 1); 1497 if (UseParallelOldGC) {
1503 } 1498 // Par compact uses lower default values since they are treated as
1499 // minimums. These are different defaults because of the different
1500 // interpretation and are not ergonomically set.
1501 if (FLAG_IS_DEFAULT(MarkSweepDeadRatio)) {
1502 FLAG_SET_DEFAULT(MarkSweepDeadRatio, 1);
1504 } 1503 }
1505 } 1504 }
1506 } 1505 }
1507 1506
1508 void Arguments::set_g1_gc_flags() { 1507 void Arguments::set_g1_gc_flags() {
1515 if (ParallelGCThreads == 0) { 1514 if (ParallelGCThreads == 0) {
1516 FLAG_SET_DEFAULT(ParallelGCThreads, 1515 FLAG_SET_DEFAULT(ParallelGCThreads,
1517 Abstract_VM_Version::parallel_worker_threads()); 1516 Abstract_VM_Version::parallel_worker_threads());
1518 } 1517 }
1519 1518
1520 if (FLAG_IS_DEFAULT(MarkStackSize)) { 1519 // MarkStackSize will be set (if it hasn't been set by the user)
1521 FLAG_SET_DEFAULT(MarkStackSize, 128 * TASKQUEUE_SIZE); 1520 // when concurrent marking is initialized.
1522 } 1521 // Its value will be based upon the number of parallel marking threads.
1523 if (PrintGCDetails && Verbose) { 1522 // But we do set the maximum mark stack size here.
1524 tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk", 1523 if (FLAG_IS_DEFAULT(MarkStackSizeMax)) {
1525 MarkStackSize / K, MarkStackSizeMax / K); 1524 FLAG_SET_DEFAULT(MarkStackSizeMax, 128 * TASKQUEUE_SIZE);
1526 tty->print_cr("ConcGCThreads: %u", ConcGCThreads);
1527 } 1525 }
1528 1526
1529 if (FLAG_IS_DEFAULT(GCTimeRatio) || GCTimeRatio == 0) { 1527 if (FLAG_IS_DEFAULT(GCTimeRatio) || GCTimeRatio == 0) {
1530 // In G1, we want the default GC overhead goal to be higher than 1528 // In G1, we want the default GC overhead goal to be higher than
1531 // say in PS. So we set it here to 10%. Otherwise the heap might 1529 // say in PS. So we set it here to 10%. Otherwise the heap might
1532 // be expanded more aggressively than we would like it to. In 1530 // be expanded more aggressively than we would like it to. In
1533 // fact, even 10% seems to not be high enough in some cases 1531 // fact, even 10% seems to not be high enough in some cases
1534 // (especially small GC stress tests that the main thing they do 1532 // (especially small GC stress tests that the main thing they do
1535 // is allocation). We might consider increase it further. 1533 // is allocation). We might consider increase it further.
1536 FLAG_SET_DEFAULT(GCTimeRatio, 9); 1534 FLAG_SET_DEFAULT(GCTimeRatio, 9);
1535 }
1536
1537 if (PrintGCDetails && Verbose) {
1538 tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk",
1539 MarkStackSize / K, MarkStackSizeMax / K);
1540 tty->print_cr("ConcGCThreads: %u", ConcGCThreads);
1537 } 1541 }
1538 } 1542 }
1539 1543
1540 void Arguments::set_heap_size() { 1544 void Arguments::set_heap_size() {
1541 if (!FLAG_IS_DEFAULT(DefaultMaxRAMFraction)) { 1545 if (!FLAG_IS_DEFAULT(DefaultMaxRAMFraction)) {
1794 } 1798 }
1795 1799
1796 return status; 1800 return status;
1797 } 1801 }
1798 1802
1803 void Arguments::check_deprecated_gcs() {
1804 if (UseConcMarkSweepGC && !UseParNewGC) {
1805 warning("Using the DefNew young collector with the CMS collector is deprecated "
1806 "and will likely be removed in a future release");
1807 }
1808
1809 if (UseParNewGC && !UseConcMarkSweepGC) {
1810 // !UseConcMarkSweepGC means that we are using serial old gc. Unfortunately we don't
1811 // set up UseSerialGC properly, so that can't be used in the check here.
1812 warning("Using the ParNew young collector with the Serial old collector is deprecated "
1813 "and will likely be removed in a future release");
1814 }
1815
1816 if (CMSIncrementalMode) {
1817 warning("Using incremental CMS is deprecated and will likely be removed in a future release");
1818 }
1819 }
1820
1799 // Check stack pages settings 1821 // Check stack pages settings
1800 bool Arguments::check_stack_pages() 1822 bool Arguments::check_stack_pages()
1801 { 1823 {
1802 bool status = true; 1824 bool status = true;
1803 status = status && verify_min_value(StackYellowPages, 1, "StackYellowPages"); 1825 status = status && verify_min_value(StackYellowPages, 1, "StackYellowPages");
1995 2017
1996 status = status && verify_object_alignment(); 2018 status = status && verify_object_alignment();
1997 2019
1998 status = status && verify_min_value(ClassMetaspaceSize, 1*M, 2020 status = status && verify_min_value(ClassMetaspaceSize, 1*M,
1999 "ClassMetaspaceSize"); 2021 "ClassMetaspaceSize");
2022
2023 status = status && verify_interval(MarkStackSizeMax,
2024 1, (max_jint - 1), "MarkStackSizeMax");
2000 2025
2001 #ifdef SPARC 2026 #ifdef SPARC
2002 if (UseConcMarkSweepGC || UseG1GC) { 2027 if (UseConcMarkSweepGC || UseG1GC) {
2003 // Issue a stern warning if the user has explicitly set 2028 // Issue a stern warning if the user has explicitly set
2004 // UseMemSetInBOT (it is known to cause issues), but allow 2029 // UseMemSetInBOT (it is known to cause issues), but allow
3167 // Disable large pages to allow shared spaces. This is sub-optimal, since 3192 // Disable large pages to allow shared spaces. This is sub-optimal, since
3168 // there may not even be a shared archive to use. 3193 // there may not even be a shared archive to use.
3169 FLAG_SET_DEFAULT(UseLargePages, false); 3194 FLAG_SET_DEFAULT(UseLargePages, false);
3170 } 3195 }
3171 3196
3172 // Add 2M to any size for SharedReadOnlySize to get around the JPRT setting
3173 if (DumpSharedSpaces && !FLAG_IS_DEFAULT(SharedReadOnlySize)) {
3174 SharedReadOnlySize = 14*M;
3175 }
3176
3177 if (DumpSharedSpaces) { 3197 if (DumpSharedSpaces) {
3178 if (RequireSharedSpaces) { 3198 if (RequireSharedSpaces) {
3179 warning("cannot dump shared archive while using shared archive"); 3199 warning("cannot dump shared archive while using shared archive");
3180 } 3200 }
3181 UseSharedSpaces = false; 3201 UseSharedSpaces = false;
3208 strlen(os::file_separator()) + 20, mtInternal); 3228 strlen(os::file_separator()) + 20, mtInternal);
3209 if (shared_archive_path == NULL) return JNI_ENOMEM; 3229 if (shared_archive_path == NULL) return JNI_ENOMEM;
3210 strcpy(shared_archive_path, jvm_path); 3230 strcpy(shared_archive_path, jvm_path);
3211 strcat(shared_archive_path, os::file_separator()); 3231 strcat(shared_archive_path, os::file_separator());
3212 strcat(shared_archive_path, "classes"); 3232 strcat(shared_archive_path, "classes");
3213 DEBUG_ONLY(strcat(shared_archive_path, "_g");)
3214 strcat(shared_archive_path, ".jsa"); 3233 strcat(shared_archive_path, ".jsa");
3215 SharedArchivePath = shared_archive_path; 3234 SharedArchivePath = shared_archive_path;
3216 3235
3217 // Remaining part of option string 3236 // Remaining part of option string
3218 const char* tail; 3237 const char* tail;
3417 } else if (UseParNewGC) { // skipped if CMS is set above 3436 } else if (UseParNewGC) { // skipped if CMS is set above
3418 set_parnew_gc_flags(); 3437 set_parnew_gc_flags();
3419 } else if (UseG1GC) { 3438 } else if (UseG1GC) {
3420 set_g1_gc_flags(); 3439 set_g1_gc_flags();
3421 } 3440 }
3441 check_deprecated_gcs();
3422 #endif // INCLUDE_ALTERNATE_GCS 3442 #endif // INCLUDE_ALTERNATE_GCS
3423 3443
3424 #ifdef SERIALGC 3444 #ifdef SERIALGC
3425 assert(verify_serial_gc_flags(), "SerialGC unset"); 3445 assert(verify_serial_gc_flags(), "SerialGC unset");
3426 #endif // SERIALGC 3446 #endif // SERIALGC
3464 UseOptoBiasInlining = false; 3484 UseOptoBiasInlining = false;
3465 } 3485 }
3466 if (!EliminateLocks) { 3486 if (!EliminateLocks) {
3467 EliminateNestedLocks = false; 3487 EliminateNestedLocks = false;
3468 } 3488 }
3489 if (!Inline) {
3490 IncrementalInline = false;
3491 }
3492 #ifndef PRODUCT
3493 if (!IncrementalInline) {
3494 AlwaysIncrementalInline = false;
3495 }
3496 #endif
3497 if (IncrementalInline && FLAG_IS_DEFAULT(MaxNodeLimit)) {
3498 // incremental inlining: bump MaxNodeLimit
3499 FLAG_SET_DEFAULT(MaxNodeLimit, (intx)75000);
3500 }
3469 #endif 3501 #endif
3470 3502
3471 if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) { 3503 if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) {
3472 warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output"); 3504 warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output");
3473 DebugNonSafepoints = true; 3505 DebugNonSafepoints = true;