< prev index next >
src/share/vm/runtime/thread.cpp
Print this page
rev 12906 : [mq]: gc_interface
*** 47,56 ****
--- 47,57 ----
#include "memory/universe.inline.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/objArrayOop.hpp"
#include "oops/oop.inline.hpp"
#include "oops/symbol.hpp"
+ #include "oops/typeArrayOop.inline.hpp"
#include "oops/verifyOopClosure.hpp"
#include "prims/jvm_misc.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/jvmtiThreadState.hpp"
#include "prims/privilegedStack.hpp"
*** 1512,1532 ****
_frames_to_pop_failed_realloc = 0;
pd_initialize();
}
- #if INCLUDE_ALL_GCS
- SATBMarkQueueSet JavaThread::_satb_mark_queue_set;
- DirtyCardQueueSet JavaThread::_dirty_card_queue_set;
- #endif // INCLUDE_ALL_GCS
-
JavaThread::JavaThread(bool is_attaching_via_jni) :
Thread()
- #if INCLUDE_ALL_GCS
- , _satb_mark_queue(&_satb_mark_queue_set),
- _dirty_card_queue(&_dirty_card_queue_set)
- #endif // INCLUDE_ALL_GCS
{
initialize();
if (is_attaching_via_jni) {
_jni_attach_state = _attaching_via_jni;
} else {
--- 1513,1524 ----
*** 1586,1599 ****
static void compiler_thread_entry(JavaThread* thread, TRAPS);
static void sweeper_thread_entry(JavaThread* thread, TRAPS);
JavaThread::JavaThread(ThreadFunction entry_point, size_t stack_sz) :
Thread()
- #if INCLUDE_ALL_GCS
- , _satb_mark_queue(&_satb_mark_queue_set),
- _dirty_card_queue(&_dirty_card_queue_set)
- #endif // INCLUDE_ALL_GCS
{
initialize();
_jni_attach_state = _not_attaching_via_jni;
set_entry_point(entry_point);
// Create the native thread itself.
--- 1578,1587 ----
*** 1912,1974 ****
if (JvmtiEnv::environments_might_exist()) {
JvmtiExport::cleanup_thread(this);
}
! // We must flush any deferred card marks before removing a thread from
! // the list of active threads.
! Universe::heap()->flush_deferred_store_barrier(this);
! assert(deferred_card_mark().is_empty(), "Should have been flushed");
!
! #if INCLUDE_ALL_GCS
! // We must flush the G1-related buffers before removing a thread
! // from the list of active threads. We must do this after any deferred
! // card marks have been flushed (above) so that any entries that are
! // added to the thread's dirty card queue as a result are not lost.
! if (UseG1GC) {
! flush_barrier_queues();
! }
! #endif // INCLUDE_ALL_GCS
log_info(os, thread)("JavaThread %s (tid: " UINTX_FORMAT ").",
exit_type == JavaThread::normal_exit ? "exiting" : "detaching",
os::current_thread_id());
// Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread
Threads::remove(this);
}
- #if INCLUDE_ALL_GCS
- // Flush G1-related queues.
- void JavaThread::flush_barrier_queues() {
- satb_mark_queue().flush();
- dirty_card_queue().flush();
- }
-
- 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 (get_thread_profiler() != NULL) {
get_thread_profiler()->disengage();
ResourceMark rm;
get_thread_profiler()->print(get_thread_name());
--- 1900,1920 ----
if (JvmtiEnv::environments_might_exist()) {
JvmtiExport::cleanup_thread(this);
}
! BarrierSet *bs = Universe::heap()->barrier_set();
! bs->on_destroy_thread(this);
log_info(os, thread)("JavaThread %s (tid: " UINTX_FORMAT ").",
exit_type == JavaThread::normal_exit ? "exiting" : "detaching",
os::current_thread_id());
// Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread
Threads::remove(this);
}
void JavaThread::cleanup_failed_attach_current_thread() {
if (get_thread_profiler() != NULL) {
get_thread_profiler()->disengage();
ResourceMark rm;
get_thread_profiler()->print(get_thread_name());
*** 1991,2005 ****
if (UseTLAB) {
tlab().make_parsable(true); // retire TLAB, if any
}
! #if INCLUDE_ALL_GCS
! if (UseG1GC) {
! flush_barrier_queues();
! }
! #endif // INCLUDE_ALL_GCS
Threads::remove(this);
delete this;
}
--- 1937,1948 ----
if (UseTLAB) {
tlab().make_parsable(true); // retire TLAB, if any
}
! BarrierSet *bs = Universe::heap()->barrier_set();
! bs->on_destroy_thread(this);
Threads::remove(this);
delete this;
}
*** 4223,4233 ****
// 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();
p->set_next(_thread_list);
_thread_list = p;
_number_of_threads++;
oop threadObj = p->threadObj();
bool daemon = true;
--- 4166,4178 ----
// 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.
! BarrierSet* bs = Universe::heap()->barrier_set();
! bs->on_add_thread(p);
!
p->set_next(_thread_list);
_thread_list = p;
_number_of_threads++;
oop threadObj = p->threadObj();
bool daemon = true;
< prev index next >