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