1706 FLAG_SET_DEFAULT(GCTimeRatio, 9);
1707 }
1708
1709 if (PrintGCDetails && Verbose) {
1710 tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk",
1711 (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K));
1712 tty->print_cr("ConcGCThreads: %u", (uint) ConcGCThreads);
1713 }
1714 }
1715
1716 #if !INCLUDE_ALL_GCS
1717 #ifdef ASSERT
1718 static bool verify_serial_gc_flags() {
1719 return (UseSerialGC &&
1720 !(UseParNewGC || (UseConcMarkSweepGC || CMSIncrementalMode) || UseG1GC ||
1721 UseParallelGC || UseParallelOldGC));
1722 }
1723 #endif // ASSERT
1724 #endif // INCLUDE_ALL_GCS
1725
1726 void Arguments::set_gc_specific_flags() {
1727 #if INCLUDE_ALL_GCS
1728 // Set per-collector flags
1729 if (UseParallelGC || UseParallelOldGC) {
1730 set_parallel_gc_flags();
1731 } else if (UseConcMarkSweepGC) { // Should be done before ParNew check below
1732 set_cms_and_parnew_gc_flags();
1733 } else if (UseParNewGC) { // Skipped if CMS is set above
1734 set_parnew_gc_flags();
1735 } else if (UseG1GC) {
1736 set_g1_gc_flags();
1737 }
1738 check_deprecated_gcs();
1739 check_deprecated_gc_flags();
1740 if (AssumeMP && !UseSerialGC) {
1741 if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) {
1742 warning("If the number of processors is expected to increase from one, then"
1743 " you should configure the number of parallel GC threads appropriately"
1744 " using -XX:ParallelGCThreads=N");
1745 }
1746 }
1747 if (MinHeapFreeRatio == 100) {
1748 // Keeping the heap 100% free is hard ;-) so limit it to 99%.
1749 FLAG_SET_ERGO(uintx, MinHeapFreeRatio, 99);
1750 }
1751 #else // INCLUDE_ALL_GCS
1752 assert(verify_serial_gc_flags(), "SerialGC unset");
1753 #endif // INCLUDE_ALL_GCS
1754 }
1755
1756 julong Arguments::limit_by_allocatable_memory(julong limit) {
2103 _max_heap_free_ratio = max_heap_free_ratio;
2104 return true;
2105 }
2106
2107 // Check consistency of GC selection
2108 bool Arguments::check_gc_consistency() {
2109 check_gclog_consistency();
2110 bool status = true;
2111 // Ensure that the user has not selected conflicting sets
2112 // of collectors. [Note: this check is merely a user convenience;
2113 // collectors over-ride each other so that only a non-conflicting
2114 // set is selected; however what the user gets is not what they
2115 // may have expected from the combination they asked for. It's
2116 // better to reduce user confusion by not allowing them to
2117 // select conflicting combinations.
2118 uint i = 0;
2119 if (UseSerialGC) i++;
2120 if (UseConcMarkSweepGC || UseParNewGC) i++;
2121 if (UseParallelGC || UseParallelOldGC) i++;
2122 if (UseG1GC) i++;
2123 if (i > 1) {
2124 jio_fprintf(defaultStream::error_stream(),
2125 "Conflicting collector combinations in option list; "
2126 "please refer to the release notes for the combinations "
2127 "allowed\n");
2128 status = false;
2129 }
2130 return status;
2131 }
2132
2133 void Arguments::check_deprecated_gcs() {
2134 if (UseConcMarkSweepGC && !UseParNewGC) {
2135 warning("Using the DefNew young collector with the CMS collector is deprecated "
2136 "and will likely be removed in a future release");
2137 }
2138
2139 if (UseParNewGC && !UseConcMarkSweepGC) {
2140 // !UseConcMarkSweepGC means that we are using serial old gc. Unfortunately we don't
2141 // set up UseSerialGC properly, so that can't be used in the check here.
2142 warning("Using the ParNew young collector with the Serial old collector is deprecated "
|
1706 FLAG_SET_DEFAULT(GCTimeRatio, 9);
1707 }
1708
1709 if (PrintGCDetails && Verbose) {
1710 tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk",
1711 (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K));
1712 tty->print_cr("ConcGCThreads: %u", (uint) ConcGCThreads);
1713 }
1714 }
1715
1716 #if !INCLUDE_ALL_GCS
1717 #ifdef ASSERT
1718 static bool verify_serial_gc_flags() {
1719 return (UseSerialGC &&
1720 !(UseParNewGC || (UseConcMarkSweepGC || CMSIncrementalMode) || UseG1GC ||
1721 UseParallelGC || UseParallelOldGC));
1722 }
1723 #endif // ASSERT
1724 #endif // INCLUDE_ALL_GCS
1725
1726 void Arguments::set_epsilon_flags() {
1727 assert(UseEpsilonGC, "Error");
1728
1729 // Forcefully exit when OOME is detected. Nothing we can do at that point.
1730 if (FLAG_IS_DEFAULT(ExitOnOutOfMemoryError)) {
1731 FLAG_SET_DEFAULT(ExitOnOutOfMemoryError, true);
1732 }
1733
1734 #if INCLUDE_ALL_GCS
1735 if (EpsilonMaxTLABSize < MinTLABSize) {
1736 warning("EpsilonMaxTLABSize < MinTLABSize, adjusting it to " SIZE_FORMAT, MinTLABSize);
1737 EpsilonMaxTLABSize = MinTLABSize;
1738 }
1739 #endif
1740 }
1741
1742 void Arguments::set_gc_specific_flags() {
1743 #if INCLUDE_ALL_GCS
1744 // Set per-collector flags
1745 if (UseParallelGC || UseParallelOldGC) {
1746 set_parallel_gc_flags();
1747 } else if (UseConcMarkSweepGC) { // Should be done before ParNew check below
1748 set_cms_and_parnew_gc_flags();
1749 } else if (UseParNewGC) { // Skipped if CMS is set above
1750 set_parnew_gc_flags();
1751 } else if (UseG1GC) {
1752 set_g1_gc_flags();
1753 } else if (UseEpsilonGC) {
1754 set_epsilon_flags();
1755 }
1756 check_deprecated_gcs();
1757 check_deprecated_gc_flags();
1758 if (AssumeMP && !UseSerialGC) {
1759 if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) {
1760 warning("If the number of processors is expected to increase from one, then"
1761 " you should configure the number of parallel GC threads appropriately"
1762 " using -XX:ParallelGCThreads=N");
1763 }
1764 }
1765 if (MinHeapFreeRatio == 100) {
1766 // Keeping the heap 100% free is hard ;-) so limit it to 99%.
1767 FLAG_SET_ERGO(uintx, MinHeapFreeRatio, 99);
1768 }
1769 #else // INCLUDE_ALL_GCS
1770 assert(verify_serial_gc_flags(), "SerialGC unset");
1771 #endif // INCLUDE_ALL_GCS
1772 }
1773
1774 julong Arguments::limit_by_allocatable_memory(julong limit) {
2121 _max_heap_free_ratio = max_heap_free_ratio;
2122 return true;
2123 }
2124
2125 // Check consistency of GC selection
2126 bool Arguments::check_gc_consistency() {
2127 check_gclog_consistency();
2128 bool status = true;
2129 // Ensure that the user has not selected conflicting sets
2130 // of collectors. [Note: this check is merely a user convenience;
2131 // collectors over-ride each other so that only a non-conflicting
2132 // set is selected; however what the user gets is not what they
2133 // may have expected from the combination they asked for. It's
2134 // better to reduce user confusion by not allowing them to
2135 // select conflicting combinations.
2136 uint i = 0;
2137 if (UseSerialGC) i++;
2138 if (UseConcMarkSweepGC || UseParNewGC) i++;
2139 if (UseParallelGC || UseParallelOldGC) i++;
2140 if (UseG1GC) i++;
2141 if (UseEpsilonGC) i++;
2142 if (i > 1) {
2143 jio_fprintf(defaultStream::error_stream(),
2144 "Conflicting collector combinations in option list; "
2145 "please refer to the release notes for the combinations "
2146 "allowed\n");
2147 status = false;
2148 }
2149 return status;
2150 }
2151
2152 void Arguments::check_deprecated_gcs() {
2153 if (UseConcMarkSweepGC && !UseParNewGC) {
2154 warning("Using the DefNew young collector with the CMS collector is deprecated "
2155 "and will likely be removed in a future release");
2156 }
2157
2158 if (UseParNewGC && !UseConcMarkSweepGC) {
2159 // !UseConcMarkSweepGC means that we are using serial old gc. Unfortunately we don't
2160 // set up UseSerialGC properly, so that can't be used in the check here.
2161 warning("Using the ParNew young collector with the Serial old collector is deprecated "
|