1.1 --- a/src/share/vm/runtime/thread.cpp Tue Oct 12 10:57:33 2010 -0400 1.2 +++ b/src/share/vm/runtime/thread.cpp Wed Oct 13 11:46:46 2010 -0400 1.3 @@ -1183,6 +1183,7 @@ 1.4 set_vframe_array_last(NULL); 1.5 set_deferred_locals(NULL); 1.6 set_deopt_mark(NULL); 1.7 + set_deopt_nmethod(NULL); 1.8 clear_must_deopt_id(); 1.9 set_monitor_chunks(NULL); 1.10 set_next(NULL); 1.11 @@ -1644,7 +1645,29 @@ 1.12 satb_mark_queue().flush(); 1.13 dirty_card_queue().flush(); 1.14 } 1.15 -#endif 1.16 + 1.17 +void JavaThread::initialize_queues() { 1.18 + assert(!SafepointSynchronize::is_at_safepoint(), 1.19 + "we should not be at a safepoint"); 1.20 + 1.21 + ObjPtrQueue& satb_queue = satb_mark_queue(); 1.22 + SATBMarkQueueSet& satb_queue_set = satb_mark_queue_set(); 1.23 + // The SATB queue should have been constructed with its active 1.24 + // field set to false. 1.25 + assert(!satb_queue.is_active(), "SATB queue should not be active"); 1.26 + assert(satb_queue.is_empty(), "SATB queue should be empty"); 1.27 + // If we are creating the thread during a marking cycle, we should 1.28 + // set the active field of the SATB queue to true. 1.29 + if (satb_queue_set.is_active()) { 1.30 + satb_queue.set_active(true); 1.31 + } 1.32 + 1.33 + DirtyCardQueue& dirty_queue = dirty_card_queue(); 1.34 + // The dirty card queue should have been constructed with its 1.35 + // active field set to true. 1.36 + assert(dirty_queue.is_active(), "dirty card queue should be active"); 1.37 +} 1.38 +#endif // !SERIALGC 1.39 1.40 void JavaThread::cleanup_failed_attach_current_thread() { 1.41 if (get_thread_profiler() != NULL) { 1.42 @@ -3629,6 +3652,10 @@ 1.43 void Threads::add(JavaThread* p, bool force_daemon) { 1.44 // The threads lock must be owned at this point 1.45 assert_locked_or_safepoint(Threads_lock); 1.46 + 1.47 + // See the comment for this method in thread.hpp for its purpose and 1.48 + // why it is called here. 1.49 + p->initialize_queues(); 1.50 p->set_next(_thread_list); 1.51 _thread_list = p; 1.52 _number_of_threads++;