comparison src/share/vm/memory/collectorPolicy.cpp @ 10284:7a95933197d0

8014058: Regression tests for 8006088 Summary: The patch for 8006088 misses regression tests after a merge error, this CR provides them. Reviewed-by: jwilhelm, tamao, jmasa
author tschatzl
date Mon, 13 May 2013 09:45:33 +0200
parents d17700c82d7d
children 12f651e29f6b
comparison
equal deleted inserted replaced
10251:6114c49b31b5 10284:7a95933197d0
239 239
240 calculated_heapsize = align_size_up(calculated_heapsize, max_alignment()); 240 calculated_heapsize = align_size_up(calculated_heapsize, max_alignment());
241 MaxHeapSize = calculated_heapsize; 241 MaxHeapSize = calculated_heapsize;
242 InitialHeapSize = calculated_heapsize; 242 InitialHeapSize = calculated_heapsize;
243 } 243 }
244 MaxHeapSize = align_size_up(MaxHeapSize, max_alignment());
245
246 // adjust max heap size if necessary
247 if (NewSize + OldSize > MaxHeapSize) {
248 if (FLAG_IS_CMDLINE(MaxHeapSize)) {
249 // somebody set a maximum heap size with the intention that we should not
250 // exceed it. Adjust New/OldSize as necessary.
251 uintx calculated_size = NewSize + OldSize;
252 double shrink_factor = (double) MaxHeapSize / calculated_size;
253 // align
254 NewSize = align_size_down((uintx) (NewSize * shrink_factor), min_alignment());
255 // OldSize is already aligned because above we aligned MaxHeapSize to
256 // max_alignment(), and we just made sure that NewSize is aligned to
257 // min_alignment(). In initialize_flags() we verified that max_alignment()
258 // is a multiple of min_alignment().
259 OldSize = MaxHeapSize - NewSize;
260 } else {
261 MaxHeapSize = NewSize + OldSize;
262 }
263 }
264 // need to do this again
244 MaxHeapSize = align_size_up(MaxHeapSize, max_alignment()); 265 MaxHeapSize = align_size_up(MaxHeapSize, max_alignment());
245 266
246 // adjust max heap size if necessary 267 // adjust max heap size if necessary
247 if (NewSize + OldSize > MaxHeapSize) { 268 if (NewSize + OldSize > MaxHeapSize) {
248 if (FLAG_IS_CMDLINE(MaxHeapSize)) { 269 if (FLAG_IS_CMDLINE(MaxHeapSize)) {