1386 return false;
1387 }
1388 // In case page size is very small.
1389 if ((int)ObjectAlignmentInBytes >= os::vm_page_size()) {
1390 jio_fprintf(defaultStream::error_stream(),
1391 "error: ObjectAlignmentInBytes=%d must be less than page size %d\n",
1392 (int)ObjectAlignmentInBytes, os::vm_page_size());
1393 return false;
1394 }
1395 return true;
1396 }
1397
1398 uintx Arguments::max_heap_for_compressed_oops() {
1399 // Avoid sign flip.
1400 assert(OopEncodingHeapMax > (uint64_t)os::vm_page_size(), "Unusual page size");
1401 // We need to fit both the NULL page and the heap into the memory budget, while
1402 // keeping alignment constraints of the heap. To guarantee the latter, as the
1403 // NULL page is located before the heap, we pad the NULL page to the conservative
1404 // maximum alignment that the GC may ever impose upon the heap.
1405 size_t displacement_due_to_null_page = align_size_up_(os::vm_page_size(),
1406 Arguments::conservative_max_heap_alignment());
1407
1408 LP64_ONLY(return OopEncodingHeapMax - displacement_due_to_null_page);
1409 NOT_LP64(ShouldNotReachHere(); return 0);
1410 }
1411
1412 bool Arguments::should_auto_select_low_pause_collector() {
1413 if (UseAutoGCSelectPolicy &&
1414 !FLAG_IS_DEFAULT(MaxGCPauseMillis) &&
1415 (MaxGCPauseMillis <= AutoGCSelectPauseMillis)) {
1416 if (PrintGCDetails) {
1417 // Cannot use gclog_or_tty yet.
1418 tty->print_cr("Automatic selection of the low pause collector"
1419 " based on pause goal of %d (ms)", MaxGCPauseMillis);
1420 }
1421 return true;
1422 }
1423 return false;
1424 }
1425
1426 void Arguments::set_use_compressed_oops() {
2090 warning("Heap verification at shutdown disabled "
2091 "(due to current incompatibility with FLSVerifyAllHeapReferences)");
2092 VerifyBeforeExit = false; // Disable verification at shutdown
2093 }
2094 }
2095
2096 // Note: only executed in non-PRODUCT mode
2097 if (!UseAsyncConcMarkSweepGC &&
2098 (ExplicitGCInvokesConcurrent ||
2099 ExplicitGCInvokesConcurrentAndUnloadsClasses)) {
2100 jio_fprintf(defaultStream::error_stream(),
2101 "error: +ExplicitGCInvokesConcurrent[AndUnloadsClasses] conflicts"
2102 " with -UseAsyncConcMarkSweepGC");
2103 status = false;
2104 }
2105
2106 status = status && verify_min_value(ParGCArrayScanChunk, 1, "ParGCArrayScanChunk");
2107
2108 #if INCLUDE_ALL_GCS
2109 if (UseG1GC) {
2110 status = status && verify_percentage(InitiatingHeapOccupancyPercent,
2111 "InitiatingHeapOccupancyPercent");
2112 status = status && verify_min_value(G1RefProcDrainInterval, 1,
2113 "G1RefProcDrainInterval");
2114 status = status && verify_min_value((intx)G1ConcMarkStepDurationMillis, 1,
2115 "G1ConcMarkStepDurationMillis");
2116 status = status && verify_interval(G1ConcRSHotCardLimit, 0, max_jubyte,
2117 "G1ConcRSHotCardLimit");
2118 status = status && verify_interval(G1ConcRSLogCacheSize, 0, 31,
2119 "G1ConcRSLogCacheSize");
2120 }
2121 if (UseConcMarkSweepGC) {
2122 status = status && verify_min_value(CMSOldPLABNumRefills, 1, "CMSOldPLABNumRefills");
2123 status = status && verify_min_value(CMSOldPLABToleranceFactor, 1, "CMSOldPLABToleranceFactor");
2124 status = status && verify_min_value(CMSOldPLABMax, 1, "CMSOldPLABMax");
2125 status = status && verify_interval(CMSOldPLABMin, 1, CMSOldPLABMax, "CMSOldPLABMin");
2126
2127 status = status && verify_min_value(CMSYoungGenPerWorker, 1, "CMSYoungGenPerWorker");
2128
2129 status = status && verify_min_value(CMSSamplingGrain, 1, "CMSSamplingGrain");
2617 ArgsRange errcode = parse_memory_size(tail, &long_initial_young_size, 1);
2618 if (errcode != arg_in_range) {
2619 jio_fprintf(defaultStream::error_stream(),
2620 "Invalid initial young generation size: %s\n", option->optionString);
2621 describe_range_error(errcode);
2622 return JNI_EINVAL;
2623 }
2624 FLAG_SET_CMDLINE(uintx, MaxNewSize, (uintx)long_initial_young_size);
2625 FLAG_SET_CMDLINE(uintx, NewSize, (uintx)long_initial_young_size);
2626 // -Xms
2627 } else if (match_option(option, "-Xms", &tail)) {
2628 julong long_initial_heap_size = 0;
2629 // an initial heap size of 0 means automatically determine
2630 ArgsRange errcode = parse_memory_size(tail, &long_initial_heap_size, 0);
2631 if (errcode != arg_in_range) {
2632 jio_fprintf(defaultStream::error_stream(),
2633 "Invalid initial heap size: %s\n", option->optionString);
2634 describe_range_error(errcode);
2635 return JNI_EINVAL;
2636 }
2637 FLAG_SET_CMDLINE(uintx, InitialHeapSize, (uintx)long_initial_heap_size);
2638 // Currently the minimum size and the initial heap sizes are the same.
2639 set_min_heap_size(InitialHeapSize);
2640 // -Xmx
2641 } else if (match_option(option, "-Xmx", &tail) || match_option(option, "-XX:MaxHeapSize=", &tail)) {
2642 julong long_max_heap_size = 0;
2643 ArgsRange errcode = parse_memory_size(tail, &long_max_heap_size, 1);
2644 if (errcode != arg_in_range) {
2645 jio_fprintf(defaultStream::error_stream(),
2646 "Invalid maximum heap size: %s\n", option->optionString);
2647 describe_range_error(errcode);
2648 return JNI_EINVAL;
2649 }
2650 FLAG_SET_CMDLINE(uintx, MaxHeapSize, (uintx)long_max_heap_size);
2651 // Xmaxf
2652 } else if (match_option(option, "-Xmaxf", &tail)) {
2653 int maxf = (int)(atof(tail) * 100);
2654 if (maxf < 0 || maxf > 100) {
2655 jio_fprintf(defaultStream::error_stream(),
2656 "Bad max heap free percentage size: %s\n",
2657 option->optionString);
2658 return JNI_EINVAL;
2659 } else {
|
1386 return false;
1387 }
1388 // In case page size is very small.
1389 if ((int)ObjectAlignmentInBytes >= os::vm_page_size()) {
1390 jio_fprintf(defaultStream::error_stream(),
1391 "error: ObjectAlignmentInBytes=%d must be less than page size %d\n",
1392 (int)ObjectAlignmentInBytes, os::vm_page_size());
1393 return false;
1394 }
1395 return true;
1396 }
1397
1398 uintx Arguments::max_heap_for_compressed_oops() {
1399 // Avoid sign flip.
1400 assert(OopEncodingHeapMax > (uint64_t)os::vm_page_size(), "Unusual page size");
1401 // We need to fit both the NULL page and the heap into the memory budget, while
1402 // keeping alignment constraints of the heap. To guarantee the latter, as the
1403 // NULL page is located before the heap, we pad the NULL page to the conservative
1404 // maximum alignment that the GC may ever impose upon the heap.
1405 size_t displacement_due_to_null_page = align_size_up_(os::vm_page_size(),
1406 _conservative_max_heap_alignment);
1407
1408 LP64_ONLY(return OopEncodingHeapMax - displacement_due_to_null_page);
1409 NOT_LP64(ShouldNotReachHere(); return 0);
1410 }
1411
1412 bool Arguments::should_auto_select_low_pause_collector() {
1413 if (UseAutoGCSelectPolicy &&
1414 !FLAG_IS_DEFAULT(MaxGCPauseMillis) &&
1415 (MaxGCPauseMillis <= AutoGCSelectPauseMillis)) {
1416 if (PrintGCDetails) {
1417 // Cannot use gclog_or_tty yet.
1418 tty->print_cr("Automatic selection of the low pause collector"
1419 " based on pause goal of %d (ms)", MaxGCPauseMillis);
1420 }
1421 return true;
1422 }
1423 return false;
1424 }
1425
1426 void Arguments::set_use_compressed_oops() {
2090 warning("Heap verification at shutdown disabled "
2091 "(due to current incompatibility with FLSVerifyAllHeapReferences)");
2092 VerifyBeforeExit = false; // Disable verification at shutdown
2093 }
2094 }
2095
2096 // Note: only executed in non-PRODUCT mode
2097 if (!UseAsyncConcMarkSweepGC &&
2098 (ExplicitGCInvokesConcurrent ||
2099 ExplicitGCInvokesConcurrentAndUnloadsClasses)) {
2100 jio_fprintf(defaultStream::error_stream(),
2101 "error: +ExplicitGCInvokesConcurrent[AndUnloadsClasses] conflicts"
2102 " with -UseAsyncConcMarkSweepGC");
2103 status = false;
2104 }
2105
2106 status = status && verify_min_value(ParGCArrayScanChunk, 1, "ParGCArrayScanChunk");
2107
2108 #if INCLUDE_ALL_GCS
2109 if (UseG1GC) {
2110 status = status && verify_percentage(G1NewSizePercent, "G1NewSizePercent");
2111 status = status && verify_percentage(G1MaxNewSizePercent, "G1MaxNewSizePercent");
2112 status = status && verify_interval(G1NewSizePercent, 0, G1MaxNewSizePercent, "G1NewSizePercent");
2113
2114 status = status && verify_percentage(InitiatingHeapOccupancyPercent,
2115 "InitiatingHeapOccupancyPercent");
2116 status = status && verify_min_value(G1RefProcDrainInterval, 1,
2117 "G1RefProcDrainInterval");
2118 status = status && verify_min_value((intx)G1ConcMarkStepDurationMillis, 1,
2119 "G1ConcMarkStepDurationMillis");
2120 status = status && verify_interval(G1ConcRSHotCardLimit, 0, max_jubyte,
2121 "G1ConcRSHotCardLimit");
2122 status = status && verify_interval(G1ConcRSLogCacheSize, 0, 31,
2123 "G1ConcRSLogCacheSize");
2124 }
2125 if (UseConcMarkSweepGC) {
2126 status = status && verify_min_value(CMSOldPLABNumRefills, 1, "CMSOldPLABNumRefills");
2127 status = status && verify_min_value(CMSOldPLABToleranceFactor, 1, "CMSOldPLABToleranceFactor");
2128 status = status && verify_min_value(CMSOldPLABMax, 1, "CMSOldPLABMax");
2129 status = status && verify_interval(CMSOldPLABMin, 1, CMSOldPLABMax, "CMSOldPLABMin");
2130
2131 status = status && verify_min_value(CMSYoungGenPerWorker, 1, "CMSYoungGenPerWorker");
2132
2133 status = status && verify_min_value(CMSSamplingGrain, 1, "CMSSamplingGrain");
2621 ArgsRange errcode = parse_memory_size(tail, &long_initial_young_size, 1);
2622 if (errcode != arg_in_range) {
2623 jio_fprintf(defaultStream::error_stream(),
2624 "Invalid initial young generation size: %s\n", option->optionString);
2625 describe_range_error(errcode);
2626 return JNI_EINVAL;
2627 }
2628 FLAG_SET_CMDLINE(uintx, MaxNewSize, (uintx)long_initial_young_size);
2629 FLAG_SET_CMDLINE(uintx, NewSize, (uintx)long_initial_young_size);
2630 // -Xms
2631 } else if (match_option(option, "-Xms", &tail)) {
2632 julong long_initial_heap_size = 0;
2633 // an initial heap size of 0 means automatically determine
2634 ArgsRange errcode = parse_memory_size(tail, &long_initial_heap_size, 0);
2635 if (errcode != arg_in_range) {
2636 jio_fprintf(defaultStream::error_stream(),
2637 "Invalid initial heap size: %s\n", option->optionString);
2638 describe_range_error(errcode);
2639 return JNI_EINVAL;
2640 }
2641 set_min_heap_size((uintx)long_initial_heap_size);
2642 // Currently the minimum size and the initial heap sizes are the same.
2643 // Can be overridden with -XX:InitialHeapSize.
2644 FLAG_SET_CMDLINE(uintx, InitialHeapSize, (uintx)long_initial_heap_size);
2645 // -Xmx
2646 } else if (match_option(option, "-Xmx", &tail) || match_option(option, "-XX:MaxHeapSize=", &tail)) {
2647 julong long_max_heap_size = 0;
2648 ArgsRange errcode = parse_memory_size(tail, &long_max_heap_size, 1);
2649 if (errcode != arg_in_range) {
2650 jio_fprintf(defaultStream::error_stream(),
2651 "Invalid maximum heap size: %s\n", option->optionString);
2652 describe_range_error(errcode);
2653 return JNI_EINVAL;
2654 }
2655 FLAG_SET_CMDLINE(uintx, MaxHeapSize, (uintx)long_max_heap_size);
2656 // Xmaxf
2657 } else if (match_option(option, "-Xmaxf", &tail)) {
2658 int maxf = (int)(atof(tail) * 100);
2659 if (maxf < 0 || maxf > 100) {
2660 jio_fprintf(defaultStream::error_stream(),
2661 "Bad max heap free percentage size: %s\n",
2662 option->optionString);
2663 return JNI_EINVAL;
2664 } else {
|