< prev index next >

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

Print this page




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




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


< prev index next >