140 |
140 |
141 // Set MaxNewSize to our calculated preferred_max_new_size unless |
141 // Set MaxNewSize to our calculated preferred_max_new_size unless |
142 // NewSize was set on the command line and it is larger than |
142 // NewSize was set on the command line and it is larger than |
143 // preferred_max_new_size. |
143 // preferred_max_new_size. |
144 if (!FLAG_IS_DEFAULT(NewSize)) { // NewSize explicitly set at command-line |
144 if (!FLAG_IS_DEFAULT(NewSize)) { // NewSize explicitly set at command-line |
145 FLAG_SET_ERGO(size_t, MaxNewSize, MAX2(NewSize, preferred_max_new_size)); |
145 FLAG_SET_ERGO(MaxNewSize, MAX2(NewSize, preferred_max_new_size)); |
146 } else { |
146 } else { |
147 FLAG_SET_ERGO(size_t, MaxNewSize, preferred_max_new_size); |
147 FLAG_SET_ERGO(MaxNewSize, preferred_max_new_size); |
148 } |
148 } |
149 log_trace(gc, heap)("CMS ergo set MaxNewSize: " SIZE_FORMAT, MaxNewSize); |
149 log_trace(gc, heap)("CMS ergo set MaxNewSize: " SIZE_FORMAT, MaxNewSize); |
150 |
150 |
151 // Code along this path potentially sets NewSize and OldSize |
151 // Code along this path potentially sets NewSize and OldSize |
152 log_trace(gc, heap)("CMS set min_heap_size: " SIZE_FORMAT " initial_heap_size: " SIZE_FORMAT " max_heap: " SIZE_FORMAT, |
152 log_trace(gc, heap)("CMS set min_heap_size: " SIZE_FORMAT " initial_heap_size: " SIZE_FORMAT " max_heap: " SIZE_FORMAT, |
157 } |
157 } |
158 if (max_heap > min_new && MinHeapSize > min_new) { |
158 if (max_heap > min_new && MinHeapSize > min_new) { |
159 // Unless explicitly requested otherwise, make young gen |
159 // Unless explicitly requested otherwise, make young gen |
160 // at least min_new, and at most preferred_max_new_size. |
160 // at least min_new, and at most preferred_max_new_size. |
161 if (FLAG_IS_DEFAULT(NewSize)) { |
161 if (FLAG_IS_DEFAULT(NewSize)) { |
162 FLAG_SET_ERGO(size_t, NewSize, MAX2(NewSize, min_new)); |
162 FLAG_SET_ERGO(NewSize, MAX2(NewSize, min_new)); |
163 FLAG_SET_ERGO(size_t, NewSize, MIN2(preferred_max_new_size, NewSize)); |
163 FLAG_SET_ERGO(NewSize, MIN2(preferred_max_new_size, NewSize)); |
164 log_trace(gc, heap)("CMS ergo set NewSize: " SIZE_FORMAT, NewSize); |
164 log_trace(gc, heap)("CMS ergo set NewSize: " SIZE_FORMAT, NewSize); |
165 } |
165 } |
166 // Unless explicitly requested otherwise, size old gen |
166 // Unless explicitly requested otherwise, size old gen |
167 // so it's NewRatio x of NewSize. |
167 // so it's NewRatio x of NewSize. |
168 if (FLAG_IS_DEFAULT(OldSize)) { |
168 if (FLAG_IS_DEFAULT(OldSize)) { |
169 if (max_heap > NewSize) { |
169 if (max_heap > NewSize) { |
170 FLAG_SET_ERGO(size_t, OldSize, MIN2(NewRatio*NewSize, max_heap - NewSize)); |
170 FLAG_SET_ERGO(OldSize, MIN2(NewRatio*NewSize, max_heap - NewSize)); |
171 log_trace(gc, heap)("CMS ergo set OldSize: " SIZE_FORMAT, OldSize); |
171 log_trace(gc, heap)("CMS ergo set OldSize: " SIZE_FORMAT, OldSize); |
172 } |
172 } |
173 } |
173 } |
174 } |
174 } |
175 } |
175 } |
176 // Unless explicitly requested otherwise, definitely |
176 // Unless explicitly requested otherwise, definitely |
177 // promote all objects surviving "tenuring_default" scavenges. |
177 // promote all objects surviving "tenuring_default" scavenges. |
178 if (FLAG_IS_DEFAULT(MaxTenuringThreshold) && |
178 if (FLAG_IS_DEFAULT(MaxTenuringThreshold) && |
179 FLAG_IS_DEFAULT(SurvivorRatio)) { |
179 FLAG_IS_DEFAULT(SurvivorRatio)) { |
180 FLAG_SET_ERGO(uintx, MaxTenuringThreshold, tenuring_default); |
180 FLAG_SET_ERGO(MaxTenuringThreshold, tenuring_default); |
181 } |
181 } |
182 // If we decided above (or user explicitly requested) |
182 // If we decided above (or user explicitly requested) |
183 // `promote all' (via MaxTenuringThreshold := 0), |
183 // `promote all' (via MaxTenuringThreshold := 0), |
184 // prefer minuscule survivor spaces so as not to waste |
184 // prefer minuscule survivor spaces so as not to waste |
185 // space for (non-existent) survivors |
185 // space for (non-existent) survivors |
186 if (FLAG_IS_DEFAULT(SurvivorRatio) && MaxTenuringThreshold == 0) { |
186 if (FLAG_IS_DEFAULT(SurvivorRatio) && MaxTenuringThreshold == 0) { |
187 FLAG_SET_ERGO(uintx, SurvivorRatio, MAX2((uintx)1024, SurvivorRatio)); |
187 FLAG_SET_ERGO(SurvivorRatio, MAX2((uintx)1024, SurvivorRatio)); |
188 } |
188 } |
189 |
189 |
190 // OldPLABSize is interpreted in CMS as not the size of the PLAB in words, |
190 // OldPLABSize is interpreted in CMS as not the size of the PLAB in words, |
191 // but rather the number of free blocks of a given size that are used when |
191 // but rather the number of free blocks of a given size that are used when |
192 // replenishing the local per-worker free list caches. |
192 // replenishing the local per-worker free list caches. |
193 if (FLAG_IS_DEFAULT(OldPLABSize)) { |
193 if (FLAG_IS_DEFAULT(OldPLABSize)) { |
194 if (!FLAG_IS_DEFAULT(ResizeOldPLAB) && !ResizeOldPLAB) { |
194 if (!FLAG_IS_DEFAULT(ResizeOldPLAB) && !ResizeOldPLAB) { |
195 // OldPLAB sizing manually turned off: Use a larger default setting, |
195 // OldPLAB sizing manually turned off: Use a larger default setting, |
196 // unless it was manually specified. This is because a too-low value |
196 // unless it was manually specified. This is because a too-low value |
197 // will slow down scavenges. |
197 // will slow down scavenges. |
198 FLAG_SET_ERGO(size_t, OldPLABSize, CompactibleFreeListSpaceLAB::_default_static_old_plab_size); // default value before 6631166 |
198 FLAG_SET_ERGO(OldPLABSize, CompactibleFreeListSpaceLAB::_default_static_old_plab_size); // default value before 6631166 |
199 } else { |
199 } else { |
200 FLAG_SET_DEFAULT(OldPLABSize, CompactibleFreeListSpaceLAB::_default_dynamic_old_plab_size); // old CMSParPromoteBlocksToClaim default |
200 FLAG_SET_DEFAULT(OldPLABSize, CompactibleFreeListSpaceLAB::_default_dynamic_old_plab_size); // old CMSParPromoteBlocksToClaim default |
201 } |
201 } |
202 } |
202 } |
203 |
203 |