< prev index next >

src/share/vm/gc_implementation/shared/vmGCOperations.cpp

Print this page


   1 /*
   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.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 188 }
 189 
 190 void VM_GenCollectFull::doit() {
 191   SvcGCMarker sgcm(SvcGCMarker::FULL);
 192 
 193   GenCollectedHeap* gch = GenCollectedHeap::heap();
 194   GCCauseSetter gccs(gch, _gc_cause);
 195   gch->do_full_collection(gch->must_clear_all_soft_refs(), _max_level);
 196 }
 197 
 198 // Returns true iff concurrent GCs unloads metadata.
 199 bool VM_CollectForMetadataAllocation::initiate_concurrent_GC() {
 200 #if INCLUDE_ALL_GCS
 201   if (UseConcMarkSweepGC && CMSClassUnloadingEnabled) {
 202     MetaspaceGC::set_should_concurrent_collect(true);
 203     return true;
 204   }
 205 
 206   if (UseG1GC && ClassUnloadingWithConcurrentMark) {
 207     G1CollectedHeap* g1h = G1CollectedHeap::heap();
 208     g1h->g1_policy()->set_initiate_conc_mark_if_possible();
 209 
 210     GCCauseSetter x(g1h, _gc_cause);
 211 
 212     // At this point we are supposed to start a concurrent cycle. We
 213     // will do so if one is not already in progress.
 214     bool should_start = g1h->g1_policy()->force_initial_mark_if_outside_cycle(_gc_cause);
 215 
 216     if (should_start) {
 217       double pause_target = g1h->g1_policy()->max_pause_time_ms();
 218       g1h->do_collection_pause_at_safepoint(pause_target);
 219     }
 220     return true;
 221   }
 222 #endif
 223 
 224   return false;
 225 }
 226 
 227 static void log_metaspace_alloc_failure_for_concurrent_GC() {
 228   if (Verbose && PrintGCDetails) {


   1 /*
   2  * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 188 }
 189 
 190 void VM_GenCollectFull::doit() {
 191   SvcGCMarker sgcm(SvcGCMarker::FULL);
 192 
 193   GenCollectedHeap* gch = GenCollectedHeap::heap();
 194   GCCauseSetter gccs(gch, _gc_cause);
 195   gch->do_full_collection(gch->must_clear_all_soft_refs(), _max_level);
 196 }
 197 
 198 // Returns true iff concurrent GCs unloads metadata.
 199 bool VM_CollectForMetadataAllocation::initiate_concurrent_GC() {
 200 #if INCLUDE_ALL_GCS
 201   if (UseConcMarkSweepGC && CMSClassUnloadingEnabled) {
 202     MetaspaceGC::set_should_concurrent_collect(true);
 203     return true;
 204   }
 205 
 206   if (UseG1GC && ClassUnloadingWithConcurrentMark) {
 207     G1CollectedHeap* g1h = G1CollectedHeap::heap();
 208     g1h->g1_policy()->collector_state()->set_initiate_conc_mark_if_possible(true);
 209 
 210     GCCauseSetter x(g1h, _gc_cause);
 211 
 212     // At this point we are supposed to start a concurrent cycle. We
 213     // will do so if one is not already in progress.
 214     bool should_start = g1h->g1_policy()->force_initial_mark_if_outside_cycle(_gc_cause);
 215 
 216     if (should_start) {
 217       double pause_target = g1h->g1_policy()->max_pause_time_ms();
 218       g1h->do_collection_pause_at_safepoint(pause_target);
 219     }
 220     return true;
 221   }
 222 #endif
 223 
 224   return false;
 225 }
 226 
 227 static void log_metaspace_alloc_failure_for_concurrent_GC() {
 228   if (Verbose && PrintGCDetails) {


< prev index next >