< prev index next >
src/hotspot/share/runtime/thread.cpp
Print this page
@@ -1992,14 +1992,11 @@
if (JvmtiEnv::environments_might_exist()) {
JvmtiExport::cleanup_thread(this);
}
- // We must flush any deferred card marks and other various GC barrier
- // related buffers (e.g. G1 SATB buffer and G1 dirty card queue buffer)
- // before removing a thread from the list of active threads.
- BarrierSet::barrier_set()->flush_deferred_barriers(this);
+ BarrierSet::barrier_set()->on_thread_destroy(this);
log_info(os, thread)("JavaThread %s (tid: " UINTX_FORMAT ").",
exit_type == JavaThread::normal_exit ? "exiting" : "detaching",
os::current_thread_id());
@@ -2024,34 +2021,10 @@
_timer_exit_phase3.milliseconds(),
_timer_exit_phase4.milliseconds());
}
}
-#if INCLUDE_ALL_GCS
-void JavaThread::initialize_queues() {
- assert(!SafepointSynchronize::is_at_safepoint(),
- "we should not be at a safepoint");
-
- SATBMarkQueue& satb_queue = satb_mark_queue();
- SATBMarkQueueSet& satb_queue_set = satb_mark_queue_set();
- // The SATB queue should have been constructed with its active
- // field set to false.
- assert(!satb_queue.is_active(), "SATB queue should not be active");
- assert(satb_queue.is_empty(), "SATB queue should be empty");
- // If we are creating the thread during a marking cycle, we should
- // set the active field of the SATB queue to true.
- if (satb_queue_set.is_active()) {
- satb_queue.set_active(true);
- }
-
- DirtyCardQueue& dirty_queue = dirty_card_queue();
- // The dirty card queue should have been constructed with its
- // active field set to true.
- assert(dirty_queue.is_active(), "dirty card queue should be active");
-}
-#endif // INCLUDE_ALL_GCS
-
void JavaThread::cleanup_failed_attach_current_thread() {
if (active_handles() != NULL) {
JNIHandleBlock* block = active_handles();
set_active_handles(NULL);
JNIHandleBlock::release_block(block);
@@ -2068,19 +2041,16 @@
if (UseTLAB) {
tlab().make_parsable(true); // retire TLAB, if any
}
- BarrierSet::barrier_set()->flush_deferred_barriers(this);
+ BarrierSet::barrier_set()->on_thread_destroy(this);
Threads::remove(this);
this->smr_delete();
}
-
-
-
JavaThread* JavaThread::active() {
Thread* thread = Thread::current();
if (thread->is_Java_thread()) {
return (JavaThread*) thread;
} else {
@@ -4330,13 +4300,12 @@
void Threads::add(JavaThread* p, bool force_daemon) {
// The threads lock must be owned at this point
assert_locked_or_safepoint(Threads_lock);
- // See the comment for this method in thread.hpp for its purpose and
- // why it is called here.
- p->initialize_queues();
+ BarrierSet::barrier_set()->on_thread_create(p);
+
p->set_next(_thread_list);
_thread_list = p;
// Once a JavaThread is added to the Threads list, smr_delete() has
// to be used to delete it. Otherwise we can just delete it directly.
< prev index next >