8224247: AllocateOldGenAt fires assertion failure

Split the heap_reserved_size_bytes() into two methods - one for use during heap initialization and other for at later stages.

Reviewed-by: sangheki, tschatzl
This commit is contained in:
Kishor Kharbas 2019-06-03 11:04:24 -07:00
parent f238aed808
commit f0f679de2a
7 changed files with 15 additions and 5 deletions

View File

@ -256,3 +256,7 @@ size_t G1Arguments::reasonable_max_memory_for_young() {
size_t G1Arguments::heap_reserved_size_bytes() {
return (is_heterogeneous_heap() ? 2 : 1) * MaxHeapSize;
}
size_t G1Arguments::heap_max_size_bytes() {
return MaxHeapSize;
}

View File

@ -53,6 +53,7 @@ public:
static bool is_heterogeneous_heap();
static size_t reasonable_max_memory_for_young();
static size_t heap_reserved_size_bytes();
static size_t heap_max_size_bytes();
};
#endif // SHARE_GC_G1_G1ARGUMENTS_HPP

View File

@ -70,7 +70,7 @@ HeapRegionManager::HeapRegionManager() :
HeapRegionManager* HeapRegionManager::create_manager(G1CollectedHeap* heap) {
if (G1Arguments::is_heterogeneous_heap()) {
return new HeterogeneousHeapRegionManager((uint)(G1Arguments::heap_reserved_size_bytes() / HeapRegion::GrainBytes) /*heap size as num of regions*/);
return new HeterogeneousHeapRegionManager((uint)(G1Arguments::heap_max_size_bytes() / HeapRegion::GrainBytes) /*heap size as num of regions*/);
}
return new HeapRegionManager();
}

View File

@ -38,7 +38,7 @@
// create ASPSOldGen and ASPSYoungGen the same way as in base class
AdjoiningGenerationsForHeteroHeap::AdjoiningGenerationsForHeteroHeap(ReservedSpace old_young_rs) :
_total_size_limit(ParallelArguments::heap_reserved_size_bytes()) {
_total_size_limit(ParallelArguments::heap_max_size_bytes()) {
size_t init_old_byte_size = OldSize;
size_t min_old_byte_size = MinOldSize;
size_t max_old_byte_size = MaxOldSize;
@ -85,9 +85,9 @@ AdjoiningGenerationsForHeteroHeap::AdjoiningGenerationsForHeteroHeap(ReservedSpa
size_t AdjoiningGenerationsForHeteroHeap::required_reserved_memory() {
// This is the size that young gen can grow to, when AdaptiveGCBoundary is true.
size_t max_yg_size = ParallelArguments::heap_reserved_size_bytes() - MinOldSize;
size_t max_yg_size = ParallelArguments::heap_max_size_bytes() - MinOldSize;
// This is the size that old gen can grow to, when AdaptiveGCBoundary is true.
size_t max_old_size = ParallelArguments::heap_reserved_size_bytes() - MinNewSize;
size_t max_old_size = ParallelArguments::heap_max_size_bytes() - MinNewSize;
return max_yg_size + max_old_size;
}

View File

@ -214,6 +214,10 @@ size_t ParallelArguments::heap_reserved_size_bytes() {
return max_yg_size + max_old_size;
}
size_t ParallelArguments::heap_max_size_bytes() {
return MaxHeapSize;
}
CollectedHeap* ParallelArguments::create_heap() {
return new ParallelScavengeHeap();
}

View File

@ -46,6 +46,7 @@ public:
// Heterogeneous heap support
static bool is_heterogeneous_heap();
static size_t heap_reserved_size_bytes();
static size_t heap_max_size_bytes();
};
#endif // SHARE_GC_PARALLEL_PARALLELARGUMENTS_HPP

View File

@ -518,7 +518,7 @@ WB_ENTRY(jlong, WB_DramReservedEnd(JNIEnv* env, jobject o))
uint end_region = HeterogeneousHeapRegionManager::manager()->end_index_of_dram();
return (jlong)(g1h->base() + (end_region + 1) * HeapRegion::GrainBytes - 1);
} else {
return (jlong)g1h->base() + G1Arguments::heap_reserved_size_bytes();
return (jlong)g1h->base() + G1Arguments::heap_max_size_bytes();
}
}
#endif // INCLUDE_G1GC