src/share/vm/runtime/thread.cpp

changeset 2197
6e0aac35bfa9
parent 2193
8f6f7587d292
child 2198
0715f0cf171d
equal deleted inserted replaced
2196:32a1f7bf0c21 2197:6e0aac35bfa9
1642 // Flush G1-related queues. 1642 // Flush G1-related queues.
1643 void JavaThread::flush_barrier_queues() { 1643 void JavaThread::flush_barrier_queues() {
1644 satb_mark_queue().flush(); 1644 satb_mark_queue().flush();
1645 dirty_card_queue().flush(); 1645 dirty_card_queue().flush();
1646 } 1646 }
1647 #endif 1647
1648 void JavaThread::initialize_queues() {
1649 assert(!SafepointSynchronize::is_at_safepoint(),
1650 "we should not be at a safepoint");
1651
1652 ObjPtrQueue& satb_queue = satb_mark_queue();
1653 SATBMarkQueueSet& satb_queue_set = satb_mark_queue_set();
1654 // The SATB queue should have been constructed with its active
1655 // field set to false.
1656 assert(!satb_queue.is_active(), "SATB queue should not be active");
1657 assert(satb_queue.is_empty(), "SATB queue should be empty");
1658 // If we are creating the thread during a marking cycle, we should
1659 // set the active field of the SATB queue to true.
1660 if (satb_queue_set.is_active()) {
1661 satb_queue.set_active(true);
1662 }
1663
1664 DirtyCardQueue& dirty_queue = dirty_card_queue();
1665 // The dirty card queue should have been constructed with its
1666 // active field set to true.
1667 assert(dirty_queue.is_active(), "dirty card queue should be active");
1668 }
1669 #endif // !SERIALGC
1648 1670
1649 void JavaThread::cleanup_failed_attach_current_thread() { 1671 void JavaThread::cleanup_failed_attach_current_thread() {
1650 if (get_thread_profiler() != NULL) { 1672 if (get_thread_profiler() != NULL) {
1651 get_thread_profiler()->disengage(); 1673 get_thread_profiler()->disengage();
1652 ResourceMark rm; 1674 ResourceMark rm;
3624 3646
3625 3647
3626 void Threads::add(JavaThread* p, bool force_daemon) { 3648 void Threads::add(JavaThread* p, bool force_daemon) {
3627 // The threads lock must be owned at this point 3649 // The threads lock must be owned at this point
3628 assert_locked_or_safepoint(Threads_lock); 3650 assert_locked_or_safepoint(Threads_lock);
3651
3652 // See the comment for this method in thread.hpp for its purpose and
3653 // why it is called here.
3654 p->initialize_queues();
3629 p->set_next(_thread_list); 3655 p->set_next(_thread_list);
3630 _thread_list = p; 3656 _thread_list = p;
3631 _number_of_threads++; 3657 _number_of_threads++;
3632 oop threadObj = p->threadObj(); 3658 oop threadObj = p->threadObj();
3633 bool daemon = true; 3659 bool daemon = true;

mercurial