224 "We can only be executing this arm of if at a safepoint");
225 GCCauseSetter gccs(gch, _gc_cause);
226 gch->do_full_collection(gch->must_clear_all_soft_refs(),
227 0 /* collect only youngest gen */);
228 } // Else no need for a foreground young gc
229 assert((_gc_count_before < gch->total_collections()) ||
230 (GC_locker::is_active() /* gc may have been skipped */
231 && (_gc_count_before == gch->total_collections())),
232 "total_collections() should be monotonically increasing");
233
234 MutexLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
235 assert(_full_gc_count_before <= gch->total_full_collections(), "Error");
236 if (gch->total_full_collections() == _full_gc_count_before) {
237 // Disable iCMS until the full collection is done, and
238 // remember that we did so.
239 CMSCollector::disable_icms();
240 _disabled_icms = true;
241 // In case CMS thread was in icms_wait(), wake it up.
242 CMSCollector::start_icms();
243 // Nudge the CMS thread to start a concurrent collection.
244 CMSCollector::request_full_gc(_full_gc_count_before);
245 } else {
246 assert(_full_gc_count_before < gch->total_full_collections(), "Error");
247 FullGCCount_lock->notify_all(); // Inform the Java thread its work is done
248 }
249 }
250
251 bool VM_GenCollectFullConcurrent::evaluate_at_safepoint() const {
252 Thread* thr = Thread::current();
253 assert(thr != NULL, "Unexpected tid");
254 if (!thr->is_Java_thread()) {
255 assert(thr->is_VM_thread(), "Expected to be evaluated by VM thread");
256 GenCollectedHeap* gch = GenCollectedHeap::heap();
257 if (_gc_count_before != gch->total_collections()) {
258 // No need to do a young gc, we'll just nudge the CMS thread
259 // in the doit() method above, to be executed soon.
260 assert(_gc_count_before < gch->total_collections(),
261 "total_collections() should be monotnically increasing");
262 return false; // no need for foreground young gc
263 }
264 }
|
224 "We can only be executing this arm of if at a safepoint");
225 GCCauseSetter gccs(gch, _gc_cause);
226 gch->do_full_collection(gch->must_clear_all_soft_refs(),
227 0 /* collect only youngest gen */);
228 } // Else no need for a foreground young gc
229 assert((_gc_count_before < gch->total_collections()) ||
230 (GC_locker::is_active() /* gc may have been skipped */
231 && (_gc_count_before == gch->total_collections())),
232 "total_collections() should be monotonically increasing");
233
234 MutexLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
235 assert(_full_gc_count_before <= gch->total_full_collections(), "Error");
236 if (gch->total_full_collections() == _full_gc_count_before) {
237 // Disable iCMS until the full collection is done, and
238 // remember that we did so.
239 CMSCollector::disable_icms();
240 _disabled_icms = true;
241 // In case CMS thread was in icms_wait(), wake it up.
242 CMSCollector::start_icms();
243 // Nudge the CMS thread to start a concurrent collection.
244 CMSCollector::request_full_gc(_full_gc_count_before, _gc_cause);
245 } else {
246 assert(_full_gc_count_before < gch->total_full_collections(), "Error");
247 FullGCCount_lock->notify_all(); // Inform the Java thread its work is done
248 }
249 }
250
251 bool VM_GenCollectFullConcurrent::evaluate_at_safepoint() const {
252 Thread* thr = Thread::current();
253 assert(thr != NULL, "Unexpected tid");
254 if (!thr->is_Java_thread()) {
255 assert(thr->is_VM_thread(), "Expected to be evaluated by VM thread");
256 GenCollectedHeap* gch = GenCollectedHeap::heap();
257 if (_gc_count_before != gch->total_collections()) {
258 // No need to do a young gc, we'll just nudge the CMS thread
259 // in the doit() method above, to be executed soon.
260 assert(_gc_count_before < gch->total_collections(),
261 "total_collections() should be monotnically increasing");
262 return false; // no need for foreground young gc
263 }
264 }
|