Thu, 03 Oct 2013 21:36:29 +0200
8025852: Remove unnecessary setters in collector policy classes
Summary: Use instance variables directly within the collector policy classes and remove unused setters.
Reviewed-by: tschatzl, jcoomes
1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Thu Oct 03 17:16:23 2013 +0200 1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Thu Oct 03 21:36:29 2013 +0200 1.3 @@ -319,10 +319,10 @@ 1.4 } 1.5 1.6 void G1CollectorPolicy::initialize_flags() { 1.7 - set_min_alignment(HeapRegion::GrainBytes); 1.8 + _min_alignment = HeapRegion::GrainBytes; 1.9 size_t card_table_alignment = GenRemSet::max_alignment_constraint(rem_set_name()); 1.10 size_t page_size = UseLargePages ? os::large_page_size() : os::vm_page_size(); 1.11 - set_max_alignment(MAX3(card_table_alignment, min_alignment(), page_size)); 1.12 + _max_alignment = MAX3(card_table_alignment, _min_alignment, page_size); 1.13 if (SurvivorRatio < 1) { 1.14 vm_exit_during_initialization("Invalid survivor ratio specified"); 1.15 }
2.1 --- a/src/share/vm/memory/collectorPolicy.cpp Thu Oct 03 17:16:23 2013 +0200 2.2 +++ b/src/share/vm/memory/collectorPolicy.cpp Thu Oct 03 21:36:29 2013 +0200 2.3 @@ -53,12 +53,12 @@ 2.4 } 2.5 2.6 void CollectorPolicy::initialize_flags() { 2.7 - assert(max_alignment() >= min_alignment(), 2.8 - err_msg("max_alignment: " SIZE_FORMAT " less than min_alignment: " SIZE_FORMAT, 2.9 - max_alignment(), min_alignment())); 2.10 - assert(max_alignment() % min_alignment() == 0, 2.11 - err_msg("max_alignment: " SIZE_FORMAT " not aligned by min_alignment: " SIZE_FORMAT, 2.12 - max_alignment(), min_alignment())); 2.13 + assert(_max_alignment >= _min_alignment, 2.14 + err_msg("max_alignment: " SIZE_FORMAT " less than min_alignment: " SIZE_FORMAT, 2.15 + _max_alignment, _min_alignment)); 2.16 + assert(_max_alignment % _min_alignment == 0, 2.17 + err_msg("max_alignment: " SIZE_FORMAT " not aligned by min_alignment: " SIZE_FORMAT, 2.18 + _max_alignment, _min_alignment)); 2.19 2.20 if (MaxHeapSize < InitialHeapSize) { 2.21 vm_exit_during_initialization("Incompatible initial and maximum heap sizes specified"); 2.22 @@ -72,23 +72,23 @@ 2.23 // Ideally, we would be able to set the default value of MaxMetaspaceSize in 2.24 // globals.hpp to the aligned value, but this is not possible, since the 2.25 // alignment depends on other flags being parsed. 2.26 - MaxMetaspaceSize = restricted_align_down(MaxMetaspaceSize, max_alignment()); 2.27 + MaxMetaspaceSize = restricted_align_down(MaxMetaspaceSize, _max_alignment); 2.28 2.29 if (MetaspaceSize > MaxMetaspaceSize) { 2.30 MetaspaceSize = MaxMetaspaceSize; 2.31 } 2.32 2.33 - MetaspaceSize = restricted_align_down(MetaspaceSize, min_alignment()); 2.34 + MetaspaceSize = restricted_align_down(MetaspaceSize, _min_alignment); 2.35 2.36 assert(MetaspaceSize <= MaxMetaspaceSize, "Must be"); 2.37 2.38 - MinMetaspaceExpansion = restricted_align_down(MinMetaspaceExpansion, min_alignment()); 2.39 - MaxMetaspaceExpansion = restricted_align_down(MaxMetaspaceExpansion, min_alignment()); 2.40 + MinMetaspaceExpansion = restricted_align_down(MinMetaspaceExpansion, _min_alignment); 2.41 + MaxMetaspaceExpansion = restricted_align_down(MaxMetaspaceExpansion, _min_alignment); 2.42 2.43 - MinHeapDeltaBytes = align_size_up(MinHeapDeltaBytes, min_alignment()); 2.44 + MinHeapDeltaBytes = align_size_up(MinHeapDeltaBytes, _min_alignment); 2.45 2.46 - assert(MetaspaceSize % min_alignment() == 0, "metapace alignment"); 2.47 - assert(MaxMetaspaceSize % max_alignment() == 0, "maximum metaspace alignment"); 2.48 + assert(MetaspaceSize % _min_alignment == 0, "metapace alignment"); 2.49 + assert(MaxMetaspaceSize % _max_alignment == 0, "maximum metaspace alignment"); 2.50 if (MetaspaceSize < 256*K) { 2.51 vm_exit_during_initialization("Too small initial Metaspace size"); 2.52 } 2.53 @@ -96,36 +96,36 @@ 2.54 2.55 void CollectorPolicy::initialize_size_info() { 2.56 // User inputs from -mx and ms must be aligned 2.57 - set_min_heap_byte_size(align_size_up(Arguments::min_heap_size(), min_alignment())); 2.58 - set_initial_heap_byte_size(align_size_up(InitialHeapSize, min_alignment())); 2.59 - set_max_heap_byte_size(align_size_up(MaxHeapSize, max_alignment())); 2.60 + _min_heap_byte_size = align_size_up(Arguments::min_heap_size(), _min_alignment); 2.61 + _initial_heap_byte_size = align_size_up(InitialHeapSize, _min_alignment); 2.62 + _max_heap_byte_size = align_size_up(MaxHeapSize, _max_alignment); 2.63 2.64 // Check heap parameter properties 2.65 - if (initial_heap_byte_size() < M) { 2.66 + if (_initial_heap_byte_size < M) { 2.67 vm_exit_during_initialization("Too small initial heap"); 2.68 } 2.69 // Check heap parameter properties 2.70 - if (min_heap_byte_size() < M) { 2.71 + if (_min_heap_byte_size < M) { 2.72 vm_exit_during_initialization("Too small minimum heap"); 2.73 } 2.74 - if (initial_heap_byte_size() <= NewSize) { 2.75 + if (_initial_heap_byte_size <= NewSize) { 2.76 // make sure there is at least some room in old space 2.77 vm_exit_during_initialization("Too small initial heap for new size specified"); 2.78 } 2.79 - if (max_heap_byte_size() < min_heap_byte_size()) { 2.80 + if (_max_heap_byte_size < _min_heap_byte_size) { 2.81 vm_exit_during_initialization("Incompatible minimum and maximum heap sizes specified"); 2.82 } 2.83 - if (initial_heap_byte_size() < min_heap_byte_size()) { 2.84 + if (_initial_heap_byte_size < _min_heap_byte_size) { 2.85 vm_exit_during_initialization("Incompatible minimum and initial heap sizes specified"); 2.86 } 2.87 - if (max_heap_byte_size() < initial_heap_byte_size()) { 2.88 + if (_max_heap_byte_size < _initial_heap_byte_size) { 2.89 vm_exit_during_initialization("Incompatible initial and maximum heap sizes specified"); 2.90 } 2.91 2.92 if (PrintGCDetails && Verbose) { 2.93 gclog_or_tty->print_cr("Minimum heap " SIZE_FORMAT " Initial heap " 2.94 SIZE_FORMAT " Maximum heap " SIZE_FORMAT, 2.95 - min_heap_byte_size(), initial_heap_byte_size(), max_heap_byte_size()); 2.96 + _min_heap_byte_size, _initial_heap_byte_size, _max_heap_byte_size); 2.97 } 2.98 } 2.99 2.100 @@ -180,15 +180,15 @@ 2.101 2.102 size_t GenCollectorPolicy::scale_by_NewRatio_aligned(size_t base_size) { 2.103 size_t x = base_size / (NewRatio+1); 2.104 - size_t new_gen_size = x > min_alignment() ? 2.105 - align_size_down(x, min_alignment()) : 2.106 - min_alignment(); 2.107 + size_t new_gen_size = x > _min_alignment ? 2.108 + align_size_down(x, _min_alignment) : 2.109 + _min_alignment; 2.110 return new_gen_size; 2.111 } 2.112 2.113 size_t GenCollectorPolicy::bound_minus_alignment(size_t desired_size, 2.114 size_t maximum_size) { 2.115 - size_t alignment = min_alignment(); 2.116 + size_t alignment = _min_alignment; 2.117 size_t max_minus = maximum_size - alignment; 2.118 return desired_size < max_minus ? desired_size : max_minus; 2.119 } 2.120 @@ -207,8 +207,8 @@ 2.121 2.122 void GenCollectorPolicy::initialize_flags() { 2.123 // All sizes must be multiples of the generation granularity. 2.124 - set_min_alignment((uintx) Generation::GenGrain); 2.125 - set_max_alignment(compute_max_alignment()); 2.126 + _min_alignment = (uintx) Generation::GenGrain; 2.127 + _max_alignment = compute_max_alignment(); 2.128 2.129 CollectorPolicy::initialize_flags(); 2.130 2.131 @@ -218,14 +218,14 @@ 2.132 if (NewSize > MaxNewSize) { 2.133 MaxNewSize = NewSize; 2.134 } 2.135 - NewSize = align_size_down(NewSize, min_alignment()); 2.136 - MaxNewSize = align_size_down(MaxNewSize, min_alignment()); 2.137 + NewSize = align_size_down(NewSize, _min_alignment); 2.138 + MaxNewSize = align_size_down(MaxNewSize, _min_alignment); 2.139 2.140 // Check validity of heap flags 2.141 - assert(NewSize % min_alignment() == 0, "eden space alignment"); 2.142 - assert(MaxNewSize % min_alignment() == 0, "survivor space alignment"); 2.143 + assert(NewSize % _min_alignment == 0, "eden space alignment"); 2.144 + assert(MaxNewSize % _min_alignment == 0, "survivor space alignment"); 2.145 2.146 - if (NewSize < 3*min_alignment()) { 2.147 + if (NewSize < 3 * _min_alignment) { 2.148 // make sure there room for eden and two survivor spaces 2.149 vm_exit_during_initialization("Too small new size specified"); 2.150 } 2.151 @@ -237,7 +237,7 @@ 2.152 void TwoGenerationCollectorPolicy::initialize_flags() { 2.153 GenCollectorPolicy::initialize_flags(); 2.154 2.155 - OldSize = align_size_down(OldSize, min_alignment()); 2.156 + OldSize = align_size_down(OldSize, _min_alignment); 2.157 2.158 if (FLAG_IS_CMDLINE(OldSize) && FLAG_IS_DEFAULT(NewSize)) { 2.159 // NewRatio will be used later to set the young generation size so we use 2.160 @@ -246,11 +246,11 @@ 2.161 assert(NewRatio > 0, "NewRatio should have been set up earlier"); 2.162 size_t calculated_heapsize = (OldSize / NewRatio) * (NewRatio + 1); 2.163 2.164 - calculated_heapsize = align_size_up(calculated_heapsize, max_alignment()); 2.165 + calculated_heapsize = align_size_up(calculated_heapsize, _max_alignment); 2.166 MaxHeapSize = calculated_heapsize; 2.167 InitialHeapSize = calculated_heapsize; 2.168 } 2.169 - MaxHeapSize = align_size_up(MaxHeapSize, max_alignment()); 2.170 + MaxHeapSize = align_size_up(MaxHeapSize, _max_alignment); 2.171 2.172 // adjust max heap size if necessary 2.173 if (NewSize + OldSize > MaxHeapSize) { 2.174 @@ -260,18 +260,18 @@ 2.175 uintx calculated_size = NewSize + OldSize; 2.176 double shrink_factor = (double) MaxHeapSize / calculated_size; 2.177 // align 2.178 - NewSize = align_size_down((uintx) (NewSize * shrink_factor), min_alignment()); 2.179 + NewSize = align_size_down((uintx) (NewSize * shrink_factor), _min_alignment); 2.180 // OldSize is already aligned because above we aligned MaxHeapSize to 2.181 - // max_alignment(), and we just made sure that NewSize is aligned to 2.182 - // min_alignment(). In initialize_flags() we verified that max_alignment() 2.183 - // is a multiple of min_alignment(). 2.184 + // _max_alignment, and we just made sure that NewSize is aligned to 2.185 + // _min_alignment. In initialize_flags() we verified that _max_alignment 2.186 + // is a multiple of _min_alignment. 2.187 OldSize = MaxHeapSize - NewSize; 2.188 } else { 2.189 MaxHeapSize = NewSize + OldSize; 2.190 } 2.191 } 2.192 // need to do this again 2.193 - MaxHeapSize = align_size_up(MaxHeapSize, max_alignment()); 2.194 + MaxHeapSize = align_size_up(MaxHeapSize, _max_alignment); 2.195 2.196 // adjust max heap size if necessary 2.197 if (NewSize + OldSize > MaxHeapSize) { 2.198 @@ -281,24 +281,24 @@ 2.199 uintx calculated_size = NewSize + OldSize; 2.200 double shrink_factor = (double) MaxHeapSize / calculated_size; 2.201 // align 2.202 - NewSize = align_size_down((uintx) (NewSize * shrink_factor), min_alignment()); 2.203 + NewSize = align_size_down((uintx) (NewSize * shrink_factor), _min_alignment); 2.204 // OldSize is already aligned because above we aligned MaxHeapSize to 2.205 - // max_alignment(), and we just made sure that NewSize is aligned to 2.206 - // min_alignment(). In initialize_flags() we verified that max_alignment() 2.207 - // is a multiple of min_alignment(). 2.208 + // _max_alignment, and we just made sure that NewSize is aligned to 2.209 + // _min_alignment. In initialize_flags() we verified that _max_alignment 2.210 + // is a multiple of _min_alignment. 2.211 OldSize = MaxHeapSize - NewSize; 2.212 } else { 2.213 MaxHeapSize = NewSize + OldSize; 2.214 } 2.215 } 2.216 // need to do this again 2.217 - MaxHeapSize = align_size_up(MaxHeapSize, max_alignment()); 2.218 + MaxHeapSize = align_size_up(MaxHeapSize, _max_alignment); 2.219 2.220 always_do_update_barrier = UseConcMarkSweepGC; 2.221 2.222 // Check validity of heap flags 2.223 - assert(OldSize % min_alignment() == 0, "old space alignment"); 2.224 - assert(MaxHeapSize % max_alignment() == 0, "maximum heap alignment"); 2.225 + assert(OldSize % _min_alignment == 0, "old space alignment"); 2.226 + assert(MaxHeapSize % _max_alignment == 0, "maximum heap alignment"); 2.227 } 2.228 2.229 // Values set on the command line win over any ergonomically 2.230 @@ -313,7 +313,7 @@ 2.231 void GenCollectorPolicy::initialize_size_info() { 2.232 CollectorPolicy::initialize_size_info(); 2.233 2.234 - // min_alignment() is used for alignment within a generation. 2.235 + // _min_alignment is used for alignment within a generation. 2.236 // There is additional alignment done down stream for some 2.237 // collectors that sometimes causes unwanted rounding up of 2.238 // generations sizes. 2.239 @@ -322,18 +322,18 @@ 2.240 2.241 size_t max_new_size = 0; 2.242 if (FLAG_IS_CMDLINE(MaxNewSize) || FLAG_IS_ERGO(MaxNewSize)) { 2.243 - if (MaxNewSize < min_alignment()) { 2.244 - max_new_size = min_alignment(); 2.245 + if (MaxNewSize < _min_alignment) { 2.246 + max_new_size = _min_alignment; 2.247 } 2.248 - if (MaxNewSize >= max_heap_byte_size()) { 2.249 - max_new_size = align_size_down(max_heap_byte_size() - min_alignment(), 2.250 - min_alignment()); 2.251 + if (MaxNewSize >= _max_heap_byte_size) { 2.252 + max_new_size = align_size_down(_max_heap_byte_size - _min_alignment, 2.253 + _min_alignment); 2.254 warning("MaxNewSize (" SIZE_FORMAT "k) is equal to or " 2.255 "greater than the entire heap (" SIZE_FORMAT "k). A " 2.256 "new generation size of " SIZE_FORMAT "k will be used.", 2.257 - MaxNewSize/K, max_heap_byte_size()/K, max_new_size/K); 2.258 + MaxNewSize/K, _max_heap_byte_size/K, max_new_size/K); 2.259 } else { 2.260 - max_new_size = align_size_down(MaxNewSize, min_alignment()); 2.261 + max_new_size = align_size_down(MaxNewSize, _min_alignment); 2.262 } 2.263 2.264 // The case for FLAG_IS_ERGO(MaxNewSize) could be treated 2.265 @@ -351,7 +351,7 @@ 2.266 // just accept those choices. The choices currently made are 2.267 // not always "wise". 2.268 } else { 2.269 - max_new_size = scale_by_NewRatio_aligned(max_heap_byte_size()); 2.270 + max_new_size = scale_by_NewRatio_aligned(_max_heap_byte_size); 2.271 // Bound the maximum size by NewSize below (since it historically 2.272 // would have been NewSize and because the NewRatio calculation could 2.273 // yield a size that is too small) and bound it by MaxNewSize above. 2.274 @@ -364,13 +364,13 @@ 2.275 // Given the maximum gen0 size, determine the initial and 2.276 // minimum gen0 sizes. 2.277 2.278 - if (max_heap_byte_size() == min_heap_byte_size()) { 2.279 + if (_max_heap_byte_size == _min_heap_byte_size) { 2.280 // The maximum and minimum heap sizes are the same so 2.281 // the generations minimum and initial must be the 2.282 // same as its maximum. 2.283 - set_min_gen0_size(max_new_size); 2.284 - set_initial_gen0_size(max_new_size); 2.285 - set_max_gen0_size(max_new_size); 2.286 + _min_gen0_size = max_new_size; 2.287 + _initial_gen0_size = max_new_size; 2.288 + _max_gen0_size = max_new_size; 2.289 } else { 2.290 size_t desired_new_size = 0; 2.291 if (!FLAG_IS_DEFAULT(NewSize)) { 2.292 @@ -391,43 +391,37 @@ 2.293 // Use the default NewSize as the floor for these values. If 2.294 // NewRatio is overly large, the resulting sizes can be too 2.295 // small. 2.296 - _min_gen0_size = MAX2(scale_by_NewRatio_aligned(min_heap_byte_size()), 2.297 - NewSize); 2.298 + _min_gen0_size = MAX2(scale_by_NewRatio_aligned(_min_heap_byte_size), NewSize); 2.299 desired_new_size = 2.300 - MAX2(scale_by_NewRatio_aligned(initial_heap_byte_size()), 2.301 - NewSize); 2.302 + MAX2(scale_by_NewRatio_aligned(_initial_heap_byte_size), NewSize); 2.303 } 2.304 2.305 assert(_min_gen0_size > 0, "Sanity check"); 2.306 - set_initial_gen0_size(desired_new_size); 2.307 - set_max_gen0_size(max_new_size); 2.308 + _initial_gen0_size = desired_new_size; 2.309 + _max_gen0_size = max_new_size; 2.310 2.311 // At this point the desirable initial and minimum sizes have been 2.312 // determined without regard to the maximum sizes. 2.313 2.314 // Bound the sizes by the corresponding overall heap sizes. 2.315 - set_min_gen0_size( 2.316 - bound_minus_alignment(_min_gen0_size, min_heap_byte_size())); 2.317 - set_initial_gen0_size( 2.318 - bound_minus_alignment(_initial_gen0_size, initial_heap_byte_size())); 2.319 - set_max_gen0_size( 2.320 - bound_minus_alignment(_max_gen0_size, max_heap_byte_size())); 2.321 + _min_gen0_size = bound_minus_alignment(_min_gen0_size, _min_heap_byte_size); 2.322 + _initial_gen0_size = bound_minus_alignment(_initial_gen0_size, _initial_heap_byte_size); 2.323 + _max_gen0_size = bound_minus_alignment(_max_gen0_size, _max_heap_byte_size); 2.324 2.325 // At this point all three sizes have been checked against the 2.326 // maximum sizes but have not been checked for consistency 2.327 // among the three. 2.328 2.329 // Final check min <= initial <= max 2.330 - set_min_gen0_size(MIN2(_min_gen0_size, _max_gen0_size)); 2.331 - set_initial_gen0_size( 2.332 - MAX2(MIN2(_initial_gen0_size, _max_gen0_size), _min_gen0_size)); 2.333 - set_min_gen0_size(MIN2(_min_gen0_size, _initial_gen0_size)); 2.334 + _min_gen0_size = MIN2(_min_gen0_size, _max_gen0_size); 2.335 + _initial_gen0_size = MAX2(MIN2(_initial_gen0_size, _max_gen0_size), _min_gen0_size); 2.336 + _min_gen0_size = MIN2(_min_gen0_size, _initial_gen0_size); 2.337 } 2.338 2.339 if (PrintGCDetails && Verbose) { 2.340 gclog_or_tty->print_cr("1: Minimum gen0 " SIZE_FORMAT " Initial gen0 " 2.341 SIZE_FORMAT " Maximum gen0 " SIZE_FORMAT, 2.342 - min_gen0_size(), initial_gen0_size(), max_gen0_size()); 2.343 + _min_gen0_size, _initial_gen0_size, _max_gen0_size); 2.344 } 2.345 } 2.346 2.347 @@ -447,19 +441,17 @@ 2.348 2.349 if ((*gen1_size_ptr + *gen0_size_ptr) > heap_size) { 2.350 if ((heap_size < (*gen0_size_ptr + min_gen1_size)) && 2.351 - (heap_size >= min_gen1_size + min_alignment())) { 2.352 + (heap_size >= min_gen1_size + _min_alignment)) { 2.353 // Adjust gen0 down to accommodate min_gen1_size 2.354 *gen0_size_ptr = heap_size - min_gen1_size; 2.355 *gen0_size_ptr = 2.356 - MAX2((uintx)align_size_down(*gen0_size_ptr, min_alignment()), 2.357 - min_alignment()); 2.358 + MAX2((uintx)align_size_down(*gen0_size_ptr, _min_alignment), _min_alignment); 2.359 assert(*gen0_size_ptr > 0, "Min gen0 is too large"); 2.360 result = true; 2.361 } else { 2.362 *gen1_size_ptr = heap_size - *gen0_size_ptr; 2.363 *gen1_size_ptr = 2.364 - MAX2((uintx)align_size_down(*gen1_size_ptr, min_alignment()), 2.365 - min_alignment()); 2.366 + MAX2((uintx)align_size_down(*gen1_size_ptr, _min_alignment), _min_alignment); 2.367 } 2.368 } 2.369 return result; 2.370 @@ -480,10 +472,9 @@ 2.371 // The maximum gen1 size can be determined from the maximum gen0 2.372 // and maximum heap size since no explicit flags exits 2.373 // for setting the gen1 maximum. 2.374 - _max_gen1_size = max_heap_byte_size() - _max_gen0_size; 2.375 + _max_gen1_size = _max_heap_byte_size - _max_gen0_size; 2.376 _max_gen1_size = 2.377 - MAX2((uintx)align_size_down(_max_gen1_size, min_alignment()), 2.378 - min_alignment()); 2.379 + MAX2((uintx)align_size_down(_max_gen1_size, _min_alignment), _min_alignment); 2.380 // If no explicit command line flag has been set for the 2.381 // gen1 size, use what is left for gen1. 2.382 if (FLAG_IS_DEFAULT(OldSize) || FLAG_IS_ERGO(OldSize)) { 2.383 @@ -492,70 +483,66 @@ 2.384 // with the overall heap size). In either case make 2.385 // the minimum, maximum and initial sizes consistent 2.386 // with the gen0 sizes and the overall heap sizes. 2.387 - assert(min_heap_byte_size() > _min_gen0_size, 2.388 + assert(_min_heap_byte_size > _min_gen0_size, 2.389 "gen0 has an unexpected minimum size"); 2.390 - set_min_gen1_size(min_heap_byte_size() - min_gen0_size()); 2.391 - set_min_gen1_size( 2.392 - MAX2((uintx)align_size_down(_min_gen1_size, min_alignment()), 2.393 - min_alignment())); 2.394 - set_initial_gen1_size(initial_heap_byte_size() - initial_gen0_size()); 2.395 - set_initial_gen1_size( 2.396 - MAX2((uintx)align_size_down(_initial_gen1_size, min_alignment()), 2.397 - min_alignment())); 2.398 - 2.399 + _min_gen1_size = _min_heap_byte_size - _min_gen0_size; 2.400 + _min_gen1_size = 2.401 + MAX2((uintx)align_size_down(_min_gen1_size, _min_alignment), _min_alignment); 2.402 + _initial_gen1_size = _initial_heap_byte_size - _initial_gen0_size; 2.403 + _initial_gen1_size = 2.404 + MAX2((uintx)align_size_down(_initial_gen1_size, _min_alignment), _min_alignment); 2.405 } else { 2.406 // It's been explicitly set on the command line. Use the 2.407 // OldSize and then determine the consequences. 2.408 - set_min_gen1_size(OldSize); 2.409 - set_initial_gen1_size(OldSize); 2.410 + _min_gen1_size = OldSize; 2.411 + _initial_gen1_size = OldSize; 2.412 2.413 // If the user has explicitly set an OldSize that is inconsistent 2.414 // with other command line flags, issue a warning. 2.415 // The generation minimums and the overall heap mimimum should 2.416 // be within one heap alignment. 2.417 - if ((_min_gen1_size + _min_gen0_size + min_alignment()) < 2.418 - min_heap_byte_size()) { 2.419 + if ((_min_gen1_size + _min_gen0_size + _min_alignment) < _min_heap_byte_size) { 2.420 warning("Inconsistency between minimum heap size and minimum " 2.421 - "generation sizes: using minimum heap = " SIZE_FORMAT, 2.422 - min_heap_byte_size()); 2.423 + "generation sizes: using minimum heap = " SIZE_FORMAT, 2.424 + _min_heap_byte_size); 2.425 } 2.426 if ((OldSize > _max_gen1_size)) { 2.427 warning("Inconsistency between maximum heap size and maximum " 2.428 - "generation sizes: using maximum heap = " SIZE_FORMAT 2.429 - " -XX:OldSize flag is being ignored", 2.430 - max_heap_byte_size()); 2.431 + "generation sizes: using maximum heap = " SIZE_FORMAT 2.432 + " -XX:OldSize flag is being ignored", 2.433 + _max_heap_byte_size); 2.434 } 2.435 // If there is an inconsistency between the OldSize and the minimum and/or 2.436 // initial size of gen0, since OldSize was explicitly set, OldSize wins. 2.437 if (adjust_gen0_sizes(&_min_gen0_size, &_min_gen1_size, 2.438 - min_heap_byte_size(), OldSize)) { 2.439 + _min_heap_byte_size, OldSize)) { 2.440 if (PrintGCDetails && Verbose) { 2.441 gclog_or_tty->print_cr("2: Minimum gen0 " SIZE_FORMAT " Initial gen0 " 2.442 SIZE_FORMAT " Maximum gen0 " SIZE_FORMAT, 2.443 - min_gen0_size(), initial_gen0_size(), max_gen0_size()); 2.444 + _min_gen0_size, _initial_gen0_size, _max_gen0_size); 2.445 } 2.446 } 2.447 // Initial size 2.448 if (adjust_gen0_sizes(&_initial_gen0_size, &_initial_gen1_size, 2.449 - initial_heap_byte_size(), OldSize)) { 2.450 + _initial_heap_byte_size, OldSize)) { 2.451 if (PrintGCDetails && Verbose) { 2.452 gclog_or_tty->print_cr("3: Minimum gen0 " SIZE_FORMAT " Initial gen0 " 2.453 SIZE_FORMAT " Maximum gen0 " SIZE_FORMAT, 2.454 - min_gen0_size(), initial_gen0_size(), max_gen0_size()); 2.455 + _min_gen0_size, _initial_gen0_size, _max_gen0_size); 2.456 } 2.457 } 2.458 } 2.459 // Enforce the maximum gen1 size. 2.460 - set_min_gen1_size(MIN2(_min_gen1_size, _max_gen1_size)); 2.461 + _min_gen1_size = MIN2(_min_gen1_size, _max_gen1_size); 2.462 2.463 // Check that min gen1 <= initial gen1 <= max gen1 2.464 - set_initial_gen1_size(MAX2(_initial_gen1_size, _min_gen1_size)); 2.465 - set_initial_gen1_size(MIN2(_initial_gen1_size, _max_gen1_size)); 2.466 + _initial_gen1_size = MAX2(_initial_gen1_size, _min_gen1_size); 2.467 + _initial_gen1_size = MIN2(_initial_gen1_size, _max_gen1_size); 2.468 2.469 if (PrintGCDetails && Verbose) { 2.470 gclog_or_tty->print_cr("Minimum gen1 " SIZE_FORMAT " Initial gen1 " 2.471 SIZE_FORMAT " Maximum gen1 " SIZE_FORMAT, 2.472 - min_gen1_size(), initial_gen1_size(), max_gen1_size()); 2.473 + _min_gen1_size, _initial_gen1_size, _max_gen1_size); 2.474 } 2.475 } 2.476
3.1 --- a/src/share/vm/memory/collectorPolicy.hpp Thu Oct 03 17:16:23 2013 +0200 3.2 +++ b/src/share/vm/memory/collectorPolicy.hpp Thu Oct 03 21:36:29 2013 +0200 3.3 @@ -101,17 +101,12 @@ 3.4 // Return maximum heap alignment that may be imposed by the policy 3.5 static size_t compute_max_alignment(); 3.6 3.7 - void set_min_alignment(size_t align) { _min_alignment = align; } 3.8 size_t min_alignment() { return _min_alignment; } 3.9 - void set_max_alignment(size_t align) { _max_alignment = align; } 3.10 size_t max_alignment() { return _max_alignment; } 3.11 3.12 size_t initial_heap_byte_size() { return _initial_heap_byte_size; } 3.13 - void set_initial_heap_byte_size(size_t v) { _initial_heap_byte_size = v; } 3.14 size_t max_heap_byte_size() { return _max_heap_byte_size; } 3.15 - void set_max_heap_byte_size(size_t v) { _max_heap_byte_size = v; } 3.16 size_t min_heap_byte_size() { return _min_heap_byte_size; } 3.17 - void set_min_heap_byte_size(size_t v) { _min_heap_byte_size = v; } 3.18 3.19 enum Name { 3.20 CollectorPolicyKind, 3.21 @@ -248,12 +243,9 @@ 3.22 3.23 public: 3.24 // Accessors 3.25 - size_t min_gen0_size() { return _min_gen0_size; } 3.26 - void set_min_gen0_size(size_t v) { _min_gen0_size = v; } 3.27 + size_t min_gen0_size() { return _min_gen0_size; } 3.28 size_t initial_gen0_size() { return _initial_gen0_size; } 3.29 - void set_initial_gen0_size(size_t v) { _initial_gen0_size = v; } 3.30 - size_t max_gen0_size() { return _max_gen0_size; } 3.31 - void set_max_gen0_size(size_t v) { _max_gen0_size = v; } 3.32 + size_t max_gen0_size() { return _max_gen0_size; } 3.33 3.34 virtual int number_of_generations() = 0; 3.35 3.36 @@ -302,12 +294,9 @@ 3.37 3.38 public: 3.39 // Accessors 3.40 - size_t min_gen1_size() { return _min_gen1_size; } 3.41 - void set_min_gen1_size(size_t v) { _min_gen1_size = v; } 3.42 + size_t min_gen1_size() { return _min_gen1_size; } 3.43 size_t initial_gen1_size() { return _initial_gen1_size; } 3.44 - void set_initial_gen1_size(size_t v) { _initial_gen1_size = v; } 3.45 - size_t max_gen1_size() { return _max_gen1_size; } 3.46 - void set_max_gen1_size(size_t v) { _max_gen1_size = v; } 3.47 + size_t max_gen1_size() { return _max_gen1_size; } 3.48 3.49 // Inherited methods 3.50 TwoGenerationCollectorPolicy* as_two_generation_policy() { return this; }