8171266: PPC64: Add support to -XX:RTMSpinLoopCount=0
Reviewed-by: mdoerr, dholmes
--- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp Thu Jan 05 09:25:36 2017 +0100
+++ b/hotspot/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/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp Thu Jan 05 09:25:36 2017 +0100
+++ b/hotspot/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