# HG changeset patch # User stefank # Date 1404979606 -7200 # Thu Jul 10 10:06:46 2014 +0200 # Node ID 872ffbae11d7f9cede9e775dc1bc6f82876e5bdc # Parent 7fdf4173cde4025503ebe97abb36461886e3c2c4 8049831: Metadata Full GCs are not triggered when CMSClassUnloadingEnabled is turned off diff --git a/src/share/vm/gc_implementation/shared/vmGCOperations.cpp b/src/share/vm/gc_implementation/shared/vmGCOperations.cpp --- a/src/share/vm/gc_implementation/shared/vmGCOperations.cpp +++ b/src/share/vm/gc_implementation/shared/vmGCOperations.cpp @@ -197,28 +197,29 @@ bool VM_CollectForMetadataAllocation::initiate_concurrent_GC() { #if INCLUDE_ALL_GCS - if (UseConcMarkSweepGC || UseG1GC) { - if (UseConcMarkSweepGC && CMSClassUnloadingEnabled) { - MetaspaceGC::set_should_concurrent_collect(true); - } else if (UseG1GC) { - G1CollectedHeap* g1h = G1CollectedHeap::heap(); - g1h->g1_policy()->set_initiate_conc_mark_if_possible(); + if (UseConcMarkSweepGC && CMSClassUnloadingEnabled) { + MetaspaceGC::set_should_concurrent_collect(true); + return true; + } - GCCauseSetter x(g1h, _gc_cause); + if (UseG1GC) { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + g1h->g1_policy()->set_initiate_conc_mark_if_possible(); - // At this point we are supposed to start a concurrent cycle. We - // will do so if one is not already in progress. - bool should_start = g1h->g1_policy()->force_initial_mark_if_outside_cycle(_gc_cause); + GCCauseSetter x(g1h, _gc_cause); - if (should_start) { - double pause_target = g1h->g1_policy()->max_pause_time_ms(); - g1h->do_collection_pause_at_safepoint(pause_target); - } + // At this point we are supposed to start a concurrent cycle. We + // will do so if one is not already in progress. + bool should_start = g1h->g1_policy()->force_initial_mark_if_outside_cycle(_gc_cause); + + if (should_start) { + double pause_target = g1h->g1_policy()->max_pause_time_ms(); + g1h->do_collection_pause_at_safepoint(pause_target); } - return true; } #endif + return false; }