1789 // OldPLABSize is interpreted in CMS as not the size of the PLAB in words, 1790 // but rather the number of free blocks of a given size that are used when 1791 // replenishing the local per-worker free list caches. 1792 if (FLAG_IS_DEFAULT(OldPLABSize)) { 1793 if (!FLAG_IS_DEFAULT(ResizeOldPLAB) && !ResizeOldPLAB) { 1794 // OldPLAB sizing manually turned off: Use a larger default setting, 1795 // unless it was manually specified. This is because a too-low value 1796 // will slow down scavenges. 1797 FLAG_SET_ERGO(size_t, OldPLABSize, CompactibleFreeListSpaceLAB::_default_static_old_plab_size); // default value before 6631166 1798 } else { 1799 FLAG_SET_DEFAULT(OldPLABSize, CompactibleFreeListSpaceLAB::_default_dynamic_old_plab_size); // old CMSParPromoteBlocksToClaim default 1800 } 1801 } 1802 1803 // If either of the static initialization defaults have changed, note this 1804 // modification. 1805 if (!FLAG_IS_DEFAULT(OldPLABSize) || !FLAG_IS_DEFAULT(OldPLABWeight)) { 1806 CompactibleFreeListSpaceLAB::modify_initialization(OldPLABSize, OldPLABWeight); 1807 } 1808 1809 if (!ClassUnloading) { 1810 FLAG_SET_CMDLINE(bool, CMSClassUnloadingEnabled, false); 1811 FLAG_SET_CMDLINE(bool, ExplicitGCInvokesConcurrentAndUnloadsClasses, false); 1812 } 1813 1814 log_trace(gc)("MarkStackSize: %uk MarkStackSizeMax: %uk", (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K)); 1815 log_trace(gc)("ConcGCThreads: %u", ConcGCThreads); 1816 } 1817 #endif // INCLUDE_ALL_GCS 1818 1819 void set_object_alignment() { 1820 // Object alignment. 1821 assert(is_power_of_2(ObjectAlignmentInBytes), "ObjectAlignmentInBytes must be power of 2"); 1822 MinObjAlignmentInBytes = ObjectAlignmentInBytes; 1823 assert(MinObjAlignmentInBytes >= HeapWordsPerLong * HeapWordSize, "ObjectAlignmentInBytes value is too small"); 1824 MinObjAlignment = MinObjAlignmentInBytes / HeapWordSize; 1825 assert(MinObjAlignmentInBytes == MinObjAlignment * HeapWordSize, "ObjectAlignmentInBytes value is incorrect"); 1826 MinObjAlignmentInBytesMask = MinObjAlignmentInBytes - 1; 1827 1828 LogMinObjAlignmentInBytes = exact_log2(ObjectAlignmentInBytes); 1829 LogMinObjAlignment = LogMinObjAlignmentInBytes - LogHeapWordSize; 1830 1831 // Oop encoding heap max 1832 OopEncodingHeapMax = (uint64_t(max_juint) + 1) << LogMinObjAlignmentInBytes; 1833 2105 #if INCLUDE_ALL_GCS 2106 // Set per-collector flags 2107 if (UseParallelGC || UseParallelOldGC) { 2108 set_parallel_gc_flags(); 2109 } else if (UseConcMarkSweepGC) { 2110 set_cms_and_parnew_gc_flags(); 2111 } else if (UseG1GC) { 2112 set_g1_gc_flags(); 2113 } 2114 if (AssumeMP && !UseSerialGC) { 2115 if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) { 2116 warning("If the number of processors is expected to increase from one, then" 2117 " you should configure the number of parallel GC threads appropriately" 2118 " using -XX:ParallelGCThreads=N"); 2119 } 2120 } 2121 if (MinHeapFreeRatio == 100) { 2122 // Keeping the heap 100% free is hard ;-) so limit it to 99%. 2123 FLAG_SET_ERGO(uintx, MinHeapFreeRatio, 99); 2124 } 2125 #endif // INCLUDE_ALL_GCS 2126 } 2127 2128 julong Arguments::limit_by_allocatable_memory(julong limit) { 2129 julong max_allocatable; 2130 julong result = limit; 2131 if (os::has_allocatable_memory_limit(&max_allocatable)) { 2132 result = MIN2(result, max_allocatable / MaxVirtMemFraction); 2133 } 2134 return result; 2135 } 2136 2137 // Use static initialization to get the default before parsing 2138 static const size_t DefaultHeapBaseMinAddress = HeapBaseMinAddress; 2139 2140 void Arguments::set_heap_size() { 2141 const julong phys_mem = 2142 FLAG_IS_DEFAULT(MaxRAM) ? MIN2(os::physical_memory(), (julong)MaxRAM) 2143 : (julong)MaxRAM; 2144 | 1789 // OldPLABSize is interpreted in CMS as not the size of the PLAB in words, 1790 // but rather the number of free blocks of a given size that are used when 1791 // replenishing the local per-worker free list caches. 1792 if (FLAG_IS_DEFAULT(OldPLABSize)) { 1793 if (!FLAG_IS_DEFAULT(ResizeOldPLAB) && !ResizeOldPLAB) { 1794 // OldPLAB sizing manually turned off: Use a larger default setting, 1795 // unless it was manually specified. This is because a too-low value 1796 // will slow down scavenges. 1797 FLAG_SET_ERGO(size_t, OldPLABSize, CompactibleFreeListSpaceLAB::_default_static_old_plab_size); // default value before 6631166 1798 } else { 1799 FLAG_SET_DEFAULT(OldPLABSize, CompactibleFreeListSpaceLAB::_default_dynamic_old_plab_size); // old CMSParPromoteBlocksToClaim default 1800 } 1801 } 1802 1803 // If either of the static initialization defaults have changed, note this 1804 // modification. 1805 if (!FLAG_IS_DEFAULT(OldPLABSize) || !FLAG_IS_DEFAULT(OldPLABWeight)) { 1806 CompactibleFreeListSpaceLAB::modify_initialization(OldPLABSize, OldPLABWeight); 1807 } 1808 1809 log_trace(gc)("MarkStackSize: %uk MarkStackSizeMax: %uk", (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K)); 1810 log_trace(gc)("ConcGCThreads: %u", ConcGCThreads); 1811 } 1812 #endif // INCLUDE_ALL_GCS 1813 1814 void set_object_alignment() { 1815 // Object alignment. 1816 assert(is_power_of_2(ObjectAlignmentInBytes), "ObjectAlignmentInBytes must be power of 2"); 1817 MinObjAlignmentInBytes = ObjectAlignmentInBytes; 1818 assert(MinObjAlignmentInBytes >= HeapWordsPerLong * HeapWordSize, "ObjectAlignmentInBytes value is too small"); 1819 MinObjAlignment = MinObjAlignmentInBytes / HeapWordSize; 1820 assert(MinObjAlignmentInBytes == MinObjAlignment * HeapWordSize, "ObjectAlignmentInBytes value is incorrect"); 1821 MinObjAlignmentInBytesMask = MinObjAlignmentInBytes - 1; 1822 1823 LogMinObjAlignmentInBytes = exact_log2(ObjectAlignmentInBytes); 1824 LogMinObjAlignment = LogMinObjAlignmentInBytes - LogHeapWordSize; 1825 1826 // Oop encoding heap max 1827 OopEncodingHeapMax = (uint64_t(max_juint) + 1) << LogMinObjAlignmentInBytes; 1828 2100 #if INCLUDE_ALL_GCS 2101 // Set per-collector flags 2102 if (UseParallelGC || UseParallelOldGC) { 2103 set_parallel_gc_flags(); 2104 } else if (UseConcMarkSweepGC) { 2105 set_cms_and_parnew_gc_flags(); 2106 } else if (UseG1GC) { 2107 set_g1_gc_flags(); 2108 } 2109 if (AssumeMP && !UseSerialGC) { 2110 if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) { 2111 warning("If the number of processors is expected to increase from one, then" 2112 " you should configure the number of parallel GC threads appropriately" 2113 " using -XX:ParallelGCThreads=N"); 2114 } 2115 } 2116 if (MinHeapFreeRatio == 100) { 2117 // Keeping the heap 100% free is hard ;-) so limit it to 99%. 2118 FLAG_SET_ERGO(uintx, MinHeapFreeRatio, 99); 2119 } 2120 2121 if (!ClassUnloading) { 2122 FLAG_SET_CMDLINE(bool, ClassUnloadingWithConcurrentMark, false); 2123 FLAG_SET_CMDLINE(bool, ExplicitGCInvokesConcurrentAndUnloadsClasses, false); 2124 } 2125 2126 if (!FLAG_IS_DEFAULT(CMSClassUnloadingEnabled)) { 2127 // This is CMS specific but I wanted to keep it close to the 2128 // if (!ClassUnloading) above. Once CMSClassUnloadingEnabled is 2129 // deprecated, this is the code to remove. 2130 FLAG_SET_CMDLINE(bool, ClassUnloadingWithConcurrentMark, CMSClassUnloadingEnabled); 2131 } 2132 #endif // INCLUDE_ALL_GCS 2133 } 2134 2135 julong Arguments::limit_by_allocatable_memory(julong limit) { 2136 julong max_allocatable; 2137 julong result = limit; 2138 if (os::has_allocatable_memory_limit(&max_allocatable)) { 2139 result = MIN2(result, max_allocatable / MaxVirtMemFraction); 2140 } 2141 return result; 2142 } 2143 2144 // Use static initialization to get the default before parsing 2145 static const size_t DefaultHeapBaseMinAddress = HeapBaseMinAddress; 2146 2147 void Arguments::set_heap_size() { 2148 const julong phys_mem = 2149 FLAG_IS_DEFAULT(MaxRAM) ? MIN2(os::physical_memory(), (julong)MaxRAM) 2150 : (julong)MaxRAM; 2151 |