comparison src/share/vm/gc_implementation/shared/vmGCOperations.cpp @ 20280:bac98749fe00

8049831: Metadata Full GCs are not triggered when CMSClassUnloadingEnabled is turned off Reviewed-by: brutisso, tschatzl, ehelin, jmasa, dfazunen
author stefank
date Fri, 11 Jul 2014 09:07:23 +0200
parents 2c6ef90f030a
children f3aeae1f9fc5
comparison
equal deleted inserted replaced
20279:870c03421152 20280:bac98749fe00
1 /* 1 /*
2 * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
209 gch->do_full_collection(gch->must_clear_all_soft_refs(), _max_level); 209 gch->do_full_collection(gch->must_clear_all_soft_refs(), _max_level);
210 } 210 }
211 211
212 bool VM_CollectForMetadataAllocation::initiate_concurrent_GC() { 212 bool VM_CollectForMetadataAllocation::initiate_concurrent_GC() {
213 #if INCLUDE_ALL_GCS 213 #if INCLUDE_ALL_GCS
214 if (UseConcMarkSweepGC || UseG1GC) { 214 if (UseConcMarkSweepGC && CMSClassUnloadingEnabled) {
215 if (UseConcMarkSweepGC && CMSClassUnloadingEnabled) { 215 MetaspaceGC::set_should_concurrent_collect(true);
216 MetaspaceGC::set_should_concurrent_collect(true);
217 } else if (UseG1GC) {
218 G1CollectedHeap* g1h = G1CollectedHeap::heap();
219 g1h->g1_policy()->set_initiate_conc_mark_if_possible();
220
221 GCCauseSetter x(g1h, _gc_cause);
222
223 // At this point we are supposed to start a concurrent cycle. We
224 // will do so if one is not already in progress.
225 bool should_start = g1h->g1_policy()->force_initial_mark_if_outside_cycle(_gc_cause);
226
227 if (should_start) {
228 double pause_target = g1h->g1_policy()->max_pause_time_ms();
229 g1h->do_collection_pause_at_safepoint(pause_target);
230 }
231 }
232
233 return true; 216 return true;
234 } 217 }
218
219 if (UseG1GC) {
220 G1CollectedHeap* g1h = G1CollectedHeap::heap();
221 g1h->g1_policy()->set_initiate_conc_mark_if_possible();
222
223 GCCauseSetter x(g1h, _gc_cause);
224
225 // At this point we are supposed to start a concurrent cycle. We
226 // will do so if one is not already in progress.
227 bool should_start = g1h->g1_policy()->force_initial_mark_if_outside_cycle(_gc_cause);
228
229 if (should_start) {
230 double pause_target = g1h->g1_policy()->max_pause_time_ms();
231 g1h->do_collection_pause_at_safepoint(pause_target);
232 }
233 return true;
234 }
235 #endif 235 #endif
236
236 return false; 237 return false;
237 } 238 }
238 239
239 static void log_metaspace_alloc_failure_for_concurrent_GC() { 240 static void log_metaspace_alloc_failure_for_concurrent_GC() {
240 if (Verbose && PrintGCDetails) { 241 if (Verbose && PrintGCDetails) {