Mercurial > hg > truffle
diff src/share/vm/runtime/arguments.cpp @ 1963:0ac62b4d6507
6999491: non-zero COOPs are used when they should not
Summary: HeapBaseMinAddress should be used only for a default heap size calculation.
Reviewed-by: iveresov, jcoomes, dholmes
author | kvn |
---|---|
date | Fri, 12 Nov 2010 09:51:43 -0800 |
parents | 2db84614f61d |
children | 4110c3e0c50d |
line wrap: on
line diff
--- a/src/share/vm/runtime/arguments.cpp Tue Nov 09 17:31:18 2010 -0800 +++ b/src/share/vm/runtime/arguments.cpp Fri Nov 12 09:51:43 2010 -0800 @@ -1328,8 +1328,11 @@ } inline uintx max_heap_for_compressed_oops() { - // Heap should be above HeapBaseMinAddress to get zero based compressed oops. - LP64_ONLY(return OopEncodingHeapMax - MaxPermSize - os::vm_page_size() - HeapBaseMinAddress); + // Avoid sign flip. + if (OopEncodingHeapMax < MaxPermSize + os::vm_page_size()) { + return 0; + } + LP64_ONLY(return OopEncodingHeapMax - MaxPermSize - os::vm_page_size()); NOT_LP64(ShouldNotReachHere(); return 0); } @@ -1507,7 +1510,13 @@ } if (UseCompressedOops) { // Limit the heap size to the maximum possible when using compressed oops - reasonable_max = MIN2(reasonable_max, (julong)max_heap_for_compressed_oops()); + julong max_coop_heap = (julong)max_heap_for_compressed_oops(); + if (HeapBaseMinAddress + MaxHeapSize < max_coop_heap) { + // Heap should be above HeapBaseMinAddress to get zero based compressed oops + // but it should be not less than default MaxHeapSize. + max_coop_heap -= HeapBaseMinAddress; + } + reasonable_max = MIN2(reasonable_max, max_coop_heap); } reasonable_max = os::allocatable_physical_memory(reasonable_max);