From 6edd786bf6d8b1008a292b26fc0f901cbae1d03b Mon Sep 17 00:00:00 2001 From: Guoxiong Li Date: Sat, 3 Jun 2023 03:45:21 +0000 Subject: [PATCH] 8309265: Serial: Remove the code related to GC overheap limit Reviewed-by: ayang, tschatzl --- .../share/gc/shared/genCollectedHeap.cpp | 31 ++----------------- .../share/gc/shared/genCollectedHeap.hpp | 3 +- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/src/hotspot/share/gc/shared/genCollectedHeap.cpp b/src/hotspot/share/gc/shared/genCollectedHeap.cpp index 42f174d10de85..36f229ab817ec 100644 --- a/src/hotspot/share/gc/shared/genCollectedHeap.cpp +++ b/src/hotspot/share/gc/shared/genCollectedHeap.cpp @@ -278,12 +278,7 @@ HeapWord* GenCollectedHeap::expand_heap_and_allocate(size_t size, bool is_tlab } HeapWord* GenCollectedHeap::mem_allocate_work(size_t size, - bool is_tlab, - bool* gc_overhead_limit_was_exceeded) { - // In general gc_overhead_limit_was_exceeded should be false so - // set it so here and reset it to true only if the gc time - // limit is being exceeded as checked below. - *gc_overhead_limit_was_exceeded = false; + bool is_tlab) { HeapWord* result = nullptr; @@ -365,23 +360,6 @@ HeapWord* GenCollectedHeap::mem_allocate_work(size_t size, continue; // Retry and/or stall as necessary. } - // Allocation has failed and a collection - // has been done. If the gc time limit was exceeded the - // this time, return null so that an out-of-memory - // will be thrown. Clear gc_overhead_limit_exceeded - // so that the overhead exceeded does not persist. - - const bool limit_exceeded = size_policy()->gc_overhead_limit_exceeded(); - const bool softrefs_clear = soft_ref_policy()->all_soft_refs_clear(); - - if (limit_exceeded && softrefs_clear) { - *gc_overhead_limit_was_exceeded = true; - size_policy()->set_gc_overhead_limit_exceeded(false); - if (op.result() != nullptr) { - CollectedHeap::fill_with_object(op.result(), size); - } - return nullptr; - } assert(result == nullptr || is_in_reserved(result), "result not in heap"); return result; @@ -418,8 +396,7 @@ HeapWord* GenCollectedHeap::attempt_allocation(size_t size, HeapWord* GenCollectedHeap::mem_allocate(size_t size, bool* gc_overhead_limit_was_exceeded) { return mem_allocate_work(size, - false /* is_tlab */, - gc_overhead_limit_was_exceeded); + false /* is_tlab */); } bool GenCollectedHeap::must_clear_all_soft_refs() { @@ -935,10 +912,8 @@ size_t GenCollectedHeap::unsafe_max_tlab_alloc(Thread* thr) const { HeapWord* GenCollectedHeap::allocate_new_tlab(size_t min_size, size_t requested_size, size_t* actual_size) { - bool gc_overhead_limit_was_exceeded; HeapWord* result = mem_allocate_work(requested_size /* size */, - true /* is_tlab */, - &gc_overhead_limit_was_exceeded); + true /* is_tlab */); if (result != nullptr) { *actual_size = requested_size; } diff --git a/src/hotspot/share/gc/shared/genCollectedHeap.hpp b/src/hotspot/share/gc/shared/genCollectedHeap.hpp index 2ab3da069f77f..f279c7588def2 100644 --- a/src/hotspot/share/gc/shared/genCollectedHeap.hpp +++ b/src/hotspot/share/gc/shared/genCollectedHeap.hpp @@ -376,8 +376,7 @@ class GenCollectedHeap : public CollectedHeap { HeapWord* expand_heap_and_allocate(size_t size, bool is_tlab); HeapWord* mem_allocate_work(size_t size, - bool is_tlab, - bool* gc_overhead_limit_was_exceeded); + bool is_tlab); #if INCLUDE_SERIALGC // For use by mark-sweep. As implemented, mark-sweep-compact is global