< prev index next >

hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.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


 120     // At this point it may be possible that no osthread was created for the
 121     // JavaThread due to lack of memory. We would have to throw an exception
 122     // in that case. However, since this must work and we do not allow
 123     // exceptions anyway, check and abort if this fails.
 124     if (res == NULL || res->osthread() == NULL) {
 125       vm_exit_during_initialization("java.lang.OutOfMemoryError",
 126                                     "unable to create new native thread");
 127     }
 128     java_lang_Thread::set_thread(thread_oop(), res);
 129     java_lang_Thread::set_priority(thread_oop(), NearMaxPriority);
 130     java_lang_Thread::set_daemon(thread_oop());
 131 
 132     res->set_threadObj(thread_oop());
 133     Threads::add(res);
 134     Thread::start(res);
 135   }
 136   os::yield(); // This seems to help with initial start-up of SLT
 137   return res;
 138 }
 139 







 140 void SurrogateLockerThread::manipulatePLL(SLT_msg_type msg) {
 141   MutexLockerEx x(&_monitor, Mutex::_no_safepoint_check_flag);
 142   assert(_buffer == empty, "Should be empty");
 143   assert(msg != empty, "empty message");
 144   assert(!Heap_lock->owned_by_self(), "Heap_lock owned by requesting thread");
 145 
 146   _buffer = msg;
 147   while (_buffer != empty) {
 148     _monitor.notify();
 149     _monitor.wait(Mutex::_no_safepoint_check_flag);
 150   }
 151 }
 152 
 153 // ======= Surrogate Locker Thread =============
 154 
 155 void SurrogateLockerThread::loop() {
 156   BasicLock pll_basic_lock;
 157   SLT_msg_type msg;
 158   debug_only(unsigned int owned = 0;)
 159 




 120     // At this point it may be possible that no osthread was created for the
 121     // JavaThread due to lack of memory. We would have to throw an exception
 122     // in that case. However, since this must work and we do not allow
 123     // exceptions anyway, check and abort if this fails.
 124     if (res == NULL || res->osthread() == NULL) {
 125       vm_exit_during_initialization("java.lang.OutOfMemoryError",
 126                                     "unable to create new native thread");
 127     }
 128     java_lang_Thread::set_thread(thread_oop(), res);
 129     java_lang_Thread::set_priority(thread_oop(), NearMaxPriority);
 130     java_lang_Thread::set_daemon(thread_oop());
 131 
 132     res->set_threadObj(thread_oop());
 133     Threads::add(res);
 134     Thread::start(res);
 135   }
 136   os::yield(); // This seems to help with initial start-up of SLT
 137   return res;
 138 }
 139 
 140 void SurrogateLockerThread::report_missing_slt() {
 141   vm_exit_during_initialization(
 142     "GC before GC support fully initialized: "
 143     "SLT is needed but has not yet been created.");
 144   ShouldNotReachHere();
 145 }
 146 
 147 void SurrogateLockerThread::manipulatePLL(SLT_msg_type msg) {
 148   MutexLockerEx x(&_monitor, Mutex::_no_safepoint_check_flag);
 149   assert(_buffer == empty, "Should be empty");
 150   assert(msg != empty, "empty message");
 151   assert(!Heap_lock->owned_by_self(), "Heap_lock owned by requesting thread");
 152 
 153   _buffer = msg;
 154   while (_buffer != empty) {
 155     _monitor.notify();
 156     _monitor.wait(Mutex::_no_safepoint_check_flag);
 157   }
 158 }
 159 
 160 // ======= Surrogate Locker Thread =============
 161 
 162 void SurrogateLockerThread::loop() {
 163   BasicLock pll_basic_lock;
 164   SLT_msg_type msg;
 165   debug_only(unsigned int owned = 0;)
 166 


< prev index next >