src/hotspot/cpu/ppc/vm_version_ppc.cpp
changeset 50339 ede65c4fb6da
parent 50161 e2d9b38630c3
child 52355 0caa36de8703
--- a/src/hotspot/cpu/ppc/vm_version_ppc.cpp	Fri Jun 01 13:04:30 2018 +0200
+++ b/src/hotspot/cpu/ppc/vm_version_ppc.cpp	Mon May 21 13:23:55 2018 -0400
@@ -131,7 +131,7 @@
   // Create and print feature-string.
   char buf[(num_features+1) * 16]; // Max 16 chars per feature.
   jio_snprintf(buf, sizeof(buf),
-               "ppc64%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
+               "ppc64%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
                (has_fsqrt()   ? " fsqrt"   : ""),
                (has_isel()    ? " isel"    : ""),
                (has_lxarxeh() ? " lxarxeh" : ""),
@@ -148,7 +148,8 @@
                (has_vsx()     ? " vsx"     : ""),
                (has_ldbrx()   ? " ldbrx"   : ""),
                (has_stdbrx()  ? " stdbrx"  : ""),
-               (has_vshasig() ? " sha"     : "")
+               (has_vshasig() ? " sha"     : ""),
+               (has_tm()      ? " rtm"     : "")
                // Make sure number of %s matches num_features!
               );
   _features_string = os::strdup(buf);
@@ -319,47 +320,14 @@
     if (PowerArchitecturePPC64 < 8) {
       vm_exit_during_initialization("RTM instructions are not available on this CPU.");
     }
-    bool os_support_tm = false;
-#ifdef AIX
-    // Actually, this is supported since AIX 7.1.. Unfortunately, this first
-    // contained bugs, so that it can only be enabled after AIX 7.1.3.30.
-    // The Java property os.version, which is used in RTM tests to decide
-    // whether the feature is available, only knows major and minor versions.
-    // We don't want to change this property, as user code might depend on it.
-    // So the tests can not check on subversion 3.30, and we only enable RTM
-    // with AIX 7.2.
-    if (os::Aix::os_version() >= 0x07020000) { // At least AIX 7.2.
-      os_support_tm = true;
-    }
-#endif
-#if defined(LINUX) && defined(VM_LITTLE_ENDIAN)
-    unsigned long auxv = getauxval(AT_HWCAP2);
 
-    if (auxv & PPC_FEATURE2_HTM_NOSC) {
-      if (auxv & PPC_FEATURE2_HAS_HTM) {
-        // TM on POWER8 and POWER9 in compat mode (VM) is supported by the JVM.
-        // TM on POWER9 DD2.1 NV (baremetal) is not supported by the JVM (TM on
-        // POWER9 DD2.1 NV has a few issues that need a couple of firmware
-        // and kernel workarounds, so there is a new mode only supported
-        // on non-virtualized P9 machines called HTM with no Suspend Mode).
-        // TM on POWER9 D2.2+ NV is not supported at all by Linux.
-        os_support_tm = true;
-      }
-    }
-#endif
-    if (!os_support_tm) {
+    if (!has_tm()) {
       vm_exit_during_initialization("RTM is not supported on this OS version.");
     }
   }
 
   if (UseRTMLocking) {
 #if INCLUDE_RTM_OPT
-    if (!UnlockExperimentalVMOptions) {
-      vm_exit_during_initialization("UseRTMLocking is only available as experimental option on this platform. "
-                                    "It must be enabled via -XX:+UnlockExperimentalVMOptions flag.");
-    } else {
-      warning("UseRTMLocking is only available as experimental option on this platform.");
-    }
     if (!FLAG_IS_CMDLINE(UseRTMLocking)) {
       // RTM locking should be used only for applications with
       // high lock contention. For now we do not use it by default.
@@ -755,6 +723,37 @@
   }
 
   _features = features;
+
+#ifdef AIX
+  // To enable it on AIX it's necessary POWER8 or above and at least AIX 7.2.
+  // Actually, this is supported since AIX 7.1.. Unfortunately, this first
+  // contained bugs, so that it can only be enabled after AIX 7.1.3.30.
+  // The Java property os.version, which is used in RTM tests to decide
+  // whether the feature is available, only knows major and minor versions.
+  // We don't want to change this property, as user code might depend on it.
+  // So the tests can not check on subversion 3.30, and we only enable RTM
+  // with AIX 7.2.
+  if (has_lqarx()) { // POWER8 or above
+    if (os::Aix::os_version() >= 0x07020000) { // At least AIX 7.2.
+      _features |= rtm_m;
+    }
+  }
+#endif
+#if defined(LINUX) && defined(VM_LITTLE_ENDIAN)
+  unsigned long auxv = getauxval(AT_HWCAP2);
+
+  if (auxv & PPC_FEATURE2_HTM_NOSC) {
+    if (auxv & PPC_FEATURE2_HAS_HTM) {
+      // TM on POWER8 and POWER9 in compat mode (VM) is supported by the JVM.
+      // TM on POWER9 DD2.1 NV (baremetal) is not supported by the JVM (TM on
+      // POWER9 DD2.1 NV has a few issues that need a couple of firmware
+      // and kernel workarounds, so there is a new mode only supported
+      // on non-virtualized P9 machines called HTM with no Suspend Mode).
+      // TM on POWER9 D2.2+ NV is not supported at all by Linux.
+      _features |= rtm_m;
+    }
+  }
+#endif
 }
 
 // Power 8: Configure Data Stream Control Register.