Mercurial > hg > graal-compiler
diff 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 |
line wrap: on
line diff
--- a/src/share/vm/memory/collectorPolicy.cpp Fri May 10 11:27:55 2013 -0700 +++ b/src/share/vm/memory/collectorPolicy.cpp Mon May 13 09:45:33 2013 +0200 @@ -264,6 +264,27 @@ // need to do this again MaxHeapSize = align_size_up(MaxHeapSize, max_alignment()); + // adjust max heap size if necessary + if (NewSize + OldSize > MaxHeapSize) { + if (FLAG_IS_CMDLINE(MaxHeapSize)) { + // somebody set a maximum heap size with the intention that we should not + // exceed it. Adjust New/OldSize as necessary. + uintx calculated_size = NewSize + OldSize; + double shrink_factor = (double) MaxHeapSize / calculated_size; + // align + NewSize = align_size_down((uintx) (NewSize * shrink_factor), min_alignment()); + // OldSize is already aligned because above we aligned MaxHeapSize to + // max_alignment(), and we just made sure that NewSize is aligned to + // min_alignment(). In initialize_flags() we verified that max_alignment() + // is a multiple of min_alignment(). + OldSize = MaxHeapSize - NewSize; + } else { + MaxHeapSize = NewSize + OldSize; + } + } + // need to do this again + MaxHeapSize = align_size_up(MaxHeapSize, max_alignment()); + always_do_update_barrier = UseConcMarkSweepGC; // Check validity of heap flags