1599 }
1600 }
1601
1602 size_t Arguments::max_heap_for_compressed_oops() {
1603 // Avoid sign flip.
1604 assert(OopEncodingHeapMax > (uint64_t)os::vm_page_size(), "Unusual page size");
1605 // We need to fit both the NULL page and the heap into the memory budget, while
1606 // keeping alignment constraints of the heap. To guarantee the latter, as the
1607 // NULL page is located before the heap, we pad the NULL page to the conservative
1608 // maximum alignment that the GC may ever impose upon the heap.
1609 size_t displacement_due_to_null_page = align_up((size_t)os::vm_page_size(),
1610 _conservative_max_heap_alignment);
1611
1612 LP64_ONLY(return OopEncodingHeapMax - displacement_due_to_null_page);
1613 NOT_LP64(ShouldNotReachHere(); return 0);
1614 }
1615
1616 void Arguments::set_use_compressed_oops() {
1617 #ifndef ZERO
1618 #ifdef _LP64
1619 // MaxHeapSize is not set up properly at this point, but
1620 // the only value that can override MaxHeapSize if we are
1621 // to use UseCompressedOops is InitialHeapSize.
1622 size_t max_heap_size = MAX2(MaxHeapSize, InitialHeapSize);
1623
1624 if (max_heap_size <= max_heap_for_compressed_oops()) {
1625 #if !defined(COMPILER1) || defined(TIERED)
1626 if (FLAG_IS_DEFAULT(UseCompressedOops)) {
1627 FLAG_SET_ERGO(bool, UseCompressedOops, true);
1628 }
1629 #endif
1630 } else {
1631 if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) {
1632 warning("Max heap size too large for Compressed Oops");
1633 FLAG_SET_DEFAULT(UseCompressedOops, false);
1634 FLAG_SET_DEFAULT(UseCompressedClassPointers, false);
1635 }
1636 }
1637 #endif // _LP64
1638 #endif // ZERO
|
1599 }
1600 }
1601
1602 size_t Arguments::max_heap_for_compressed_oops() {
1603 // Avoid sign flip.
1604 assert(OopEncodingHeapMax > (uint64_t)os::vm_page_size(), "Unusual page size");
1605 // We need to fit both the NULL page and the heap into the memory budget, while
1606 // keeping alignment constraints of the heap. To guarantee the latter, as the
1607 // NULL page is located before the heap, we pad the NULL page to the conservative
1608 // maximum alignment that the GC may ever impose upon the heap.
1609 size_t displacement_due_to_null_page = align_up((size_t)os::vm_page_size(),
1610 _conservative_max_heap_alignment);
1611
1612 LP64_ONLY(return OopEncodingHeapMax - displacement_due_to_null_page);
1613 NOT_LP64(ShouldNotReachHere(); return 0);
1614 }
1615
1616 void Arguments::set_use_compressed_oops() {
1617 #ifndef ZERO
1618 #ifdef _LP64
1619 if(AllocateOldGenAt != NULL) {
1620 FLAG_SET_ERGO(bool, UseCompressedOops, false);
1621 return;
1622 }
1623 // MaxHeapSize is not set up properly at this point, but
1624 // the only value that can override MaxHeapSize if we are
1625 // to use UseCompressedOops is InitialHeapSize.
1626 size_t max_heap_size = MAX2(MaxHeapSize, InitialHeapSize);
1627
1628 if (max_heap_size <= max_heap_for_compressed_oops()) {
1629 #if !defined(COMPILER1) || defined(TIERED)
1630 if (FLAG_IS_DEFAULT(UseCompressedOops)) {
1631 FLAG_SET_ERGO(bool, UseCompressedOops, true);
1632 }
1633 #endif
1634 } else {
1635 if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) {
1636 warning("Max heap size too large for Compressed Oops");
1637 FLAG_SET_DEFAULT(UseCompressedOops, false);
1638 FLAG_SET_DEFAULT(UseCompressedClassPointers, false);
1639 }
1640 }
1641 #endif // _LP64
1642 #endif // ZERO
|