Skip to content

Commit

Permalink
8309265: Serial: Remove the code related to GC overheap limit
Browse files Browse the repository at this point in the history
Reviewed-by: ayang, tschatzl
  • Loading branch information
lgxbslgx committed Jun 3, 2023
1 parent 61bb014 commit 6edd786
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 30 deletions.
31 changes: 3 additions & 28 deletions src/hotspot/share/gc/shared/genCollectedHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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;
}
Expand Down
3 changes: 1 addition & 2 deletions src/hotspot/share/gc/shared/genCollectedHeap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

1 comment on commit 6edd786

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.