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 }
265 return true; // may still need foreground young gc
266 }
267
268
269 void VM_GenCollectFullConcurrent::doit_epilogue() {
270 Thread* thr = Thread::current();
271 assert(thr->is_Java_thread(), "just checking");
272 JavaThread* jt = (JavaThread*)thr;
273 // Release the Heap_lock first.
274 Heap_lock->unlock();
275 release_and_notify_pending_list_lock();
276
277 // It is fine to test whether completed collections has
278 // exceeded our request count without locking because
279 // the completion count is monotonically increasing;
280 // this will break for very long-running apps when the
281 // count overflows and wraps around. XXX fix me !!!
|
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 monotonically increasing");
262 return false; // no need for foreground young gc
263 }
264 }
265 return true; // may still need foreground young gc
266 }
267
268
269 void VM_GenCollectFullConcurrent::doit_epilogue() {
270 Thread* thr = Thread::current();
271 assert(thr->is_Java_thread(), "just checking");
272 JavaThread* jt = (JavaThread*)thr;
273 // Release the Heap_lock first.
274 Heap_lock->unlock();
275 release_and_notify_pending_list_lock();
276
277 // It is fine to test whether completed collections has
278 // exceeded our request count without locking because
279 // the completion count is monotonically increasing;
280 // this will break for very long-running apps when the
281 // count overflows and wraps around. XXX fix me !!!
|