< prev index next >
src/hotspot/share/gc/g1/g1VMOperations.cpp
Print this page
rev 53920 : imported patch 8218880-g1-crashes-periodic-gc-gclocker
rev 53921 : [mq]: 8218880-shade-review
*** 34,53 ****
#include "runtime/interfaceSupport.inline.hpp"
void VM_G1CollectFull::doit() {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
GCCauseSetter x(g1h, _gc_cause);
! _pause_succeeded = g1h->do_full_collection(true /* explicit_gc */, false /* clear_all_soft_refs */);
}
VM_G1CollectForAllocation::VM_G1CollectForAllocation(size_t word_size,
uint gc_count_before,
GCCause::Cause gc_cause,
bool should_initiate_conc_mark,
double target_pause_time_ms) :
VM_CollectForAllocation(word_size, gc_count_before, gc_cause),
! _pause_succeeded(false),
_should_initiate_conc_mark(should_initiate_conc_mark),
_should_retry_gc(false),
_target_pause_time_ms(target_pause_time_ms),
_old_marking_cycles_completed_before(0) {
--- 34,53 ----
#include "runtime/interfaceSupport.inline.hpp"
void VM_G1CollectFull::doit() {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
GCCauseSetter x(g1h, _gc_cause);
! _gc_succeeded = g1h->do_full_collection(true /* explicit_gc */, false /* clear_all_soft_refs */);
}
VM_G1CollectForAllocation::VM_G1CollectForAllocation(size_t word_size,
uint gc_count_before,
GCCause::Cause gc_cause,
bool should_initiate_conc_mark,
double target_pause_time_ms) :
VM_CollectForAllocation(word_size, gc_count_before, gc_cause),
! _gc_succeeded(false),
_should_initiate_conc_mark(should_initiate_conc_mark),
_should_retry_gc(false),
_target_pause_time_ms(target_pause_time_ms),
_old_marking_cycles_completed_before(0) {
*** 83,93 ****
_result = g1h->attempt_allocation_at_safepoint(_word_size,
false /* expect_null_cur_alloc_region */);
if (_result != NULL) {
// If we can successfully allocate before we actually do the
// pause then we will consider this pause successful.
! _pause_succeeded = true;
return;
}
}
GCCauseSetter x(g1h, _gc_cause);
--- 83,93 ----
_result = g1h->attempt_allocation_at_safepoint(_word_size,
false /* expect_null_cur_alloc_region */);
if (_result != NULL) {
// If we can successfully allocate before we actually do the
// pause then we will consider this pause successful.
! _gc_succeeded = true;
return;
}
}
GCCauseSetter x(g1h, _gc_cause);
*** 128,157 ****
return;
}
}
// Try a partial collection of some kind.
! _pause_succeeded = g1h->do_collection_pause_at_safepoint(_target_pause_time_ms);
! 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, &_pause_succeeded);
} else {
bool should_upgrade_to_full = g1h->should_upgrade_to_full_gc(_gc_cause);
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
// active (or has become active since the prologue was executed). In this case
// we should retry the pause after waiting for the GC locker to become inactive.
--- 128,157 ----
return;
}
}
// Try a partial collection of some kind.
! _gc_succeeded = g1h->do_collection_pause_at_safepoint(_target_pause_time_ms);
! if (_gc_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, &_gc_succeeded);
} else {
bool should_upgrade_to_full = g1h->should_upgrade_to_full_gc(_gc_cause);
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");
! _gc_succeeded = g1h->do_full_collection(false, /* explicit gc */
true /* clear_all_soft_refs */);
}
}
! guarantee(_gc_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
// active (or has become active since the prologue was executed). In this case
// we should retry the pause after waiting for the GC locker to become inactive.
< prev index next >