8150353: PPC64LE: Support RTM on linux
Reviewed-by: mdoerr, kvn
This commit is contained in:
parent
77c73b6d4f
commit
1c2427a182
hotspot/src
cpu/ppc/vm
os/linux/vm
share/vm/opto
@ -47,7 +47,7 @@ const bool CCallingConventionRequiresIntsAsLongs = true;
|
||||
// The expected size in bytes of a cache line, used to pad data structures.
|
||||
#define DEFAULT_CACHE_LINE_SIZE 128
|
||||
|
||||
#if defined(COMPILER2) && defined(AIX)
|
||||
#if defined(COMPILER2) && (defined(AIX) || defined(linux))
|
||||
// Include Transactional Memory lock eliding optimization
|
||||
#define INCLUDE_RTM_OPT 1
|
||||
#endif
|
||||
|
@ -255,7 +255,16 @@ void VM_Version::initialize() {
|
||||
}
|
||||
#endif
|
||||
#ifdef linux
|
||||
// TODO: check kernel version (we currently have too old versions only)
|
||||
// At least Linux kernel 4.2, as the problematic behavior of syscalls
|
||||
// being called in the middle of a transaction has been addressed.
|
||||
// Please, refer to commit b4b56f9ecab40f3b4ef53e130c9f6663be491894
|
||||
// in Linux kernel source tree: https://goo.gl/Kc5i7A
|
||||
if (os::Linux::os_version_is_known()) {
|
||||
if (os::Linux::os_version() >= 0x040200)
|
||||
os_too_old = false;
|
||||
} else {
|
||||
vm_exit_during_initialization("RTM can not be enabled: kernel version is unknown.");
|
||||
}
|
||||
#endif
|
||||
if (os_too_old) {
|
||||
vm_exit_during_initialization("RTM is not supported on this OS version.");
|
||||
|
@ -144,6 +144,7 @@ pthread_t os::Linux::_main_thread;
|
||||
int os::Linux::_page_size = -1;
|
||||
const int os::Linux::_vm_default_page_size = (8 * K);
|
||||
bool os::Linux::_supports_fast_thread_cpu_time = false;
|
||||
uint32_t os::Linux::_os_version = 0;
|
||||
const char * os::Linux::_glibc_version = NULL;
|
||||
const char * os::Linux::_libpthread_version = NULL;
|
||||
pthread_condattr_t os::Linux::_condattr[1];
|
||||
@ -4356,6 +4357,48 @@ jlong os::Linux::fast_thread_cpu_time(clockid_t clockid) {
|
||||
return (tp.tv_sec * NANOSECS_PER_SEC) + tp.tv_nsec;
|
||||
}
|
||||
|
||||
void os::Linux::initialize_os_info() {
|
||||
assert(_os_version == 0, "OS info already initialized");
|
||||
|
||||
struct utsname _uname;
|
||||
|
||||
uint32_t major;
|
||||
uint32_t minor;
|
||||
uint32_t fix;
|
||||
|
||||
int rc;
|
||||
|
||||
// Kernel version is unknown if
|
||||
// verification below fails.
|
||||
_os_version = 0x01000000;
|
||||
|
||||
rc = uname(&_uname);
|
||||
if (rc != -1) {
|
||||
|
||||
rc = sscanf(_uname.release,"%d.%d.%d", &major, &minor, &fix);
|
||||
if (rc == 3) {
|
||||
|
||||
if (major < 256 && minor < 256 && fix < 256) {
|
||||
// Kernel version format is as expected,
|
||||
// set it overriding unknown state.
|
||||
_os_version = (major << 16) |
|
||||
(minor << 8 ) |
|
||||
(fix << 0 ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t os::Linux::os_version() {
|
||||
assert(_os_version != 0, "not initialized");
|
||||
return _os_version & 0x00FFFFFF;
|
||||
}
|
||||
|
||||
bool os::Linux::os_version_is_known() {
|
||||
assert(_os_version != 0, "not initialized");
|
||||
return _os_version & 0x01000000 ? false : true;
|
||||
}
|
||||
|
||||
/////
|
||||
// glibc on Linux platform uses non-documented flag
|
||||
// to indicate, that some special sort of signal
|
||||
@ -4578,6 +4621,8 @@ void os::init(void) {
|
||||
|
||||
Linux::initialize_system_info();
|
||||
|
||||
Linux::initialize_os_info();
|
||||
|
||||
// main_thread points to the aboriginal thread
|
||||
Linux::_main_thread = pthread_self();
|
||||
|
||||
|
@ -56,6 +56,15 @@ class Linux {
|
||||
|
||||
static GrowableArray<int>* _cpu_to_node;
|
||||
|
||||
// 0x00000000 = uninitialized,
|
||||
// 0x01000000 = kernel version unknown,
|
||||
// otherwise a 32-bit number:
|
||||
// Ox00AABBCC
|
||||
// AA, Major Version
|
||||
// BB, Minor Version
|
||||
// CC, Fix Version
|
||||
static uint32_t _os_version;
|
||||
|
||||
protected:
|
||||
|
||||
static julong _physical_memory;
|
||||
@ -198,6 +207,10 @@ class Linux {
|
||||
|
||||
static jlong fast_thread_cpu_time(clockid_t clockid);
|
||||
|
||||
static void initialize_os_info();
|
||||
static bool os_version_is_known();
|
||||
static uint32_t os_version();
|
||||
|
||||
// pthread_cond clock suppport
|
||||
private:
|
||||
static pthread_condattr_t _condattr[1];
|
||||
|
@ -1118,7 +1118,11 @@ class Compile : public Phase {
|
||||
bool in_scratch_emit_size() const { return _in_scratch_emit_size; }
|
||||
|
||||
enum ScratchBufferBlob {
|
||||
#if defined(PPC64)
|
||||
MAX_inst_size = 2048,
|
||||
#else
|
||||
MAX_inst_size = 1024,
|
||||
#endif
|
||||
MAX_locs_size = 128, // number of relocInfo elements
|
||||
MAX_const_size = 128,
|
||||
MAX_stubs_size = 128
|
||||
|
Loading…
x
Reference in New Issue
Block a user