< prev index next >

src/share/vm/gc/cms/vmCMSOperations.cpp

Print this page
rev 8393 : 8077842: Remove the level parameter passed around in GenCollectedHeap
Reviewed-by:


 181 }
 182 
 183 // VM operation to invoke a concurrent collection of a
 184 // GenCollectedHeap heap.
 185 void VM_GenCollectFullConcurrent::doit() {
 186   assert(Thread::current()->is_VM_thread(), "Should be VM thread");
 187   assert(GCLockerInvokesConcurrent || ExplicitGCInvokesConcurrent, "Unexpected");
 188 
 189   GenCollectedHeap* gch = GenCollectedHeap::heap();
 190   if (_gc_count_before == gch->total_collections()) {
 191     // The "full" of do_full_collection call below "forces"
 192     // a collection; the second arg, 0, below ensures that
 193     // only the young gen is collected. XXX In the future,
 194     // we'll probably need to have something in this interface
 195     // to say do this only if we are sure we will not bail
 196     // out to a full collection in this attempt, but that's
 197     // for the future.
 198     assert(SafepointSynchronize::is_at_safepoint(),
 199       "We can only be executing this arm of if at a safepoint");
 200     GCCauseSetter gccs(gch, _gc_cause);
 201     gch->do_full_collection(gch->must_clear_all_soft_refs(),
 202                             0 /* collect only youngest gen */);
 203   } // Else no need for a foreground young gc
 204   assert((_gc_count_before < gch->total_collections()) ||
 205          (GC_locker::is_active() /* gc may have been skipped */
 206           && (_gc_count_before == gch->total_collections())),
 207          "total_collections() should be monotonically increasing");
 208 
 209   MutexLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
 210   assert(_full_gc_count_before <= gch->total_full_collections(), "Error");
 211   if (gch->total_full_collections() == _full_gc_count_before) {
 212     // Nudge the CMS thread to start a concurrent collection.
 213     CMSCollector::request_full_gc(_full_gc_count_before, _gc_cause);
 214   } else {
 215     assert(_full_gc_count_before < gch->total_full_collections(), "Error");
 216     FullGCCount_lock->notify_all();  // Inform the Java thread its work is done
 217   }
 218 }
 219 
 220 bool VM_GenCollectFullConcurrent::evaluate_at_safepoint() const {
 221   Thread* thr = Thread::current();
 222   assert(thr != NULL, "Unexpected tid");




 181 }
 182 
 183 // VM operation to invoke a concurrent collection of a
 184 // GenCollectedHeap heap.
 185 void VM_GenCollectFullConcurrent::doit() {
 186   assert(Thread::current()->is_VM_thread(), "Should be VM thread");
 187   assert(GCLockerInvokesConcurrent || ExplicitGCInvokesConcurrent, "Unexpected");
 188 
 189   GenCollectedHeap* gch = GenCollectedHeap::heap();
 190   if (_gc_count_before == gch->total_collections()) {
 191     // The "full" of do_full_collection call below "forces"
 192     // a collection; the second arg, 0, below ensures that
 193     // only the young gen is collected. XXX In the future,
 194     // we'll probably need to have something in this interface
 195     // to say do this only if we are sure we will not bail
 196     // out to a full collection in this attempt, but that's
 197     // for the future.
 198     assert(SafepointSynchronize::is_at_safepoint(),
 199       "We can only be executing this arm of if at a safepoint");
 200     GCCauseSetter gccs(gch, _gc_cause);
 201     gch->do_full_collection(gch->must_clear_all_soft_refs(), Generation::Young);

 202   } // Else no need for a foreground young gc
 203   assert((_gc_count_before < gch->total_collections()) ||
 204          (GC_locker::is_active() /* gc may have been skipped */
 205           && (_gc_count_before == gch->total_collections())),
 206          "total_collections() should be monotonically increasing");
 207 
 208   MutexLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
 209   assert(_full_gc_count_before <= gch->total_full_collections(), "Error");
 210   if (gch->total_full_collections() == _full_gc_count_before) {
 211     // Nudge the CMS thread to start a concurrent collection.
 212     CMSCollector::request_full_gc(_full_gc_count_before, _gc_cause);
 213   } else {
 214     assert(_full_gc_count_before < gch->total_full_collections(), "Error");
 215     FullGCCount_lock->notify_all();  // Inform the Java thread its work is done
 216   }
 217 }
 218 
 219 bool VM_GenCollectFullConcurrent::evaluate_at_safepoint() const {
 220   Thread* thr = Thread::current();
 221   assert(thr != NULL, "Unexpected tid");


< prev index next >