8219247: Enable inlining of newly introduced PlatformMonitor methods
Reviewed-by: dholmes, rehn
--- a/src/hotspot/os/aix/os_aix.inline.hpp Fri Feb 22 11:10:55 2019 +0530
+++ b/src/hotspot/os/aix/os_aix.inline.hpp Fri Feb 22 09:23:37 2019 +0100
@@ -27,6 +27,7 @@
#define OS_AIX_OS_AIX_INLINE_HPP
#include "runtime/os.hpp"
+#include "os_posix.inline.hpp"
// System includes
--- a/src/hotspot/os/bsd/os_bsd.cpp Fri Feb 22 11:10:55 2019 +0530
+++ b/src/hotspot/os/bsd/os_bsd.cpp Fri Feb 22 09:23:37 2019 +0100
@@ -37,6 +37,7 @@
#include "memory/filemap.hpp"
#include "oops/oop.inline.hpp"
#include "os_bsd.inline.hpp"
+#include "os_posix.inline.hpp"
#include "os_share_bsd.hpp"
#include "prims/jniFastGetField.hpp"
#include "prims/jvm_misc.hpp"
--- a/src/hotspot/os/bsd/os_bsd.inline.hpp Fri Feb 22 11:10:55 2019 +0530
+++ b/src/hotspot/os/bsd/os_bsd.inline.hpp Fri Feb 22 09:23:37 2019 +0100
@@ -26,6 +26,7 @@
#define OS_BSD_OS_BSD_INLINE_HPP
#include "runtime/os.hpp"
+#include "os_posix.inline.hpp"
// System includes
--- a/src/hotspot/os/linux/os_linux.cpp Fri Feb 22 11:10:55 2019 +0530
+++ b/src/hotspot/os/linux/os_linux.cpp Fri Feb 22 09:23:37 2019 +0100
@@ -38,6 +38,7 @@
#include "memory/filemap.hpp"
#include "oops/oop.inline.hpp"
#include "os_linux.inline.hpp"
+#include "os_posix.inline.hpp"
#include "os_share_linux.hpp"
#include "osContainer_linux.hpp"
#include "prims/jniFastGetField.hpp"
--- a/src/hotspot/os/posix/os_posix.cpp Fri Feb 22 11:10:55 2019 +0530
+++ b/src/hotspot/os/posix/os_posix.cpp Fri Feb 22 09:23:37 2019 +0100
@@ -2219,22 +2219,6 @@
assert_status(status == 0, status, "mutex_destroy");
}
-void os::PlatformMonitor::lock() {
- int status = pthread_mutex_lock(&_mutex);
- assert_status(status == 0, status, "mutex_lock");
-}
-
-void os::PlatformMonitor::unlock() {
- int status = pthread_mutex_unlock(&_mutex);
- assert_status(status == 0, status, "mutex_unlock");
-}
-
-bool os::PlatformMonitor::try_lock() {
- int status = pthread_mutex_trylock(&_mutex);
- assert_status(status == 0 || status == EBUSY, status, "mutex_trylock");
- return status == 0;
-}
-
// Must already be locked
int os::PlatformMonitor::wait(jlong millis) {
assert(millis >= 0, "negative timeout");
@@ -2263,14 +2247,4 @@
}
}
-void os::PlatformMonitor::notify() {
- int status = pthread_cond_signal(&_cond);
- assert_status(status == 0, status, "cond_signal");
-}
-
-void os::PlatformMonitor::notify_all() {
- int status = pthread_cond_broadcast(&_cond);
- assert_status(status == 0, status, "cond_broadcast");
-}
-
#endif // !SOLARIS
--- a/src/hotspot/os/posix/os_posix.inline.hpp Fri Feb 22 11:10:55 2019 +0530
+++ b/src/hotspot/os/posix/os_posix.inline.hpp Fri Feb 22 09:23:37 2019 +0100
@@ -42,6 +42,39 @@
inline int os::Posix::clock_getres(clockid_t clock_id, struct timespec *tp) {
return _clock_getres != NULL ? _clock_getres(clock_id, tp) : -1;
}
+
#endif // SUPPORTS_CLOCK_MONOTONIC
+#ifndef SOLARIS
+
+// Platform Monitor implementation
+
+inline void os::PlatformMonitor::lock() {
+ int status = pthread_mutex_lock(&_mutex);
+ assert_status(status == 0, status, "mutex_lock");
+}
+
+inline void os::PlatformMonitor::unlock() {
+ int status = pthread_mutex_unlock(&_mutex);
+ assert_status(status == 0, status, "mutex_unlock");
+}
+
+inline bool os::PlatformMonitor::try_lock() {
+ int status = pthread_mutex_trylock(&_mutex);
+ assert_status(status == 0 || status == EBUSY, status, "mutex_trylock");
+ return status == 0;
+}
+
+inline void os::PlatformMonitor::notify() {
+ int status = pthread_cond_signal(&_cond);
+ assert_status(status == 0, status, "cond_signal");
+}
+
+inline void os::PlatformMonitor::notify_all() {
+ int status = pthread_cond_broadcast(&_cond);
+ assert_status(status == 0, status, "cond_broadcast");
+}
+
+#endif // !SOLARIS
+
#endif // OS_POSIX_OS_POSIX_INLINE_HPP
--- a/src/hotspot/os/windows/os_windows.cpp Fri Feb 22 11:10:55 2019 +0530
+++ b/src/hotspot/os/windows/os_windows.cpp Fri Feb 22 09:23:37 2019 +0100
@@ -5320,27 +5320,6 @@
// Platform Monitor implementation
-os::PlatformMonitor::PlatformMonitor() {
- InitializeConditionVariable(&_cond);
- InitializeCriticalSection(&_mutex);
-}
-
-os::PlatformMonitor::~PlatformMonitor() {
- DeleteCriticalSection(&_mutex);
-}
-
-void os::PlatformMonitor::lock() {
- EnterCriticalSection(&_mutex);
-}
-
-void os::PlatformMonitor::unlock() {
- LeaveCriticalSection(&_mutex);
-}
-
-bool os::PlatformMonitor::try_lock() {
- return TryEnterCriticalSection(&_mutex);
-}
-
// Must already be locked
int os::PlatformMonitor::wait(jlong millis) {
assert(millis >= 0, "negative timeout");
@@ -5359,14 +5338,6 @@
return ret;
}
-void os::PlatformMonitor::notify() {
- WakeConditionVariable(&_cond);
-}
-
-void os::PlatformMonitor::notify_all() {
- WakeAllConditionVariable(&_cond);
-}
-
// Run the specified command in a separate process. Return its exit value,
// or -1 on failure (e.g. can't create a new process).
int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
--- a/src/hotspot/os/windows/os_windows.inline.hpp Fri Feb 22 11:10:55 2019 +0530
+++ b/src/hotspot/os/windows/os_windows.inline.hpp Fri Feb 22 09:23:37 2019 +0100
@@ -86,4 +86,35 @@
win32::exit_process_or_thread(win32::EPT_PROCESS, num);
}
+// Platform Monitor implementation
+
+inline os::PlatformMonitor::PlatformMonitor() {
+ InitializeConditionVariable(&_cond);
+ InitializeCriticalSection(&_mutex);
+}
+
+inline os::PlatformMonitor::~PlatformMonitor() {
+ DeleteCriticalSection(&_mutex);
+}
+
+inline void os::PlatformMonitor::lock() {
+ EnterCriticalSection(&_mutex);
+}
+
+inline void os::PlatformMonitor::unlock() {
+ LeaveCriticalSection(&_mutex);
+}
+
+inline bool os::PlatformMonitor::try_lock() {
+ return TryEnterCriticalSection(&_mutex);
+}
+
+inline void os::PlatformMonitor::notify() {
+ WakeConditionVariable(&_cond);
+}
+
+inline void os::PlatformMonitor::notify_all() {
+ WakeAllConditionVariable(&_cond);
+}
+
#endif // OS_WINDOWS_OS_WINDOWS_INLINE_HPP