8028515: PPPC64 (part 113.2): opto: Introduce LoadFence/StoreFence.
authorgoetz
Tue, 26 Nov 2013 18:38:19 -0800
changeset 22855 d637fd28a6c3
parent 22854 2787e48d6df9
child 22856 03ad2cf18166
8028515: PPPC64 (part 113.2): opto: Introduce LoadFence/StoreFence. Summary: Use new nodes for loadFence/storeFence intrinsics in C2. Reviewed-by: kvn, dholmes
hotspot/make/jprt.properties
hotspot/src/cpu/sparc/vm/sparc.ad
hotspot/src/cpu/x86/vm/x86_32.ad
hotspot/src/cpu/x86/vm/x86_64.ad
hotspot/src/share/vm/adlc/formssel.cpp
hotspot/src/share/vm/opto/classes.hpp
hotspot/src/share/vm/opto/library_call.cpp
hotspot/src/share/vm/opto/matcher.cpp
hotspot/src/share/vm/opto/memnode.cpp
hotspot/src/share/vm/opto/memnode.hpp
hotspot/src/share/vm/runtime/vmStructs.cpp
--- a/hotspot/make/jprt.properties	Fri Nov 22 12:14:09 2013 -0800
+++ b/hotspot/make/jprt.properties	Tue Nov 26 18:38:19 2013 -0800
@@ -329,9 +329,81 @@
 
 # The complete list of test targets for jprt
 # Note: no PPC or ARM tests at this stage
+jprt.my.linux.armvfpsflt.test.targets.embedded = \
+    linux_armvfpsflt_2.6-{productEmb|fastdebugEmb}-{c1|c2}-scimark, \
+    linux_armvfpsflt_2.6-{productEmb|fastdebugEmb}-{c1|c2}-GCBasher_default, \
+    linux_armvfpsflt_2.6-{productEmb|fastdebugEmb}-{c1|c2}-GCBasher_SerialGC, \
+    linux_armvfpsflt_2.6-{productEmb|fastdebugEmb}-{c1|c2}-GCBasher_ParallelGC, \
+    linux_armvfpsflt_2.6-{productEmb|fastdebugEmb}-{c1|c2}-GCBasher_ParNewGC, \
+    linux_armvfpsflt_2.6-{productEmb|fastdebugEmb}-{c1|c2}-GCBasher_CMS, \
+    linux_armvfpsflt_2.6-{productEmb|fastdebugEmb}-{c1|c2}-GCBasher_G1, \
+    linux_armvfpsflt_2.6-{productEmb|fastdebugEmb}-{c1|c2}-GCBasher_ParOldGC, \
+    linux_armvfpsflt_2.6-productEmb-{c1|c2}-GCOld_default, \
+    linux_armvfpsflt_2.6-productEmb-{c1|c2}-GCOld_SerialGC, \
+    linux_armvfpsflt_2.6-productEmb-{c1|c2}-GCOld_ParallelGC, \
+    linux_armvfpsflt_2.6-productEmb-{c1|c2}-GCOld_ParNewGC, \
+    linux_armvfpsflt_2.6-productEmb-{c1|c2}-GCOld_CMS, \
+    linux_armvfpsflt_2.6-productEmb-{c1|c2}-GCOld_G1, \
+    linux_armvfpsflt_2.6-productEmb-{c1|c2}-GCOld_ParOldGC, \
+    linux_armvfpsflt_2.6-{productEmb|fastdebugEmb}-c1-jbb_default, \
+    linux_armvfpsflt_2.6-{productEmb|fastdebugEmb}-c2-jbb_default_nontiered, \
+    linux_armvfpsflt_2.6-{productEmb|fastdebugEmb}-c1-jbb_ParallelGC, \
+    linux_armvfpsflt_2.6-{productEmb|fastdebugEmb}-c1-jbb_CMS, \
+    linux_armvfpsflt_2.6-{productEmb|fastdebugEmb}-c1-jbb_G1, \
+    linux_armvfpsflt_2.6-{productEmb|fastdebugEmb}-c1-jbb_ParOldGC
+
+# QEMU Emulators for ARM VFP HFLT
+jprt.my.linux.armvfphflt.test.targets.embedded = \
+    linux_armvfphflt_2.6-{productEmb|fastdebugEmb}-{c1|c2}-scimark, \
+    linux_armvfphflt_2.6-{productEmb|fastdebugEmb}-{c1|c2}-GCBasher_default, \
+    linux_armvfphflt_2.6-{productEmb|fastdebugEmb}-{c1|c2}-GCBasher_SerialGC, \
+    linux_armvfphflt_2.6-{productEmb|fastdebugEmb}-{c1|c2}-GCBasher_ParallelGC, \
+    linux_armvfphflt_2.6-{productEmb|fastdebugEmb}-{c1|c2}-GCBasher_ParNewGC, \
+    linux_armvfphflt_2.6-{productEmb|fastdebugEmb}-{c1|c2}-GCBasher_CMS, \
+    linux_armvfphflt_2.6-{productEmb|fastdebugEmb}-{c1|c2}-GCBasher_G1, \
+    linux_armvfphflt_2.6-{productEmb|fastdebugEmb}-{c1|c2}-GCBasher_ParOldGC, \
+    linux_armvfphflt_2.6-productEmb-{c1|c2}-GCOld_default, \
+    linux_armvfphflt_2.6-productEmb-{c1|c2}-GCOld_SerialGC, \
+    linux_armvfphflt_2.6-productEmb-{c1|c2}-GCOld_ParallelGC, \
+    linux_armvfphflt_2.6-productEmb-{c1|c2}-GCOld_ParNewGC, \
+    linux_armvfphflt_2.6-productEmb-{c1|c2}-GCOld_CMS, \
+    linux_armvfphflt_2.6-productEmb-{c1|c2}-GCOld_G1, \
+    linux_armvfphflt_2.6-productEmb-{c1|c2}-GCOld_ParOldGC, \
+    linux_armvfphflt_2.6-{productEmb|fastdebugEmb}-c1-jbb_default, \
+    linux_armvfphflt_2.6-{productEmb|fastdebugEmb}-c2-jbb_default_nontiered, \
+    linux_armvfphflt_2.6-{productEmb|fastdebugEmb}-c1-jbb_ParallelGC, \
+    linux_armvfphflt_2.6-{productEmb|fastdebugEmb}-c1-jbb_CMS, \
+    linux_armvfphflt_2.6-{productEmb|fastdebugEmb}-c1-jbb_G1, \
+    linux_armvfphflt_2.6-{productEmb|fastdebugEmb}-c1-jbb_ParOldGC
+
+jprt.my.linux.ppc.test.targets.embedded = \
+    linux_ppc_2.6-{productEmb|fastdebugEmb}-{c1|c2}-scimark, \
+    linux_ppc_2.6-{productEmb|fastdebugEmb}-{c1|c2}-GCBasher_default, \
+    linux_ppc_2.6-{productEmb|fastdebugEmb}-{c1|c2}-GCBasher_SerialGC, \
+    linux_ppc_2.6-{productEmb|fastdebugEmb}-{c1|c2}-GCBasher_ParallelGC, \
+    linux_ppc_2.6-{productEmb|fastdebugEmb}-{c1|c2}-GCBasher_ParNewGC, \
+    linux_ppc_2.6-{productEmb|fastdebugEmb}-{c1|c2}-GCBasher_CMS, \
+    linux_ppc_2.6-{productEmb|fastdebugEmb}-{c1|c2}-GCBasher_G1, \
+    linux_ppc_2.6-{productEmb|fastdebugEmb}-{c1|c2}-GCBasher_ParOldGC, \
+    linux_ppc_2.6-productEmb-{c1|c2}-GCOld_default, \
+    linux_ppc_2.6-productEmb-{c1|c2}-GCOld_SerialGC, \
+    linux_ppc_2.6-productEmb-{c1|c2}-GCOld_ParallelGC, \
+    linux_ppc_2.6-productEmb-{c1|c2}-GCOld_ParNewGC, \
+    linux_ppc_2.6-productEmb-{c1|c2}-GCOld_CMS, \
+    linux_ppc_2.6-productEmb-{c1|c2}-GCOld_G1, \
+    linux_ppc_2.6-productEmb-{c1|c2}-GCOld_ParOldGC, \
+    linux_ppc_2.6-{productEmb|fastdebugEmb}-c1-jbb_default, \
+    linux_ppc_2.6-{productEmb|fastdebugEmb}-c2-jbb_default_nontiered, \
+    linux_ppc_2.6-{productEmb|fastdebugEmb}-c1-jbb_ParallelGC, \
+    linux_ppc_2.6-{productEmb|fastdebugEmb}-c1-jbb_CMS, \
+    linux_ppc_2.6-{productEmb|fastdebugEmb}-c1-jbb_G1, \
+    linux_ppc_2.6-{productEmb|fastdebugEmb}-c1-jbb_ParOldGC
 
 jprt.test.targets.standard = \
   ${jprt.my.linux.i586.test.targets.embedded}, \
+  ${jprt.my.linux.armvfpsflt.test.targets.embedded}, \
+  ${jprt.my.linux.armvfphflt.test.targets.embedded}, \
+  ${jprt.my.linux.ppc.test.targets.embedded}, \
   ${jprt.my.solaris.sparcv9.test.targets}, \
   ${jprt.my.solaris.x64.test.targets}, \
   ${jprt.my.linux.i586.test.targets}, \
--- a/hotspot/src/cpu/sparc/vm/sparc.ad	Fri Nov 22 12:14:09 2013 -0800
+++ b/hotspot/src/cpu/sparc/vm/sparc.ad	Tue Nov 26 18:38:19 2013 -0800
@@ -6651,6 +6651,7 @@
 
 instruct membar_acquire() %{
   match(MemBarAcquire);
+  match(LoadFence);
   ins_cost(4*MEMORY_REF_COST);
 
   size(0);
@@ -6671,6 +6672,7 @@
 
 instruct membar_release() %{
   match(MemBarRelease);
+  match(StoreFence);
   ins_cost(4*MEMORY_REF_COST);
 
   size(0);
--- a/hotspot/src/cpu/x86/vm/x86_32.ad	Fri Nov 22 12:14:09 2013 -0800
+++ b/hotspot/src/cpu/x86/vm/x86_32.ad	Tue Nov 26 18:38:19 2013 -0800
@@ -7096,6 +7096,7 @@
 
 instruct membar_acquire() %{
   match(MemBarAcquire);
+  match(LoadFence);
   ins_cost(400);
 
   size(0);
@@ -7116,6 +7117,7 @@
 
 instruct membar_release() %{
   match(MemBarRelease);
+  match(StoreFence);
   ins_cost(400);
 
   size(0);
--- a/hotspot/src/cpu/x86/vm/x86_64.ad	Fri Nov 22 12:14:09 2013 -0800
+++ b/hotspot/src/cpu/x86/vm/x86_64.ad	Tue Nov 26 18:38:19 2013 -0800
@@ -6345,6 +6345,7 @@
 instruct membar_acquire()
 %{
   match(MemBarAcquire);
+  match(LoadFence);
   ins_cost(0);
 
   size(0);
@@ -6367,6 +6368,7 @@
 instruct membar_release()
 %{
   match(MemBarRelease);
+  match(StoreFence);
   ins_cost(0);
 
   size(0);
--- a/hotspot/src/share/vm/adlc/formssel.cpp	Fri Nov 22 12:14:09 2013 -0800
+++ b/hotspot/src/share/vm/adlc/formssel.cpp	Tue Nov 26 18:38:19 2013 -0800
@@ -648,6 +648,8 @@
   if( strcmp(_matrule->_opType,"MemBarReleaseLock") == 0 ) return true;
   if( strcmp(_matrule->_opType,"MemBarAcquireLock") == 0 ) return true;
   if( strcmp(_matrule->_opType,"MemBarStoreStore") == 0 ) return true;
+  if( strcmp(_matrule->_opType,"StoreFence") == 0 ) return true;
+  if( strcmp(_matrule->_opType,"LoadFence") == 0 ) return true;
 
   return false;
 }
@@ -4054,13 +4056,15 @@
 bool MatchRule::is_ideal_membar() const {
   if( !_opType ) return false;
   return
-    !strcmp(_opType,"MemBarAcquire"  ) ||
-    !strcmp(_opType,"MemBarRelease"  ) ||
+    !strcmp(_opType,"MemBarAcquire") ||
+    !strcmp(_opType,"MemBarRelease") ||
     !strcmp(_opType,"MemBarAcquireLock") ||
     !strcmp(_opType,"MemBarReleaseLock") ||
-    !strcmp(_opType,"MemBarVolatile" ) ||
-    !strcmp(_opType,"MemBarCPUOrder" ) ||
-    !strcmp(_opType,"MemBarStoreStore" );
+    !strcmp(_opType,"LoadFence" ) ||
+    !strcmp(_opType,"StoreFence") ||
+    !strcmp(_opType,"MemBarVolatile") ||
+    !strcmp(_opType,"MemBarCPUOrder") ||
+    !strcmp(_opType,"MemBarStoreStore");
 }
 
 bool MatchRule::is_ideal_loadPC() const {
--- a/hotspot/src/share/vm/opto/classes.hpp	Fri Nov 22 12:14:09 2013 -0800
+++ b/hotspot/src/share/vm/opto/classes.hpp	Tue Nov 26 18:38:19 2013 -0800
@@ -175,9 +175,11 @@
 macro(MathExactL)
 macro(MaxI)
 macro(MemBarAcquire)
+macro(LoadFence)
 macro(MemBarAcquireLock)
 macro(MemBarCPUOrder)
 macro(MemBarRelease)
+macro(StoreFence)
 macro(MemBarReleaseLock)
 macro(MemBarVolatile)
 macro(MemBarStoreStore)
--- a/hotspot/src/share/vm/opto/library_call.cpp	Fri Nov 22 12:14:09 2013 -0800
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Tue Nov 26 18:38:19 2013 -0800
@@ -3105,10 +3105,10 @@
   insert_mem_bar(Op_MemBarCPUOrder);
   switch(id) {
     case vmIntrinsics::_loadFence:
-      insert_mem_bar(Op_MemBarAcquire);
+      insert_mem_bar(Op_LoadFence);
       return true;
     case vmIntrinsics::_storeFence:
-      insert_mem_bar(Op_MemBarRelease);
+      insert_mem_bar(Op_StoreFence);
       return true;
     case vmIntrinsics::_fullFence:
       insert_mem_bar(Op_MemBarVolatile);
--- a/hotspot/src/share/vm/opto/matcher.cpp	Fri Nov 22 12:14:09 2013 -0800
+++ b/hotspot/src/share/vm/opto/matcher.cpp	Tue Nov 26 18:38:19 2013 -0800
@@ -2333,7 +2333,7 @@
 bool Matcher::post_store_load_barrier(const Node* vmb) {
   Compile* C = Compile::current();
   assert(vmb->is_MemBar(), "");
-  assert(vmb->Opcode() != Op_MemBarAcquire, "");
+  assert(vmb->Opcode() != Op_MemBarAcquire && vmb->Opcode() != Op_LoadFence, "");
   const MemBarNode* membar = vmb->as_MemBar();
 
   // Get the Ideal Proj node, ctrl, that can be used to iterate forward
@@ -2378,7 +2378,7 @@
     if (x->is_MemBar()) {
       // We must retain this membar if there is an upcoming volatile
       // load, which will be followed by acquire membar.
-      if (xop == Op_MemBarAcquire) {
+      if (xop == Op_MemBarAcquire || xop == Op_LoadFence) {
         return false;
       } else {
         // For other kinds of barriers, check by pretending we
--- a/hotspot/src/share/vm/opto/memnode.cpp	Fri Nov 22 12:14:09 2013 -0800
+++ b/hotspot/src/share/vm/opto/memnode.cpp	Tue Nov 26 18:38:19 2013 -0800
@@ -1002,9 +1002,13 @@
     // a synchronized region.
     while (current->is_Proj()) {
       int opc = current->in(0)->Opcode();
-      if ((final && (opc == Op_MemBarAcquire || opc == Op_MemBarAcquireLock)) ||
-          opc == Op_MemBarRelease || opc == Op_MemBarCPUOrder ||
-          opc == Op_MemBarReleaseLock) {
+      if ((final && (opc == Op_MemBarAcquire ||
+                     opc == Op_MemBarAcquireLock ||
+                     opc == Op_LoadFence)) ||
+          opc == Op_MemBarRelease ||
+          opc == Op_StoreFence ||
+          opc == Op_MemBarReleaseLock ||
+          opc == Op_MemBarCPUOrder) {
         Node* mem = current->in(0)->in(TypeFunc::Memory);
         if (mem->is_MergeMem()) {
           MergeMemNode* merge = mem->as_MergeMem();
@@ -2973,15 +2977,17 @@
 //------------------------------make-------------------------------------------
 MemBarNode* MemBarNode::make(Compile* C, int opcode, int atp, Node* pn) {
   switch (opcode) {
-  case Op_MemBarAcquire:   return new(C) MemBarAcquireNode(C,  atp, pn);
-  case Op_MemBarRelease:   return new(C) MemBarReleaseNode(C,  atp, pn);
-  case Op_MemBarAcquireLock: return new(C) MemBarAcquireLockNode(C,  atp, pn);
-  case Op_MemBarReleaseLock: return new(C) MemBarReleaseLockNode(C,  atp, pn);
-  case Op_MemBarVolatile:  return new(C) MemBarVolatileNode(C, atp, pn);
-  case Op_MemBarCPUOrder:  return new(C) MemBarCPUOrderNode(C, atp, pn);
-  case Op_Initialize:      return new(C) InitializeNode(C,     atp, pn);
-  case Op_MemBarStoreStore: return new(C) MemBarStoreStoreNode(C,  atp, pn);
-  default:                 ShouldNotReachHere(); return NULL;
+  case Op_MemBarAcquire:     return new(C) MemBarAcquireNode(C, atp, pn);
+  case Op_LoadFence:         return new(C) LoadFenceNode(C, atp, pn);
+  case Op_MemBarRelease:     return new(C) MemBarReleaseNode(C, atp, pn);
+  case Op_StoreFence:        return new(C) StoreFenceNode(C, atp, pn);
+  case Op_MemBarAcquireLock: return new(C) MemBarAcquireLockNode(C, atp, pn);
+  case Op_MemBarReleaseLock: return new(C) MemBarReleaseLockNode(C, atp, pn);
+  case Op_MemBarVolatile:    return new(C) MemBarVolatileNode(C, atp, pn);
+  case Op_MemBarCPUOrder:    return new(C) MemBarCPUOrderNode(C, atp, pn);
+  case Op_Initialize:        return new(C) InitializeNode(C, atp, pn);
+  case Op_MemBarStoreStore:  return new(C) MemBarStoreStoreNode(C, atp, pn);
+  default: ShouldNotReachHere(); return NULL;
   }
 }
 
--- a/hotspot/src/share/vm/opto/memnode.hpp	Fri Nov 22 12:14:09 2013 -0800
+++ b/hotspot/src/share/vm/opto/memnode.hpp	Tue Nov 26 18:38:19 2013 -0800
@@ -994,6 +994,17 @@
   virtual int Opcode() const;
 };
 
+// "Acquire" - no following ref can move before (but earlier refs can
+// follow, like an early Load stalled in cache).  Requires multi-cpu
+// visibility.  Inserted independ of any load, as required
+// for intrinsic sun.misc.Unsafe.loadFence().
+class LoadFenceNode: public MemBarNode {
+public:
+  LoadFenceNode(Compile* C, int alias_idx, Node* precedent)
+    : MemBarNode(C, alias_idx, precedent) {}
+  virtual int Opcode() const;
+};
+
 // "Release" - no earlier ref can move after (but later refs can move
 // up, like a speculative pipelined cache-hitting Load).  Requires
 // multi-cpu visibility.  Inserted before a volatile store.
@@ -1004,6 +1015,17 @@
   virtual int Opcode() const;
 };
 
+// "Release" - no earlier ref can move after (but later refs can move
+// up, like a speculative pipelined cache-hitting Load).  Requires
+// multi-cpu visibility.  Inserted independent of any store, as required
+// for intrinsic sun.misc.Unsafe.storeFence().
+class StoreFenceNode: public MemBarNode {
+public:
+  StoreFenceNode(Compile* C, int alias_idx, Node* precedent)
+    : MemBarNode(C, alias_idx, precedent) {}
+  virtual int Opcode() const;
+};
+
 // "Acquire" - no following ref can move before (but earlier refs can
 // follow, like an early Load stalled in cache).  Requires multi-cpu
 // visibility.  Inserted after a FastLock.
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Fri Nov 22 12:14:09 2013 -0800
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Tue Nov 26 18:38:19 2013 -0800
@@ -1820,6 +1820,8 @@
   declare_c2_type(MemBarNode, MultiNode)                                  \
   declare_c2_type(MemBarAcquireNode, MemBarNode)                          \
   declare_c2_type(MemBarReleaseNode, MemBarNode)                          \
+  declare_c2_type(LoadFenceNode, MemBarNode)                              \
+  declare_c2_type(StoreFenceNode, MemBarNode)                             \
   declare_c2_type(MemBarVolatileNode, MemBarNode)                         \
   declare_c2_type(MemBarCPUOrderNode, MemBarNode)                         \
   declare_c2_type(InitializeNode, MemBarNode)                             \