8241825: Make compressed oops and compressed class pointers independent (x86_64, PPC, S390)

Reviewed-by: coleenp, fparain, stuefe, mdoerr
This commit is contained in:
Erik Österlund 2020-05-13 09:36:12 +00:00
parent 9651edd247
commit 382e5dc334
39 changed files with 407 additions and 309 deletions

View file

@ -1666,7 +1666,9 @@ void Arguments::set_use_compressed_oops() {
if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) {
warning("Max heap size too large for Compressed Oops");
FLAG_SET_DEFAULT(UseCompressedOops, false);
FLAG_SET_DEFAULT(UseCompressedClassPointers, false);
if (COMPRESSED_CLASS_POINTERS_DEPENDS_ON_COMPRESSED_OOPS) {
FLAG_SET_DEFAULT(UseCompressedClassPointers, false);
}
}
}
#endif // _LP64
@ -1679,8 +1681,14 @@ void Arguments::set_use_compressed_oops() {
void Arguments::set_use_compressed_klass_ptrs() {
#ifndef ZERO
#ifdef _LP64
// UseCompressedOops must be on for UseCompressedClassPointers to be on.
if (!UseCompressedOops) {
// On some architectures, the use of UseCompressedClassPointers implies the use of
// UseCompressedOops. The reason is that the rheap_base register of said platforms
// is reused to perform some optimized spilling, in order to use rheap_base as a
// temp register. But by treating it as any other temp register, spilling can typically
// be completely avoided instead. So it is better not to perform this trick. And by
// not having that reliance, large heaps, or heaps not supporting compressed oops,
// can still use compressed class pointers.
if (COMPRESSED_CLASS_POINTERS_DEPENDS_ON_COMPRESSED_OOPS && !UseCompressedOops) {
if (UseCompressedClassPointers) {
warning("UseCompressedClassPointers requires UseCompressedOops");
}
@ -1809,10 +1817,7 @@ void Arguments::set_heap_size() {
}
#ifdef _LP64
if (UseCompressedOops) {
// Limit the heap size to the maximum possible when using compressed oops
julong max_coop_heap = (julong)max_heap_for_compressed_oops();
if (UseCompressedOops || UseCompressedClassPointers) {
// HeapBaseMinAddress can be greater than default but not less than.
if (!FLAG_IS_DEFAULT(HeapBaseMinAddress)) {
if (HeapBaseMinAddress < DefaultHeapBaseMinAddress) {
@ -1825,6 +1830,10 @@ void Arguments::set_heap_size() {
FLAG_SET_ERGO(HeapBaseMinAddress, DefaultHeapBaseMinAddress);
}
}
}
if (UseCompressedOops) {
// Limit the heap size to the maximum possible when using 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
@ -1843,7 +1852,9 @@ void Arguments::set_heap_size() {
"Please check the setting of MaxRAMPercentage %5.2f."
,(size_t)reasonable_max, (size_t)max_coop_heap, MaxRAMPercentage);
FLAG_SET_ERGO(UseCompressedOops, false);
FLAG_SET_ERGO(UseCompressedClassPointers, false);
if (COMPRESSED_CLASS_POINTERS_DEPENDS_ON_COMPRESSED_OOPS) {
FLAG_SET_ERGO(UseCompressedClassPointers, false);
}
} else {
reasonable_max = MIN2(reasonable_max, max_coop_heap);
}