1.1 --- a/src/share/vm/runtime/thread.hpp Wed Oct 06 14:18:32 2010 -0700 1.2 +++ b/src/share/vm/runtime/thread.hpp Fri Oct 08 09:29:09 2010 -0700 1.3 @@ -1490,6 +1490,29 @@ 1.4 } 1.5 #endif // !SERIALGC 1.6 1.7 + // This method initializes the SATB and dirty card queues before a 1.8 + // JavaThread is added to the Java thread list. Right now, we don't 1.9 + // have to do anything to the dirty card queue (it should have been 1.10 + // activated when the thread was created), but we have to activate 1.11 + // the SATB queue if the thread is created while a marking cycle is 1.12 + // in progress. The activation / de-activation of the SATB queues at 1.13 + // the beginning / end of a marking cycle is done during safepoints 1.14 + // so we have to make sure this method is called outside one to be 1.15 + // able to safely read the active field of the SATB queue set. Right 1.16 + // now, it is called just before the thread is added to the Java 1.17 + // thread list in the Threads::add() method. That method is holding 1.18 + // the Threads_lock which ensures we are outside a safepoint. We 1.19 + // cannot do the obvious and set the active field of the SATB queue 1.20 + // when the thread is created given that, in some cases, safepoints 1.21 + // might happen between the JavaThread constructor being called and the 1.22 + // thread being added to the Java thread list (an example of this is 1.23 + // when the structure for the DestroyJavaVM thread is created). 1.24 +#ifndef SERIALGC 1.25 + void initialize_queues(); 1.26 +#else // !SERIALGC 1.27 + void initialize_queues() { } 1.28 +#endif // !SERIALGC 1.29 + 1.30 // Machine dependent stuff 1.31 #include "incls/_thread_pd.hpp.incl" 1.32