mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-09 21:19:38 +00:00
8219247: Enable inlining of newly introduced PlatformMonitor methods
Reviewed-by: dholmes, rehn
This commit is contained in:
parent
151e628a8e
commit
33d947b7e3
@ -27,6 +27,7 @@
|
||||
#define OS_AIX_OS_AIX_INLINE_HPP
|
||||
|
||||
#include "runtime/os.hpp"
|
||||
#include "os_posix.inline.hpp"
|
||||
|
||||
// System includes
|
||||
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
#define OS_BSD_OS_BSD_INLINE_HPP
|
||||
|
||||
#include "runtime/os.hpp"
|
||||
#include "os_posix.inline.hpp"
|
||||
|
||||
// System includes
|
||||
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -2219,22 +2219,6 @@ os::PlatformMonitor::~PlatformMonitor() {
|
||||
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 @@ int os::PlatformMonitor::wait(jlong millis) {
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
@ -42,6 +42,39 @@ inline int os::Posix::clock_gettime(clockid_t clock_id, struct timespec *tp) {
|
||||
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
|
||||
|
||||
@ -5320,27 +5320,6 @@ void Parker::unpark() {
|
||||
|
||||
// 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 @@ int os::PlatformMonitor::wait(jlong millis) {
|
||||
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) {
|
||||
|
||||
@ -86,4 +86,35 @@ inline void os::exit(int num) {
|
||||
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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user