8211046: Forced data dependencies serve no purpose on x86
authordholmes
Fri, 12 Oct 2018 03:51:02 -0400
changeset 52105 537dbfcef4a7
parent 52104 331fbd2db6b5
child 52106 76d526565453
8211046: Forced data dependencies serve no purpose on x86 Reviewed-by: eosterlund, rehn
src/hotspot/cpu/x86/jniFastGetField_x86_64.cpp
--- a/src/hotspot/cpu/x86/jniFastGetField_x86_64.cpp	Fri Oct 12 12:37:13 2018 +0530
+++ b/src/hotspot/cpu/x86/jniFastGetField_x86_64.cpp	Fri Oct 12 03:51:02 2018 -0400
@@ -35,9 +35,6 @@
 
 #define BUFFER_SIZE 30*wordSize
 
-// Instead of issuing lfence for LoadLoad barrier, we create data dependency
-// between loads, which is more efficient than lfence.
-
 // Common register usage:
 // rax/xmm0: result
 // c_rarg0:    jni env
@@ -77,12 +74,6 @@
   __ mov   (robj, c_rarg1);
   __ testb (rcounter, 1);
   __ jcc (Assembler::notZero, slow);
-
-  __ xorptr(robj, rcounter);
-  __ xorptr(robj, rcounter);  // obj, since
-                              // robj ^ rcounter ^ rcounter == robj
-                              // robj is data dependent on rcounter.
-
   __ mov   (roffset, c_rarg2);
   __ shrptr(roffset, 2);                         // offset
 
@@ -103,12 +94,7 @@
     default:        ShouldNotReachHere();
   }
 
-  // create data dependency on rax
-  __ lea(rcounter_addr, counter);
-  __ xorptr(rcounter_addr, rax);
-  __ xorptr(rcounter_addr, rax);
-  __ cmpl (rcounter, Address(rcounter_addr, 0));
-
+  __ cmp32 (rcounter, counter);
   __ jcc (Assembler::notEqual, slow);
 
   __ ret (0);
@@ -178,11 +164,6 @@
   __ testb (rcounter, 1);
   __ jcc (Assembler::notZero, slow);
 
-  __ xorptr(robj, rcounter);
-  __ xorptr(robj, rcounter);  // obj, since
-                              // robj ^ rcounter ^ rcounter == robj
-                              // robj is data dependent on rcounter.
-
   // Both robj and rtmp are clobbered by try_resolve_jobject_in_native.
   BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
   bs->try_resolve_jobject_in_native(masm, /* jni_env */ c_rarg0, robj, rtmp, slow);
@@ -198,13 +179,7 @@
     case T_DOUBLE: __ movdbl (xmm0, Address(robj, roffset, Address::times_1)); break;
     default:        ShouldNotReachHere();
   }
-
-  __ lea(rcounter_addr, counter);
-  __ movdq (rax, xmm0);
-  // counter address is data dependent on xmm0.
-  __ xorptr(rcounter_addr, rax);
-  __ xorptr(rcounter_addr, rax);
-  __ cmpl (rcounter, Address(rcounter_addr, 0));
+  __ cmp32 (rcounter, counter);
   __ jcc (Assembler::notEqual, slow);
 
   __ ret (0);