< prev index next >

src/share/vm/runtime/arguments.cpp

Print this page




1743   // The conservative maximum required alignment for the heap is the maximum of
1744   // the alignments imposed by several sources: any requirements from the heap
1745   // itself, the collector policy and the maximum page size we may run the VM
1746   // with.
1747   size_t heap_alignment = GenCollectedHeap::conservative_max_heap_alignment();
1748 #if INCLUDE_ALL_GCS
1749   if (UseParallelGC) {
1750     heap_alignment = ParallelScavengeHeap::conservative_max_heap_alignment();
1751   } else if (UseG1GC) {
1752     heap_alignment = G1CollectedHeap::conservative_max_heap_alignment();
1753   }
1754 #endif // INCLUDE_ALL_GCS
1755   _conservative_max_heap_alignment = MAX4(heap_alignment,
1756                                           (size_t)os::vm_allocation_granularity(),
1757                                           os::max_page_size(),
1758                                           CollectorPolicy::compute_heap_alignment());
1759 }
1760 
1761 bool Arguments::gc_selected() {
1762 #if INCLUDE_ALL_GCS
1763   return UseSerialGC || UseParallelGC || UseParallelOldGC || UseConcMarkSweepGC || UseG1GC;
1764 #else
1765   return UseSerialGC;
1766 #endif // INCLUDE_ALL_GCS
1767 }
1768 
1769 void Arguments::select_gc_ergonomically() {
1770 #if INCLUDE_ALL_GCS
1771   if (os::is_server_class_machine()) {
1772     FLAG_SET_ERGO_IF_DEFAULT(bool, UseG1GC, true);
1773   } else {
1774     FLAG_SET_ERGO_IF_DEFAULT(bool, UseSerialGC, true);
1775   }
1776 #else
1777   UNSUPPORTED_OPTION(UseG1GC);
1778   UNSUPPORTED_OPTION(UseParallelGC);
1779   UNSUPPORTED_OPTION(UseParallelOldGC);
1780   UNSUPPORTED_OPTION(UseConcMarkSweepGC);
1781   FLAG_SET_ERGO_IF_DEFAULT(bool, UseSerialGC, true);
1782 #endif // INCLUDE_ALL_GCS
1783 }


1915   // the pause interval and b) we maintain the invariant that pause
1916   // time target < pause interval. If the user does not want this
1917   // maximum flexibility, they will have to set the pause interval
1918   // explicitly.
1919 
1920   if (FLAG_IS_DEFAULT(MaxGCPauseMillis)) {
1921     // The default pause time target in G1 is 200ms
1922     FLAG_SET_DEFAULT(MaxGCPauseMillis, 200);
1923   }
1924 
1925   // Then, if the interval parameter was not set, set it according to
1926   // the pause time target (this will also deal with the case when the
1927   // pause time target is the default value).
1928   if (FLAG_IS_DEFAULT(GCPauseIntervalMillis)) {
1929     FLAG_SET_DEFAULT(GCPauseIntervalMillis, MaxGCPauseMillis + 1);
1930   }
1931 
1932   log_trace(gc)("MarkStackSize: %uk  MarkStackSizeMax: %uk", (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K));
1933 }
1934 









1935 void Arguments::set_gc_specific_flags() {
1936 #if INCLUDE_ALL_GCS
1937   // Set per-collector flags
1938   if (UseParallelGC || UseParallelOldGC) {
1939     set_parallel_gc_flags();
1940   } else if (UseConcMarkSweepGC) {
1941     set_cms_and_parnew_gc_flags();
1942   } else if (UseG1GC) {
1943     set_g1_gc_flags();


1944   }
1945   if (AssumeMP && !UseSerialGC) {
1946     if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) {
1947       warning("If the number of processors is expected to increase from one, then"
1948               " you should configure the number of parallel GC threads appropriately"
1949               " using -XX:ParallelGCThreads=N");
1950     }
1951   }
1952   if (MinHeapFreeRatio == 100) {
1953     // Keeping the heap 100% free is hard ;-) so limit it to 99%.
1954     FLAG_SET_ERGO(uintx, MinHeapFreeRatio, 99);
1955   }
1956 
1957   // If class unloading is disabled, also disable concurrent class unloading.
1958   if (!ClassUnloading) {
1959     FLAG_SET_CMDLINE(bool, CMSClassUnloadingEnabled, false);
1960     FLAG_SET_CMDLINE(bool, ClassUnloadingWithConcurrentMark, false);
1961   }
1962 #endif // INCLUDE_ALL_GCS
1963 }


2287 
2288 //===========================================================================================================
2289 // Parsing of main arguments
2290 
2291 #if INCLUDE_JVMCI
2292 // Check consistency of jvmci vm argument settings.
2293 bool Arguments::check_jvmci_args_consistency() {
2294    return JVMCIGlobals::check_jvmci_flags_are_consistent();
2295 }
2296 #endif //INCLUDE_JVMCI
2297 
2298 // Check consistency of GC selection
2299 bool Arguments::check_gc_consistency() {
2300   // Ensure that the user has not selected conflicting sets
2301   // of collectors.
2302   uint i = 0;
2303   if (UseSerialGC)                       i++;
2304   if (UseConcMarkSweepGC)                i++;
2305   if (UseParallelGC || UseParallelOldGC) i++;
2306   if (UseG1GC)                           i++;

2307   if (i > 1) {
2308     jio_fprintf(defaultStream::error_stream(),
2309                 "Conflicting collector combinations in option list; "
2310                 "please refer to the release notes for the combinations "
2311                 "allowed\n");
2312     return false;
2313   }
2314 
2315   return true;
2316 }
2317 
2318 // Check the consistency of vm_init_args
2319 bool Arguments::check_vm_args_consistency() {
2320   // Method for adding checks for flag consistency.
2321   // The intent is to warn the user of all possible conflicts,
2322   // before returning an error.
2323   // Note: Needs platform-dependent factoring.
2324   bool status = true;
2325 
2326   if (TLABRefillWasteFraction == 0) {




1743   // The conservative maximum required alignment for the heap is the maximum of
1744   // the alignments imposed by several sources: any requirements from the heap
1745   // itself, the collector policy and the maximum page size we may run the VM
1746   // with.
1747   size_t heap_alignment = GenCollectedHeap::conservative_max_heap_alignment();
1748 #if INCLUDE_ALL_GCS
1749   if (UseParallelGC) {
1750     heap_alignment = ParallelScavengeHeap::conservative_max_heap_alignment();
1751   } else if (UseG1GC) {
1752     heap_alignment = G1CollectedHeap::conservative_max_heap_alignment();
1753   }
1754 #endif // INCLUDE_ALL_GCS
1755   _conservative_max_heap_alignment = MAX4(heap_alignment,
1756                                           (size_t)os::vm_allocation_granularity(),
1757                                           os::max_page_size(),
1758                                           CollectorPolicy::compute_heap_alignment());
1759 }
1760 
1761 bool Arguments::gc_selected() {
1762 #if INCLUDE_ALL_GCS
1763   return UseSerialGC || UseParallelGC || UseParallelOldGC || UseConcMarkSweepGC || UseG1GC || UseEpsilonGC;
1764 #else
1765   return UseSerialGC;
1766 #endif // INCLUDE_ALL_GCS
1767 }
1768 
1769 void Arguments::select_gc_ergonomically() {
1770 #if INCLUDE_ALL_GCS
1771   if (os::is_server_class_machine()) {
1772     FLAG_SET_ERGO_IF_DEFAULT(bool, UseG1GC, true);
1773   } else {
1774     FLAG_SET_ERGO_IF_DEFAULT(bool, UseSerialGC, true);
1775   }
1776 #else
1777   UNSUPPORTED_OPTION(UseG1GC);
1778   UNSUPPORTED_OPTION(UseParallelGC);
1779   UNSUPPORTED_OPTION(UseParallelOldGC);
1780   UNSUPPORTED_OPTION(UseConcMarkSweepGC);
1781   FLAG_SET_ERGO_IF_DEFAULT(bool, UseSerialGC, true);
1782 #endif // INCLUDE_ALL_GCS
1783 }


1915   // the pause interval and b) we maintain the invariant that pause
1916   // time target < pause interval. If the user does not want this
1917   // maximum flexibility, they will have to set the pause interval
1918   // explicitly.
1919 
1920   if (FLAG_IS_DEFAULT(MaxGCPauseMillis)) {
1921     // The default pause time target in G1 is 200ms
1922     FLAG_SET_DEFAULT(MaxGCPauseMillis, 200);
1923   }
1924 
1925   // Then, if the interval parameter was not set, set it according to
1926   // the pause time target (this will also deal with the case when the
1927   // pause time target is the default value).
1928   if (FLAG_IS_DEFAULT(GCPauseIntervalMillis)) {
1929     FLAG_SET_DEFAULT(GCPauseIntervalMillis, MaxGCPauseMillis + 1);
1930   }
1931 
1932   log_trace(gc)("MarkStackSize: %uk  MarkStackSizeMax: %uk", (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K));
1933 }
1934 
1935 void Arguments::set_epsilon_flags() {
1936   assert(UseEpsilonGC, "Error");
1937 
1938   // Forcefully exit when OOME is detected. Nothing we can do at that point.
1939   if (FLAG_IS_DEFAULT(ExitOnOutOfMemoryError)) {
1940     FLAG_SET_DEFAULT(ExitOnOutOfMemoryError, true);
1941   }
1942 }
1943 
1944 void Arguments::set_gc_specific_flags() {
1945 #if INCLUDE_ALL_GCS
1946   // Set per-collector flags
1947   if (UseParallelGC || UseParallelOldGC) {
1948     set_parallel_gc_flags();
1949   } else if (UseConcMarkSweepGC) {
1950     set_cms_and_parnew_gc_flags();
1951   } else if (UseG1GC) {
1952     set_g1_gc_flags();
1953   } else if (UseEpsilonGC) {
1954     set_epsilon_flags();
1955   }
1956   if (AssumeMP && !UseSerialGC) {
1957     if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) {
1958       warning("If the number of processors is expected to increase from one, then"
1959               " you should configure the number of parallel GC threads appropriately"
1960               " using -XX:ParallelGCThreads=N");
1961     }
1962   }
1963   if (MinHeapFreeRatio == 100) {
1964     // Keeping the heap 100% free is hard ;-) so limit it to 99%.
1965     FLAG_SET_ERGO(uintx, MinHeapFreeRatio, 99);
1966   }
1967 
1968   // If class unloading is disabled, also disable concurrent class unloading.
1969   if (!ClassUnloading) {
1970     FLAG_SET_CMDLINE(bool, CMSClassUnloadingEnabled, false);
1971     FLAG_SET_CMDLINE(bool, ClassUnloadingWithConcurrentMark, false);
1972   }
1973 #endif // INCLUDE_ALL_GCS
1974 }


2298 
2299 //===========================================================================================================
2300 // Parsing of main arguments
2301 
2302 #if INCLUDE_JVMCI
2303 // Check consistency of jvmci vm argument settings.
2304 bool Arguments::check_jvmci_args_consistency() {
2305    return JVMCIGlobals::check_jvmci_flags_are_consistent();
2306 }
2307 #endif //INCLUDE_JVMCI
2308 
2309 // Check consistency of GC selection
2310 bool Arguments::check_gc_consistency() {
2311   // Ensure that the user has not selected conflicting sets
2312   // of collectors.
2313   uint i = 0;
2314   if (UseSerialGC)                       i++;
2315   if (UseConcMarkSweepGC)                i++;
2316   if (UseParallelGC || UseParallelOldGC) i++;
2317   if (UseG1GC)                           i++;
2318   if (UseEpsilonGC)                      i++;
2319   if (i > 1) {
2320     jio_fprintf(defaultStream::error_stream(),
2321                 "Conflicting collector combinations in option list; "
2322                 "please refer to the release notes for the combinations "
2323                 "allowed\n");
2324     return false;
2325   }
2326 
2327   return true;
2328 }
2329 
2330 // Check the consistency of vm_init_args
2331 bool Arguments::check_vm_args_consistency() {
2332   // Method for adding checks for flag consistency.
2333   // The intent is to warn the user of all possible conflicts,
2334   // before returning an error.
2335   // Note: Needs platform-dependent factoring.
2336   bool status = true;
2337 
2338   if (TLABRefillWasteFraction == 0) {


< prev index next >