6984368: Large default heap size does not allow to use zero based compressed oops
authorkvn
Tue, 14 Sep 2010 17:19:35 -0700
changeset 6465 514cf4924008
parent 6464 cd40daf5b832
child 6466 ef740a24d777
6984368: Large default heap size does not allow to use zero based compressed oops Summary: take into account HeapBaseMinAddress and round down MaxPermSize Reviewed-by: never
hotspot/src/share/vm/memory/collectorPolicy.cpp
hotspot/src/share/vm/runtime/arguments.cpp
--- a/hotspot/src/share/vm/memory/collectorPolicy.cpp	Tue Sep 14 14:09:24 2010 -0700
+++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp	Tue Sep 14 17:19:35 2010 -0700
@@ -32,7 +32,11 @@
     MaxPermSize = PermSize;
   }
   PermSize = MAX2(min_alignment(), align_size_down_(PermSize, min_alignment()));
-  MaxPermSize = align_size_up(MaxPermSize, max_alignment());
+  // Don't increase Perm size limit above specified.
+  MaxPermSize = align_size_down(MaxPermSize, max_alignment());
+  if (PermSize > MaxPermSize) {
+    PermSize = MaxPermSize;
+  }
 
   MinPermHeapExpansion = MAX2(min_alignment(), align_size_down_(MinPermHeapExpansion, min_alignment()));
   MaxPermHeapExpansion = MAX2(min_alignment(), align_size_down_(MaxPermHeapExpansion, min_alignment()));
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Tue Sep 14 14:09:24 2010 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Tue Sep 14 17:19:35 2010 -0700
@@ -1273,7 +1273,8 @@
 }
 
 inline uintx max_heap_for_compressed_oops() {
-  LP64_ONLY(return OopEncodingHeapMax - MaxPermSize - os::vm_page_size());
+  // Heap should be above HeapBaseMinAddress to get zero based compressed oops.
+  LP64_ONLY(return OopEncodingHeapMax - MaxPermSize - os::vm_page_size() - HeapBaseMinAddress);
   NOT_LP64(ShouldNotReachHere(); return 0);
 }