< prev index next >
src/hotspot/share/runtime/thread.cpp
Print this page
rev 56464 : 8231707: Improve Mutex inlining
Contributed-by: robbin.ehn@oracle.com, claes.redestad@oracle.com
@@ -77,11 +77,11 @@
#include "runtime/java.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/jniHandles.inline.hpp"
#include "runtime/jniPeriodicChecker.hpp"
#include "runtime/memprofiler.hpp"
-#include "runtime/mutexLocker.hpp"
+#include "runtime/mutexLocker.inline.hpp"
#include "runtime/objectMonitor.hpp"
#include "runtime/orderAccess.hpp"
#include "runtime/osThread.hpp"
#include "runtime/prefetch.inline.hpp"
#include "runtime/safepoint.hpp"
@@ -110,11 +110,11 @@
#include "services/threadService.hpp"
#include "utilities/align.hpp"
#include "utilities/copy.hpp"
#include "utilities/defaultStream.hpp"
#include "utilities/dtrace.hpp"
-#include "utilities/events.hpp"
+#include "utilities/events.inline.hpp"
#include "utilities/macros.hpp"
#include "utilities/preserveException.hpp"
#include "utilities/singleWriterSynchronizer.hpp"
#include "utilities/vmError.hpp"
#if INCLUDE_JVMCI
@@ -321,10 +321,47 @@
// If the main thread creates other threads before the barrier set that is an error.
assert(Thread::current_or_null() == NULL, "creating thread before barrier set");
}
}
+bool JavaThread::is_ext_suspend_completed_with_lock(uint32_t *bits) {
+ MutexLocker ml(SR_lock(), Mutex::_no_safepoint_check_flag);
+ // Warning: is_ext_suspend_completed() may temporarily drop the
+ // SR_lock to allow the thread to reach a stable thread state if
+ // it is currently in a transient thread state.
+ return is_ext_suspend_completed(false /* !called_by_wait */,
+ SuspendRetryDelay, bits);
+}
+
+bool JavaThread::is_external_suspend_with_lock() const {
+ MutexLocker ml(SR_lock(), Mutex::_no_safepoint_check_flag);
+ return is_external_suspend();
+}
+ bool JavaThread::handle_special_suspend_equivalent_condition() {
+ assert(is_suspend_equivalent(),
+ "should only be called in a suspend equivalence condition");
+ MutexLocker ml(SR_lock(), Mutex::_no_safepoint_check_flag);
+ bool ret = is_external_suspend();
+ if (!ret) {
+ // not about to self-suspend so clear suspend equivalence
+ clear_suspend_equivalent();
+ }
+ // implied else:
+ // We have a pending external suspend request so we leave the
+ // suspend_equivalent flag set until java_suspend_self() sets
+ // the ext_suspended flag and clears the suspend_equivalent
+ // flag. This insures that wait_for_ext_suspend_completion()
+ // will return consistent values.
+ return ret;
+ }
+
+ // utility methods to see if we are doing some kind of suspension
+ bool JavaThread::is_being_ext_suspended() const {
+ MutexLocker ml(SR_lock(), Mutex::_no_safepoint_check_flag);
+ return is_ext_suspended() || is_external_suspend();
+ }
+
void Thread::initialize_thread_current() {
#ifndef USE_LIBRARY_BASED_TLS_ONLY
assert(_thr_current == NULL, "Thread::current already initialized");
_thr_current = this;
#endif
< prev index next >