< prev index next >
src/hotspot/share/gc/g1/vm_operations_g1.cpp
8195158: Concurrent System.gc() is "upgraded" to stop-the-world System.gc()
if (_pause_succeeded) {
if (_word_size > 0) {
// An allocation had been requested. Do it, eventually trying a stronger
// kind of GC.
_result = g1h->satisfy_failed_allocation(_word_size, _allocation_context, &_pause_succeeded);
! } else if (!g1h->has_regions_left_for_allocation()) {
! // 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 maximally compacting full GC.
! log_info(gc, ergo)("Attempting maximally compacting collection");
! _pause_succeeded = g1h->do_full_collection(false, /* explicit gc */
! true /* clear_all_soft_refs */);
}
guarantee(_pause_succeeded, "Elevated collections during the safepoint must always succeed.");
} else {
assert(_result == NULL, "invariant");
// The only reason for the pause to not be successful is that, the GC locker is
if (_pause_succeeded) {
if (_word_size > 0) {
// An allocation had been requested. Do it, eventually trying a stronger
// kind of GC.
_result = g1h->satisfy_failed_allocation(_word_size, _allocation_context, &_pause_succeeded);
! } else {
! bool should_upgrade_to_full = !g1h->should_do_concurrent_full_gc(_gc_cause) &&
! !g1h->has_regions_left_for_allocation();
! if (should_upgrade_to_full) {
! // 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 maximally compacting full GC.
! log_info(gc, ergo)("Attempting maximally compacting collection");
! _pause_succeeded = g1h->do_full_collection(false, /* explicit gc */
! true /* clear_all_soft_refs */);
! }
}
guarantee(_pause_succeeded, "Elevated collections during the safepoint must always succeed.");
} else {
assert(_result == NULL, "invariant");
// The only reason for the pause to not be successful is that, the GC locker is
< prev index next >