changeset 12555:695f6ed18723

8171266: PPC64: Add support to -XX:RTMSpinLoopCount=0 Reviewed-by: mdoerr, dholmes
author gromero
date Thu, 15 Dec 2016 08:56:32 -0500
parents 57d199c7daa9
children 9ce93a5a916e
files src/cpu/ppc/vm/macroAssembler_ppc.cpp src/cpu/ppc/vm/vm_version_ppc.cpp
diffstat 2 files changed, 18 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/ppc/vm/macroAssembler_ppc.cpp	Thu Jan 05 09:25:36 2017 +0100
+++ b/src/cpu/ppc/vm/macroAssembler_ppc.cpp	Thu Dec 15 08:56:32 2016 -0500
@@ -2569,7 +2569,7 @@
 }
 
 // Spin and retry if lock is busy.
-// inputs: box_Reg (monitor address)
+// inputs: owner_addr_Reg (monitor address)
 //       : retry_count_Reg
 // output: retry_count_Reg decremented by 1
 // CTR is killed
@@ -2577,15 +2577,22 @@
   Label SpinLoop, doneRetry;
   addic_(retry_count_Reg, retry_count_Reg, -1);
   blt(CCR0, doneRetry);
-  li(R0, RTMSpinLoopCount);
-  mtctr(R0);
+
+  if (RTMSpinLoopCount > 1) {
+    li(R0, RTMSpinLoopCount);
+    mtctr(R0);
+  }
 
   bind(SpinLoop);
   smt_yield(); // Can't use waitrsv(). No permission (SIGILL).
-  bdz(retryLabel);
-  ld(R0, 0, owner_addr_Reg);
-  cmpdi(CCR0, R0, 0);
-  bne(CCR0, SpinLoop);
+
+  if (RTMSpinLoopCount > 1) {
+    bdz(retryLabel);
+    ld(R0, 0, owner_addr_Reg);
+    cmpdi(CCR0, R0, 0);
+    bne(CCR0, SpinLoop);
+  }
+
   b(retryLabel);
 
   bind(doneRetry);
--- a/src/cpu/ppc/vm/vm_version_ppc.cpp	Thu Jan 05 09:25:36 2017 +0100
+++ b/src/cpu/ppc/vm/vm_version_ppc.cpp	Thu Dec 15 08:56:32 2016 -0500
@@ -327,7 +327,10 @@
       warning("RTMAbortRatio must be in the range 0 to 100, resetting it to 50");
       FLAG_SET_DEFAULT(RTMAbortRatio, 50);
     }
-    guarantee(RTMSpinLoopCount > 0, "unsupported");
+    if (RTMSpinLoopCount < 0) {
+      warning("RTMSpinLoopCount must not be a negative value, resetting it to 0");
+      FLAG_SET_DEFAULT(RTMSpinLoopCount, 0);
+    }
 #else
     // Only C2 does RTM locking optimization.
     // Can't continue because UseRTMLocking affects UseBiasedLocking flag