< prev index next >

hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp

Print this page
rev 6902 : 8062036: ConcurrentMarkThread::slt may be invoked before ConcurrentMarkThread::makeSurrogateLockerThread causing intermittent crashes
Summary: Suppress gc_alot during VM init, improve error for SLT uninitialized.
Reviewed-by: jmasa, brutisso, tschatzl


 196       // The following is largely copied from CMS
 197 
 198       Thread* thr = Thread::current();
 199       assert(thr->is_Java_thread(), "invariant");
 200       JavaThread* jt = (JavaThread*)thr;
 201       ThreadToNativeFromVM native(jt);
 202 
 203       MutexLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
 204       while (g1h->old_marking_cycles_completed() <=
 205                                           _old_marking_cycles_completed_before) {
 206         FullGCCount_lock->wait(Mutex::_no_safepoint_check_flag);
 207       }
 208     }
 209   }
 210 }
 211 
 212 void VM_CGC_Operation::acquire_pending_list_lock() {
 213   assert(_needs_pll, "don't call this otherwise");
 214   // The caller may block while communicating
 215   // with the SLT thread in order to acquire/release the PLL.
 216   ConcurrentMarkThread::slt()->
 217     manipulatePLL(SurrogateLockerThread::acquirePLL);




 218 }
 219 
 220 void VM_CGC_Operation::release_and_notify_pending_list_lock() {
 221   assert(_needs_pll, "don't call this otherwise");
 222   // The caller may block while communicating
 223   // with the SLT thread in order to acquire/release the PLL.
 224   ConcurrentMarkThread::slt()->
 225     manipulatePLL(SurrogateLockerThread::releaseAndNotifyPLL);
 226 }
 227 
 228 void VM_CGC_Operation::doit() {
 229   gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps);
 230   TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
 231   GCTraceTime t(_printGCMessage, G1Log::fine(), true, G1CollectedHeap::heap()->gc_timer_cm(), G1CollectedHeap::heap()->concurrent_mark()->concurrent_gc_id());
 232   SharedHeap* sh = SharedHeap::heap();
 233   // This could go away if CollectedHeap gave access to _gc_is_active...
 234   if (sh != NULL) {
 235     IsGCActiveMark x;
 236     _cl->do_void();
 237   } else {




 196       // The following is largely copied from CMS
 197 
 198       Thread* thr = Thread::current();
 199       assert(thr->is_Java_thread(), "invariant");
 200       JavaThread* jt = (JavaThread*)thr;
 201       ThreadToNativeFromVM native(jt);
 202 
 203       MutexLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
 204       while (g1h->old_marking_cycles_completed() <=
 205                                           _old_marking_cycles_completed_before) {
 206         FullGCCount_lock->wait(Mutex::_no_safepoint_check_flag);
 207       }
 208     }
 209   }
 210 }
 211 
 212 void VM_CGC_Operation::acquire_pending_list_lock() {
 213   assert(_needs_pll, "don't call this otherwise");
 214   // The caller may block while communicating
 215   // with the SLT thread in order to acquire/release the PLL.
 216   SurrogateLockerThread* slt = ConcurrentMarkThread::slt();
 217   if (slt != NULL) {
 218     slt->manipulatePLL(SurrogateLockerThread::acquirePLL);
 219   } else {
 220     SurrogateLockerThread::report_missing_slt();
 221   }
 222 }
 223 
 224 void VM_CGC_Operation::release_and_notify_pending_list_lock() {
 225   assert(_needs_pll, "don't call this otherwise");
 226   // The caller may block while communicating
 227   // with the SLT thread in order to acquire/release the PLL.
 228   ConcurrentMarkThread::slt()->
 229     manipulatePLL(SurrogateLockerThread::releaseAndNotifyPLL);
 230 }
 231 
 232 void VM_CGC_Operation::doit() {
 233   gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps);
 234   TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
 235   GCTraceTime t(_printGCMessage, G1Log::fine(), true, G1CollectedHeap::heap()->gc_timer_cm(), G1CollectedHeap::heap()->concurrent_mark()->concurrent_gc_id());
 236   SharedHeap* sh = SharedHeap::heap();
 237   // This could go away if CollectedHeap gave access to _gc_is_active...
 238   if (sh != NULL) {
 239     IsGCActiveMark x;
 240     _cl->do_void();
 241   } else {


< prev index next >