Skip to content
Permalink
Browse files
Automatic merge of jdk:master into master
  • Loading branch information
duke committed Jun 10, 2021
2 parents c26c6f6 + f770f77 commit 205566c342a7bcadaec2d06db91108a406caeef5
Showing 3 changed files with 6 additions and 18 deletions.
@@ -1915,16 +1915,6 @@ bool G1CollectedHeap::should_do_concurrent_full_gc(GCCause::Cause cause) {
}
}

bool G1CollectedHeap::should_upgrade_to_full_gc(GCCause::Cause cause) {
if (should_do_concurrent_full_gc(_gc_cause)) {
return false;
} else if (has_regions_left_for_allocation()) {
return false;
} else {
return true;
}
}

#ifndef PRODUCT
void G1CollectedHeap::allocate_dummy_regions() {
// Let's fill up most of the region
@@ -285,9 +285,6 @@ class G1CollectedHeap : public CollectedHeap {
uint gc_counter,
uint old_marking_started_before);

// Return true if should upgrade to full gc after an incremental one.
bool should_upgrade_to_full_gc(GCCause::Cause cause);

// indicates whether we are in young or mixed GC mode
G1CollectorState _collector_state;

@@ -1089,9 +1086,10 @@ class G1CollectedHeap : public CollectedHeap {
return _hrm.available() == 0;
}

// Returns whether there are any regions left in the heap for allocation.
bool has_regions_left_for_allocation() const {
return !is_maximal_no_gc() || num_free_regions() != 0;
// Returns true if an incremental GC should be upgrade to a full gc. This
// is done when there are no free regions and the heap can't be expanded.
bool should_upgrade_to_full_gc() const {
return is_maximal_no_gc() && num_free_regions() == 0;
}

// The current number of regions in the heap.
@@ -100,7 +100,7 @@ void VM_G1TryInitiateConcMark::doit() {
// makes a later _gc_locker collection needed. (Else we would have hit
// the GCLocker check in the prologue.)
_transient_failure = true;
} else if (g1h->should_upgrade_to_full_gc(_gc_cause)) {
} else if (g1h->should_upgrade_to_full_gc()) {
_gc_succeeded = g1h->upgrade_to_full_collection();
} else {
_gc_succeeded = true;
@@ -150,7 +150,7 @@ void VM_G1CollectForAllocation::doit() {
// An allocation had been requested. Do it, eventually trying a stronger
// kind of GC.
_result = g1h->satisfy_failed_allocation(_word_size, &_gc_succeeded);
} else if (g1h->should_upgrade_to_full_gc(_gc_cause)) {
} else if (g1h->should_upgrade_to_full_gc()) {
// There has been a request to perform a GC to free some space. We have no
// information on how much memory has been asked for. In case there are
// absolutely no regions left to allocate into, do a full compaction.

0 comments on commit 205566c

Please sign in to comment.