8358313: G1: Refactor G1CollectedHeap::is_maximal_no_gc
Reviewed-by: jsikstro, tschatzl
This commit is contained in:
parent
6cfd4057dc
commit
dbf562c725
@ -1004,7 +1004,7 @@ bool G1CollectedHeap::expand(size_t expand_bytes, WorkerThreads* pretouch_worker
|
|||||||
log_debug(gc, ergo, heap)("Expand the heap. requested expansion amount: %zuB expansion amount: %zuB",
|
log_debug(gc, ergo, heap)("Expand the heap. requested expansion amount: %zuB expansion amount: %zuB",
|
||||||
expand_bytes, aligned_expand_bytes);
|
expand_bytes, aligned_expand_bytes);
|
||||||
|
|
||||||
if (is_maximal_no_gc()) {
|
if (num_inactive_regions() == 0) {
|
||||||
log_debug(gc, ergo, heap)("Did not expand the heap (heap already fully expanded)");
|
log_debug(gc, ergo, heap)("Did not expand the heap (heap already fully expanded)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1031,7 +1031,7 @@ bool G1CollectedHeap::expand_single_region(uint node_index) {
|
|||||||
uint expanded_by = _hrm.expand_on_preferred_node(node_index);
|
uint expanded_by = _hrm.expand_on_preferred_node(node_index);
|
||||||
|
|
||||||
if (expanded_by == 0) {
|
if (expanded_by == 0) {
|
||||||
assert(is_maximal_no_gc(), "Should be no regions left, available: %u", _hrm.num_inactive_regions());
|
assert(num_inactive_regions() == 0, "Should be no regions left, available: %u", num_inactive_regions());
|
||||||
log_debug(gc, ergo, heap)("Did not expand the heap (heap already fully expanded)");
|
log_debug(gc, ergo, heap)("Did not expand the heap (heap already fully expanded)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -966,16 +966,15 @@ public:
|
|||||||
// end fields defining the extent of the contiguous allocation region.)
|
// end fields defining the extent of the contiguous allocation region.)
|
||||||
// But G1CollectedHeap doesn't yet support this.
|
// But G1CollectedHeap doesn't yet support this.
|
||||||
|
|
||||||
bool is_maximal_no_gc() const {
|
|
||||||
return _hrm.num_inactive_regions() == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns true if an incremental GC should be upgrade to a full gc. This
|
// 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.
|
// is done when there are no free regions and the heap can't be expanded.
|
||||||
bool should_upgrade_to_full_gc() const {
|
bool should_upgrade_to_full_gc() const {
|
||||||
return is_maximal_no_gc() && num_free_regions() == 0;
|
return num_inactive_regions() == 0 && num_free_regions() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The number of inactive regions.
|
||||||
|
uint num_inactive_regions() const { return _hrm.num_inactive_regions(); }
|
||||||
|
|
||||||
// The current number of regions in the heap.
|
// The current number of regions in the heap.
|
||||||
uint num_committed_regions() const { return _hrm.num_committed_regions(); }
|
uint num_committed_regions() const { return _hrm.num_committed_regions(); }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user