src/share/vm/runtime/arguments.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/runtime

src/share/vm/runtime/arguments.cpp

Print this page




1391     return false;
1392   }
1393   // In case page size is very small.
1394   if ((int)ObjectAlignmentInBytes >= os::vm_page_size()) {
1395     jio_fprintf(defaultStream::error_stream(),
1396                 "error: ObjectAlignmentInBytes=%d must be less than page size %d\n",
1397                 (int)ObjectAlignmentInBytes, os::vm_page_size());
1398     return false;
1399   }
1400   return true;
1401 }
1402 
1403 uintx Arguments::max_heap_for_compressed_oops() {
1404   // Avoid sign flip.
1405   assert(OopEncodingHeapMax > (uint64_t)os::vm_page_size(), "Unusual page size");
1406   // We need to fit both the NULL page and the heap into the memory budget, while
1407   // keeping alignment constraints of the heap. To guarantee the latter, as the
1408   // NULL page is located before the heap, we pad the NULL page to the conservative
1409   // maximum alignment that the GC may ever impose upon the heap.
1410   size_t displacement_due_to_null_page = align_size_up_(os::vm_page_size(),
1411     Arguments::conservative_max_heap_alignment());
1412 
1413   LP64_ONLY(return OopEncodingHeapMax - displacement_due_to_null_page);
1414   NOT_LP64(ShouldNotReachHere(); return 0);
1415 }
1416 
1417 bool Arguments::should_auto_select_low_pause_collector() {
1418   if (UseAutoGCSelectPolicy &&
1419       !FLAG_IS_DEFAULT(MaxGCPauseMillis) &&
1420       (MaxGCPauseMillis <= AutoGCSelectPauseMillis)) {
1421     if (PrintGCDetails) {
1422       // Cannot use gclog_or_tty yet.
1423       tty->print_cr("Automatic selection of the low pause collector"
1424        " based on pause goal of %d (ms)", MaxGCPauseMillis);
1425     }
1426     return true;
1427   }
1428   return false;
1429 }
1430 
1431 void Arguments::set_use_compressed_oops() {


2661       ArgsRange errcode = parse_memory_size(tail, &long_initial_young_size, 1);
2662       if (errcode != arg_in_range) {
2663         jio_fprintf(defaultStream::error_stream(),
2664                     "Invalid initial young generation size: %s\n", option->optionString);
2665         describe_range_error(errcode);
2666         return JNI_EINVAL;
2667       }
2668       FLAG_SET_CMDLINE(uintx, MaxNewSize, (uintx)long_initial_young_size);
2669       FLAG_SET_CMDLINE(uintx, NewSize, (uintx)long_initial_young_size);
2670     // -Xms
2671     } else if (match_option(option, "-Xms", &tail)) {
2672       julong long_initial_heap_size = 0;
2673       // an initial heap size of 0 means automatically determine
2674       ArgsRange errcode = parse_memory_size(tail, &long_initial_heap_size, 0);
2675       if (errcode != arg_in_range) {
2676         jio_fprintf(defaultStream::error_stream(),
2677                     "Invalid initial heap size: %s\n", option->optionString);
2678         describe_range_error(errcode);
2679         return JNI_EINVAL;
2680       }
2681       FLAG_SET_CMDLINE(uintx, InitialHeapSize, (uintx)long_initial_heap_size);
2682       // Currently the minimum size and the initial heap sizes are the same.
2683       set_min_heap_size(InitialHeapSize);

2684     // -Xmx
2685     } else if (match_option(option, "-Xmx", &tail) || match_option(option, "-XX:MaxHeapSize=", &tail)) {
2686       julong long_max_heap_size = 0;
2687       ArgsRange errcode = parse_memory_size(tail, &long_max_heap_size, 1);
2688       if (errcode != arg_in_range) {
2689         jio_fprintf(defaultStream::error_stream(),
2690                     "Invalid maximum heap size: %s\n", option->optionString);
2691         describe_range_error(errcode);
2692         return JNI_EINVAL;
2693       }
2694       FLAG_SET_CMDLINE(uintx, MaxHeapSize, (uintx)long_max_heap_size);
2695     // Xmaxf
2696     } else if (match_option(option, "-Xmaxf", &tail)) {
2697       char* err;
2698       int maxf = (int)(strtod(tail, &err) * 100);
2699       if (*err != '\0' || maxf < 0 || maxf > 100) {
2700         jio_fprintf(defaultStream::error_stream(),
2701                     "Bad max heap free percentage size: %s\n",
2702                     option->optionString);
2703         return JNI_EINVAL;




1391     return false;
1392   }
1393   // In case page size is very small.
1394   if ((int)ObjectAlignmentInBytes >= os::vm_page_size()) {
1395     jio_fprintf(defaultStream::error_stream(),
1396                 "error: ObjectAlignmentInBytes=%d must be less than page size %d\n",
1397                 (int)ObjectAlignmentInBytes, os::vm_page_size());
1398     return false;
1399   }
1400   return true;
1401 }
1402 
1403 uintx Arguments::max_heap_for_compressed_oops() {
1404   // Avoid sign flip.
1405   assert(OopEncodingHeapMax > (uint64_t)os::vm_page_size(), "Unusual page size");
1406   // We need to fit both the NULL page and the heap into the memory budget, while
1407   // keeping alignment constraints of the heap. To guarantee the latter, as the
1408   // NULL page is located before the heap, we pad the NULL page to the conservative
1409   // maximum alignment that the GC may ever impose upon the heap.
1410   size_t displacement_due_to_null_page = align_size_up_(os::vm_page_size(),
1411                                                         _conservative_max_heap_alignment);
1412 
1413   LP64_ONLY(return OopEncodingHeapMax - displacement_due_to_null_page);
1414   NOT_LP64(ShouldNotReachHere(); return 0);
1415 }
1416 
1417 bool Arguments::should_auto_select_low_pause_collector() {
1418   if (UseAutoGCSelectPolicy &&
1419       !FLAG_IS_DEFAULT(MaxGCPauseMillis) &&
1420       (MaxGCPauseMillis <= AutoGCSelectPauseMillis)) {
1421     if (PrintGCDetails) {
1422       // Cannot use gclog_or_tty yet.
1423       tty->print_cr("Automatic selection of the low pause collector"
1424        " based on pause goal of %d (ms)", MaxGCPauseMillis);
1425     }
1426     return true;
1427   }
1428   return false;
1429 }
1430 
1431 void Arguments::set_use_compressed_oops() {


2661       ArgsRange errcode = parse_memory_size(tail, &long_initial_young_size, 1);
2662       if (errcode != arg_in_range) {
2663         jio_fprintf(defaultStream::error_stream(),
2664                     "Invalid initial young generation size: %s\n", option->optionString);
2665         describe_range_error(errcode);
2666         return JNI_EINVAL;
2667       }
2668       FLAG_SET_CMDLINE(uintx, MaxNewSize, (uintx)long_initial_young_size);
2669       FLAG_SET_CMDLINE(uintx, NewSize, (uintx)long_initial_young_size);
2670     // -Xms
2671     } else if (match_option(option, "-Xms", &tail)) {
2672       julong long_initial_heap_size = 0;
2673       // an initial heap size of 0 means automatically determine
2674       ArgsRange errcode = parse_memory_size(tail, &long_initial_heap_size, 0);
2675       if (errcode != arg_in_range) {
2676         jio_fprintf(defaultStream::error_stream(),
2677                     "Invalid initial heap size: %s\n", option->optionString);
2678         describe_range_error(errcode);
2679         return JNI_EINVAL;
2680       }
2681       set_min_heap_size((uintx)long_initial_heap_size);
2682       // Currently the minimum size and the initial heap sizes are the same.
2683       // Can be overridden with -XX:InitialHeapSize.
2684       FLAG_SET_CMDLINE(uintx, InitialHeapSize, (uintx)long_initial_heap_size);
2685     // -Xmx
2686     } else if (match_option(option, "-Xmx", &tail) || match_option(option, "-XX:MaxHeapSize=", &tail)) {
2687       julong long_max_heap_size = 0;
2688       ArgsRange errcode = parse_memory_size(tail, &long_max_heap_size, 1);
2689       if (errcode != arg_in_range) {
2690         jio_fprintf(defaultStream::error_stream(),
2691                     "Invalid maximum heap size: %s\n", option->optionString);
2692         describe_range_error(errcode);
2693         return JNI_EINVAL;
2694       }
2695       FLAG_SET_CMDLINE(uintx, MaxHeapSize, (uintx)long_max_heap_size);
2696     // Xmaxf
2697     } else if (match_option(option, "-Xmaxf", &tail)) {
2698       char* err;
2699       int maxf = (int)(strtod(tail, &err) * 100);
2700       if (*err != '\0' || maxf < 0 || maxf > 100) {
2701         jio_fprintf(defaultStream::error_stream(),
2702                     "Bad max heap free percentage size: %s\n",
2703                     option->optionString);
2704         return JNI_EINVAL;


src/share/vm/runtime/arguments.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File