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 #ifdef TIERED
1770 bool Arguments::compilation_mode_selected() {
1771 return !FLAG_IS_DEFAULT(TieredCompilation) || !FLAG_IS_DEFAULT(TieredStopAtLevel) ||
1772 !FLAG_IS_DEFAULT(UseAOT) JVMCI_ONLY(|| !FLAG_IS_DEFAULT(EnableJVMCI) || !FLAG_IS_DEFAULT(UseJVMCICompiler));
1773
1774 }
1775
1776 void Arguments::select_compilation_mode_ergonomically() {
1777 #if defined(_WINDOWS) && !defined(_LP64)
1778 if (FLAG_IS_DEFAULT(NeverActAsServerClassMachine)) {
1779 FLAG_SET_ERGO(bool, NeverActAsServerClassMachine, true);
1780 }
1781 #endif
1782 if (NeverActAsServerClassMachine) {
1783 set_client_compilation_mode();
1967 // the pause interval and b) we maintain the invariant that pause
1968 // time target < pause interval. If the user does not want this
1969 // maximum flexibility, they will have to set the pause interval
1970 // explicitly.
1971
1972 if (FLAG_IS_DEFAULT(MaxGCPauseMillis)) {
1973 // The default pause time target in G1 is 200ms
1974 FLAG_SET_DEFAULT(MaxGCPauseMillis, 200);
1975 }
1976
1977 // Then, if the interval parameter was not set, set it according to
1978 // the pause time target (this will also deal with the case when the
1979 // pause time target is the default value).
1980 if (FLAG_IS_DEFAULT(GCPauseIntervalMillis)) {
1981 FLAG_SET_DEFAULT(GCPauseIntervalMillis, MaxGCPauseMillis + 1);
1982 }
1983
1984 log_trace(gc)("MarkStackSize: %uk MarkStackSizeMax: %uk", (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K));
1985 }
1986
1987 void Arguments::set_gc_specific_flags() {
1988 #if INCLUDE_ALL_GCS
1989 // Set per-collector flags
1990 if (UseParallelGC || UseParallelOldGC) {
1991 set_parallel_gc_flags();
1992 } else if (UseConcMarkSweepGC) {
1993 set_cms_and_parnew_gc_flags();
1994 } else if (UseG1GC) {
1995 set_g1_gc_flags();
1996 }
1997 if (AssumeMP && !UseSerialGC) {
1998 if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) {
1999 warning("If the number of processors is expected to increase from one, then"
2000 " you should configure the number of parallel GC threads appropriately"
2001 " using -XX:ParallelGCThreads=N");
2002 }
2003 }
2004 if (MinHeapFreeRatio == 100) {
2005 // Keeping the heap 100% free is hard ;-) so limit it to 99%.
2006 FLAG_SET_ERGO(uintx, MinHeapFreeRatio, 99);
2007 }
2008
2009 // If class unloading is disabled, also disable concurrent class unloading.
2010 if (!ClassUnloading) {
2011 FLAG_SET_CMDLINE(bool, CMSClassUnloadingEnabled, false);
2012 FLAG_SET_CMDLINE(bool, ClassUnloadingWithConcurrentMark, false);
2013 }
2014 #endif // INCLUDE_ALL_GCS
2015 }
2339
2340 //===========================================================================================================
2341 // Parsing of main arguments
2342
2343 #if INCLUDE_JVMCI
2344 // Check consistency of jvmci vm argument settings.
2345 bool Arguments::check_jvmci_args_consistency() {
2346 return JVMCIGlobals::check_jvmci_flags_are_consistent();
2347 }
2348 #endif //INCLUDE_JVMCI
2349
2350 // Check consistency of GC selection
2351 bool Arguments::check_gc_consistency() {
2352 // Ensure that the user has not selected conflicting sets
2353 // of collectors.
2354 uint i = 0;
2355 if (UseSerialGC) i++;
2356 if (UseConcMarkSweepGC) i++;
2357 if (UseParallelGC || UseParallelOldGC) i++;
2358 if (UseG1GC) i++;
2359 if (i > 1) {
2360 jio_fprintf(defaultStream::error_stream(),
2361 "Conflicting collector combinations in option list; "
2362 "please refer to the release notes for the combinations "
2363 "allowed\n");
2364 return false;
2365 }
2366
2367 return true;
2368 }
2369
2370 // Check the consistency of vm_init_args
2371 bool Arguments::check_vm_args_consistency() {
2372 // Method for adding checks for flag consistency.
2373 // The intent is to warn the user of all possible conflicts,
2374 // before returning an error.
2375 // Note: Needs platform-dependent factoring.
2376 bool status = true;
2377
2378 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 #ifdef TIERED
1770 bool Arguments::compilation_mode_selected() {
1771 return !FLAG_IS_DEFAULT(TieredCompilation) || !FLAG_IS_DEFAULT(TieredStopAtLevel) ||
1772 !FLAG_IS_DEFAULT(UseAOT) JVMCI_ONLY(|| !FLAG_IS_DEFAULT(EnableJVMCI) || !FLAG_IS_DEFAULT(UseJVMCICompiler));
1773
1774 }
1775
1776 void Arguments::select_compilation_mode_ergonomically() {
1777 #if defined(_WINDOWS) && !defined(_LP64)
1778 if (FLAG_IS_DEFAULT(NeverActAsServerClassMachine)) {
1779 FLAG_SET_ERGO(bool, NeverActAsServerClassMachine, true);
1780 }
1781 #endif
1782 if (NeverActAsServerClassMachine) {
1783 set_client_compilation_mode();
1967 // the pause interval and b) we maintain the invariant that pause
1968 // time target < pause interval. If the user does not want this
1969 // maximum flexibility, they will have to set the pause interval
1970 // explicitly.
1971
1972 if (FLAG_IS_DEFAULT(MaxGCPauseMillis)) {
1973 // The default pause time target in G1 is 200ms
1974 FLAG_SET_DEFAULT(MaxGCPauseMillis, 200);
1975 }
1976
1977 // Then, if the interval parameter was not set, set it according to
1978 // the pause time target (this will also deal with the case when the
1979 // pause time target is the default value).
1980 if (FLAG_IS_DEFAULT(GCPauseIntervalMillis)) {
1981 FLAG_SET_DEFAULT(GCPauseIntervalMillis, MaxGCPauseMillis + 1);
1982 }
1983
1984 log_trace(gc)("MarkStackSize: %uk MarkStackSizeMax: %uk", (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K));
1985 }
1986
1987 void Arguments::set_epsilon_flags() {
1988 assert(UseEpsilonGC, "Error");
1989
1990 // Forcefully exit when OOME is detected. Nothing we can do at that point.
1991 if (FLAG_IS_DEFAULT(ExitOnOutOfMemoryError)) {
1992 FLAG_SET_DEFAULT(ExitOnOutOfMemoryError, true);
1993 }
1994
1995 if (EpsilonTLABSize < MinTLABSize) {
1996 warning("EpsilonTLABSize < MinTLABSize, adjusting it to " SIZE_FORMAT, MinTLABSize);
1997 EpsilonTLABSize = MinTLABSize;
1998 }
1999 }
2000
2001 void Arguments::set_gc_specific_flags() {
2002 #if INCLUDE_ALL_GCS
2003 // Set per-collector flags
2004 if (UseParallelGC || UseParallelOldGC) {
2005 set_parallel_gc_flags();
2006 } else if (UseConcMarkSweepGC) {
2007 set_cms_and_parnew_gc_flags();
2008 } else if (UseG1GC) {
2009 set_g1_gc_flags();
2010 } else if (UseEpsilonGC) {
2011 set_epsilon_flags();
2012 }
2013 if (AssumeMP && !UseSerialGC) {
2014 if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) {
2015 warning("If the number of processors is expected to increase from one, then"
2016 " you should configure the number of parallel GC threads appropriately"
2017 " using -XX:ParallelGCThreads=N");
2018 }
2019 }
2020 if (MinHeapFreeRatio == 100) {
2021 // Keeping the heap 100% free is hard ;-) so limit it to 99%.
2022 FLAG_SET_ERGO(uintx, MinHeapFreeRatio, 99);
2023 }
2024
2025 // If class unloading is disabled, also disable concurrent class unloading.
2026 if (!ClassUnloading) {
2027 FLAG_SET_CMDLINE(bool, CMSClassUnloadingEnabled, false);
2028 FLAG_SET_CMDLINE(bool, ClassUnloadingWithConcurrentMark, false);
2029 }
2030 #endif // INCLUDE_ALL_GCS
2031 }
2355
2356 //===========================================================================================================
2357 // Parsing of main arguments
2358
2359 #if INCLUDE_JVMCI
2360 // Check consistency of jvmci vm argument settings.
2361 bool Arguments::check_jvmci_args_consistency() {
2362 return JVMCIGlobals::check_jvmci_flags_are_consistent();
2363 }
2364 #endif //INCLUDE_JVMCI
2365
2366 // Check consistency of GC selection
2367 bool Arguments::check_gc_consistency() {
2368 // Ensure that the user has not selected conflicting sets
2369 // of collectors.
2370 uint i = 0;
2371 if (UseSerialGC) i++;
2372 if (UseConcMarkSweepGC) i++;
2373 if (UseParallelGC || UseParallelOldGC) i++;
2374 if (UseG1GC) i++;
2375 if (UseEpsilonGC) i++;
2376 if (i > 1) {
2377 jio_fprintf(defaultStream::error_stream(),
2378 "Conflicting collector combinations in option list; "
2379 "please refer to the release notes for the combinations "
2380 "allowed\n");
2381 return false;
2382 }
2383
2384 return true;
2385 }
2386
2387 // Check the consistency of vm_init_args
2388 bool Arguments::check_vm_args_consistency() {
2389 // Method for adding checks for flag consistency.
2390 // The intent is to warn the user of all possible conflicts,
2391 // before returning an error.
2392 // Note: Needs platform-dependent factoring.
2393 bool status = true;
2394
2395 if (TLABRefillWasteFraction == 0) {
|