8231395: Backout JDK-8231249

Reviewed-by: tschatzl
This commit is contained in:
Aleksey Shipilev 2019-09-24 09:38:14 +02:00
parent 23ec926327
commit 23ae4b93c8

View File

@ -809,12 +809,22 @@ HeapWord* ShenandoahHeap::allocate_memory(ShenandoahAllocRequest& req) {
// way later after GC happened, only to fail the second allocation, because
// other threads have already depleted the free storage. In this case, a better
// strategy is to try again, as long as GC makes progress.
//
// Then, we need to make sure the allocation was retried after at least one
// Full GC, which means we want to try more than ShenandoahFullGCThreshold times.
if (result == NULL) {
do {
control_thread()->handle_alloc_failure(req.size());
result = allocate_memory_under_lock(req, in_new_region);
} while (result == NULL && _progress_last_gc.is_set());
size_t tries = 0;
while (result == NULL && _progress_last_gc.is_set()) {
tries++;
control_thread()->handle_alloc_failure(req.size());
result = allocate_memory_under_lock(req, in_new_region);
}
while (result == NULL && tries <= ShenandoahFullGCThreshold) {
tries++;
control_thread()->handle_alloc_failure(req.size());
result = allocate_memory_under_lock(req, in_new_region);
}
} else {