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