This commit is contained in:
Igor Veresov 2010-11-19 17:01:34 -08:00
commit 15c6dde68a
6 changed files with 30 additions and 19 deletions

View file

@ -1341,8 +1341,11 @@ bool verify_object_alignment() {
}
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);
}
@ -1520,7 +1523,13 @@ void Arguments::set_heap_size() {
}
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);