mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 01:24:33 +02:00
8253064: monitor list simplifications and getting rid of TSM
Co-authored-by: Erik Österlund <eosterlund@openjdk.org> Reviewed-by: eosterlund, rehn, coleenp
This commit is contained in:
parent
421a7c3b41
commit
2e19026d45
25 changed files with 817 additions and 1912 deletions
|
@ -81,6 +81,7 @@
|
|||
#include "runtime/jniHandles.inline.hpp"
|
||||
#include "runtime/jniPeriodicChecker.hpp"
|
||||
#include "runtime/memprofiler.hpp"
|
||||
#include "runtime/monitorDeflationThread.hpp"
|
||||
#include "runtime/mutexLocker.hpp"
|
||||
#include "runtime/objectMonitor.hpp"
|
||||
#include "runtime/orderAccess.hpp"
|
||||
|
@ -262,11 +263,6 @@ Thread::Thread() {
|
|||
_current_pending_monitor_is_from_java = true;
|
||||
_current_waiting_monitor = NULL;
|
||||
_current_pending_raw_monitor = NULL;
|
||||
om_free_list = NULL;
|
||||
om_free_count = 0;
|
||||
om_free_provision = 32;
|
||||
om_in_use_list = NULL;
|
||||
om_in_use_count = 0;
|
||||
|
||||
#ifdef ASSERT
|
||||
_visited_for_critical_count = false;
|
||||
|
@ -3691,6 +3687,9 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
|
|||
// and other cleanups. Needs to start before the compilers start posting events.
|
||||
ServiceThread::initialize();
|
||||
|
||||
// Start the monitor deflation thread:
|
||||
MonitorDeflationThread::initialize();
|
||||
|
||||
// initialize compiler(s)
|
||||
#if defined(COMPILER1) || COMPILER2_OR_JVMCI
|
||||
#if INCLUDE_JVMCI
|
||||
|
@ -4233,6 +4232,9 @@ void Threads::add(JavaThread* p, bool force_daemon) {
|
|||
// Maintain fast thread list
|
||||
ThreadsSMRSupport::add_thread(p);
|
||||
|
||||
// Increase the ObjectMonitor ceiling for the new thread.
|
||||
ObjectSynchronizer::inc_in_use_list_ceiling();
|
||||
|
||||
// Possible GC point.
|
||||
Events::log(p, "Thread added: " INTPTR_FORMAT, p2i(p));
|
||||
|
||||
|
@ -4241,19 +4243,14 @@ void Threads::add(JavaThread* p, bool force_daemon) {
|
|||
}
|
||||
|
||||
void Threads::remove(JavaThread* p, bool is_daemon) {
|
||||
|
||||
// Reclaim the ObjectMonitors from the om_in_use_list and om_free_list of the moribund thread.
|
||||
ObjectSynchronizer::om_flush(p);
|
||||
|
||||
// Extra scope needed for Thread_lock, so we can check
|
||||
// that we do not remove thread without safepoint code notice
|
||||
{ MonitorLocker ml(Threads_lock);
|
||||
|
||||
// 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.
|
||||
// This must be done after ObjectSynchronizer::om_flush(), as GC barriers
|
||||
// are used in om_flush().
|
||||
// BarrierSet state must be destroyed after the last thread transition
|
||||
// before the thread terminates. Thread transitions result in calls to
|
||||
// StackWatermarkSet::on_safepoint(), which performs GC processing,
|
||||
// requiring the GC state to be alive.
|
||||
BarrierSet::barrier_set()->on_thread_detach(p);
|
||||
|
||||
assert(ThreadsSMRSupport::get_java_thread_list()->includes(p), "p must be present");
|
||||
|
@ -4283,6 +4280,9 @@ void Threads::remove(JavaThread* p, bool is_daemon) {
|
|||
EscapeBarrier::thread_removed(p);
|
||||
} // unlock Threads_lock
|
||||
|
||||
// Reduce the ObjectMonitor ceiling for the exiting thread.
|
||||
ObjectSynchronizer::dec_in_use_list_ceiling();
|
||||
|
||||
// Since Events::log uses a lock, we grab it outside the Threads_lock
|
||||
Events::log(p, "Thread exited: " INTPTR_FORMAT, p2i(p));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue