8143251: HeapRetentionTest.java Test is failing on jdk9/dev

Reviewed-by: tschatzl, david
This commit is contained in:
Stefan Johansson 2015-11-26 13:13:03 +01:00
parent 884a2b65f2
commit 4b50caadef
4 changed files with 43 additions and 18 deletions

View File

@ -2287,15 +2287,21 @@ size_t G1CollectedHeap::recalculate_used() const {
return blk.result();
}
bool G1CollectedHeap::is_user_requested_concurrent_full_gc(GCCause::Cause cause) {
switch (cause) {
case GCCause::_java_lang_system_gc: return ExplicitGCInvokesConcurrent;
case GCCause::_dcmd_gc_run: return ExplicitGCInvokesConcurrent;
case GCCause::_update_allocation_context_stats_inc: return true;
case GCCause::_wb_conc_mark: return true;
default : return false;
}
}
bool G1CollectedHeap::should_do_concurrent_full_gc(GCCause::Cause cause) {
switch (cause) {
case GCCause::_gc_locker: return GCLockerInvokesConcurrent;
case GCCause::_java_lang_system_gc: return ExplicitGCInvokesConcurrent;
case GCCause::_dcmd_gc_run: return ExplicitGCInvokesConcurrent;
case GCCause::_g1_humongous_allocation: return true;
case GCCause::_update_allocation_context_stats_inc: return true;
case GCCause::_wb_conc_mark: return true;
default: return false;
default: return is_user_requested_concurrent_full_gc(cause);
}
}

View File

@ -245,9 +245,11 @@ private:
// instead of doing a STW GC. Currently, a concurrent cycle is
// explicitly started if:
// (a) cause == _gc_locker and +GCLockerInvokesConcurrent, or
// (b) cause == _java_lang_system_gc and +ExplicitGCInvokesConcurrent.
// (c) cause == _dcmd_gc_run and +ExplicitGCInvokesConcurrent.
// (d) cause == _g1_humongous_allocation
// (b) cause == _g1_humongous_allocation
// (c) cause == _java_lang_system_gc and +ExplicitGCInvokesConcurrent.
// (d) cause == _dcmd_gc_run and +ExplicitGCInvokesConcurrent.
// (e) cause == _update_allocation_context_stats_inc
// (f) cause == _wb_conc_mark
bool should_do_concurrent_full_gc(GCCause::Cause cause);
// indicates whether we are in young or mixed GC mode
@ -579,6 +581,8 @@ public:
_in_cset_fast_test.clear();
}
bool is_user_requested_concurrent_full_gc(GCCause::Cause cause);
// This is called at the start of either a concurrent cycle or a Full
// GC to update the number of old marking cycles started.
void increment_old_marking_cycles_started();

View File

@ -1710,6 +1710,11 @@ bool G1CollectorPolicy::force_initial_mark_if_outside_cycle(GCCause::Cause gc_ca
}
}
void G1CollectorPolicy::initiate_conc_mark() {
collector_state()->set_during_initial_mark_pause(true);
collector_state()->set_initiate_conc_mark_if_possible(false);
}
void G1CollectorPolicy::decide_on_conc_mark_initiation() {
// We are about to decide on whether this pause will be an
// initial-mark pause.
@ -1726,17 +1731,22 @@ void G1CollectorPolicy::decide_on_conc_mark_initiation() {
// concurrent marking cycle. So we might initiate one.
if (!about_to_start_mixed_phase() && collector_state()->gcs_are_young()) {
// Initiate a new initial mark only if there is no marking or reclamation going
// on.
collector_state()->set_during_initial_mark_pause(true);
// And we can now clear initiate_conc_mark_if_possible() as
// we've already acted on it.
collector_state()->set_initiate_conc_mark_if_possible(false);
// Initiate a new initial mark if there is no marking or reclamation going on.
initiate_conc_mark();
ergo_verbose0(ErgoConcCycles,
"initiate concurrent cycle",
ergo_format_reason("concurrent cycle initiation requested"));
"initiate concurrent cycle",
ergo_format_reason("concurrent cycle initiation requested"));
} else if (_g1->is_user_requested_concurrent_full_gc(_g1->gc_cause())) {
// Initiate a user requested initial mark. An initial mark must be young only
// GC, so the collector state must be updated to reflect this.
collector_state()->set_gcs_are_young(true);
collector_state()->set_last_young_gc(false);
abort_time_to_mixed_tracking();
initiate_conc_mark();
ergo_verbose0(ErgoConcCycles,
"initiate concurrent cycle",
ergo_format_reason("user requested concurrent cycle"));
} else {
// The concurrent marking thread is still finishing up the
// previous cycle. If we start one right now the two cycles

View File

@ -729,6 +729,11 @@ private:
// (should not be called directly).
void add_region_to_incremental_cset_common(HeapRegion* hr);
// Set the state to start a concurrent marking cycle and clear
// _initiate_conc_mark_if_possible because it has now been
// acted on.
void initiate_conc_mark();
public:
// Add hr to the LHS of the incremental collection set.
void add_region_to_incremental_cset_lhs(HeapRegion* hr);