equal
deleted
inserted
replaced
26 #include "logging/logStream.hpp" |
26 #include "logging/logStream.hpp" |
27 #include "memory/allocation.inline.hpp" |
27 #include "memory/allocation.inline.hpp" |
28 #include "runtime/jniHandles.inline.hpp" |
28 #include "runtime/jniHandles.inline.hpp" |
29 #include "runtime/thread.inline.hpp" |
29 #include "runtime/thread.inline.hpp" |
30 #include "runtime/threadSMR.inline.hpp" |
30 #include "runtime/threadSMR.inline.hpp" |
|
31 #include "runtime/vm_operations.hpp" |
31 #include "services/threadService.hpp" |
32 #include "services/threadService.hpp" |
32 #include "utilities/copy.hpp" |
33 #include "utilities/copy.hpp" |
33 #include "utilities/globalDefinitions.hpp" |
34 #include "utilities/globalDefinitions.hpp" |
34 #include "utilities/resourceHash.hpp" |
35 #include "utilities/resourceHash.hpp" |
35 #include "utilities/vmError.hpp" |
36 #include "utilities/vmError.hpp" |
467 return new_list; |
468 return new_list; |
468 } |
469 } |
469 |
470 |
470 ThreadsListHandle::ThreadsListHandle(Thread *self) : _list(ThreadsSMRSupport::acquire_stable_list(self, /* is_ThreadsListSetter */ false)), _self(self) { |
471 ThreadsListHandle::ThreadsListHandle(Thread *self) : _list(ThreadsSMRSupport::acquire_stable_list(self, /* is_ThreadsListSetter */ false)), _self(self) { |
471 assert(self == Thread::current(), "sanity check"); |
472 assert(self == Thread::current(), "sanity check"); |
|
473 // Threads::threads_do() is used by the Thread-SMR protocol to visit all |
|
474 // Threads in the system which ensures the safety of the ThreadsList |
|
475 // managed by this ThreadsListHandle, but JavaThreads that are not on |
|
476 // the Threads list cannot be included in that visit. The JavaThread that |
|
477 // calls Threads::destroy_vm() is exempt from this check because it has |
|
478 // to logically exit as part of the shutdown procedure. This is safe |
|
479 // because VM_Exit::_shutdown_thread is not set until after the VMThread |
|
480 // has started the final safepoint which holds the Threads_lock for the |
|
481 // remainder of the VM's life. |
|
482 assert(!self->is_Java_thread() || self == VM_Exit::shutdown_thread() || (((JavaThread*)self)->on_thread_list() && !((JavaThread*)self)->is_terminated()), "JavaThread must be on the Threads list to use a ThreadsListHandle"); |
472 if (EnableThreadSMRStatistics) { |
483 if (EnableThreadSMRStatistics) { |
473 _timer.start(); |
484 _timer.start(); |
474 } |
485 } |
475 } |
486 } |
476 |
487 |