< prev index next >

src/hotspot/share/opto/phaseX.cpp

Print this page

        

@@ -37,10 +37,13 @@
 #include "opto/opcodes.hpp"
 #include "opto/phaseX.hpp"
 #include "opto/regalloc.hpp"
 #include "opto/rootnode.hpp"
 #include "utilities/macros.hpp"
+#if INCLUDE_SHENANDOAHGC
+#include "gc/shenandoah/c2/shenandoahBarrierSetC2.hpp"
+#endif
 
 //=============================================================================
 #define NODE_HASH_MINIMUM_SIZE    255
 //------------------------------NodeHash---------------------------------------
 NodeHash::NodeHash(uint est_max_size) :

@@ -1373,10 +1376,18 @@
                   _worklist.push(in->fast_out(i));
                   i++;
                 }
                 assert(!(i < imax), "sanity");
               }
+            } else if (dead->Opcode() == Op_ShenandoahWBMemProj) {
+              assert(i == 1 && in->Opcode() == Op_ShenandoahWriteBarrier, "broken graph");
+              _worklist.push(in);
+#if INCLUDE_SHENANDOAHGC
+            // TODO: Move into below call to enqueue_useful_gc_barrier()
+            } else if (in->Opcode() == Op_AddP && ShenandoahBarrierSetC2::has_only_shenandoah_wb_pre_uses(in)) {
+              add_users_to_worklist(in);
+#endif
             } else {
               BarrierSet::barrier_set()->barrier_set_c2()->enqueue_useful_gc_barrier(_worklist, in);
             }
             if (ReduceFieldZeroing && dead->is_Load() && i == MemNode::Memory &&
                 in->is_Proj() && in->in(0) != NULL && in->in(0)->is_Initialize()) {

@@ -1650,10 +1661,17 @@
         if (u->Opcode() == Op_LoadP && ut->isa_instptr()) {
           _worklist.push(u);
         }
       }
     }
+
+    if (use->is_ShenandoahBarrier()) {
+      Node* cmp = use->find_out_with(Op_CmpP);
+      if (cmp != NULL) {
+        _worklist.push(cmp);
+      }
+    }
   }
 }
 
 /**
  * Remove the speculative part of all types that we know of

@@ -1799,10 +1817,29 @@
             if (u->Opcode() == Op_LoadP && ut->isa_instptr() && ut != type(u)) {
               worklist.push(u);
             }
           }
         }
+        if (m->is_ShenandoahBarrier()) {
+          for (DUIterator_Fast i2max, i2 = m->fast_outs(i2max); i2 < i2max; i2++) {
+            Node* p = m->fast_out(i2);
+            if (p->Opcode() == Op_CmpP) {
+              if(p->bottom_type() != type(p)) {
+                worklist.push(p);
+              }
+            } else if (p->Opcode() == Op_AddP) {
+              for (DUIterator_Fast i3max, i3 = p->fast_outs(i3max); i3 < i3max; i3++) {
+                Node* q = p->fast_out(i3);
+                if (q->is_Load()) {
+                  if(q->bottom_type() != type(q)) {
+                    worklist.push(q);
+                  }
+                }
+              }
+            }
+          }
+        }
       }
     }
   }
 }
 

@@ -2059,10 +2096,15 @@
       }
       break;
     default:
       break;
     }
+#if INCLUDE_SHENANDOAHGC
+    if (old->Opcode() == Op_AddP && ShenandoahBarrierSetC2::has_only_shenandoah_wb_pre_uses(old)) {
+      igvn->add_users_to_worklist(old);
+    }
+#endif
   }
 
 }
 
 //-------------------------------replace_by-----------------------------------
< prev index next >