< prev index next >

src/share/vm/opto/superword.cpp

Print this page

        

@@ -1686,11 +1686,11 @@
     Node *n = lp()->fast_out(i);
     if (in_bb(n) && (n->is_Phi() && n->bottom_type() == Type::MEMORY)) {
       Node* n_tail  = n->in(LoopNode::LoopBackControl);
       if (n_tail != n->in(LoopNode::EntryControl)) {
         if (!n_tail->is_Mem()) {
-          assert(n_tail->is_Mem(), err_msg_res("unexpected node for memory slice: %s", n_tail->Name()));
+          assert(n_tail->is_Mem() || n_tail == n, err_msg_res("unexpected node for memory slice: %s", n_tail->Name()));
           return false; // Bailout
         }
         _mem_slice_head.push(n);
         _mem_slice_tail.push(n_tail);
       }

@@ -2323,10 +2323,31 @@
   //unsafe reference could not be aligned appropriately without runtime checking
   if (base == NULL || base->bottom_type() == Type::TOP) {
     assert(!valid(), "unsafe access");
     return;
   }
+  if (UseShenandoahGC) {
+    // Detect a Shenandoah write barrier between the pre and main loop
+    // (which could break loop alignment code)
+    CountedLoopNode *main_head = slp->lp()->as_CountedLoop();
+    if (main_head->is_main_loop()) {
+      Node* c = main_head->in(LoopNode::EntryControl)->in(0)->in(0)->in(0);
+      if (!c->is_CountedLoopEnd()) {
+        // in case of a reserve copy
+        c = c->in(0)->in(0);
+        assert(c->is_CountedLoopEnd(), "where's the pre loop?");
+      }
+      CountedLoopEndNode* pre_end = c->as_CountedLoopEnd();
+      CountedLoopNode* pre_loop = pre_end->loopnode();
+      assert(pre_loop->is_pre_loop(), "where's the pre loop?");
+      
+      Node* base_c = phase()->get_ctrl(base);
+      if (!phase()->is_dominator(base_c, pre_loop)) {
+        return;
+      }
+    }
+  }
   for (int i = 0; i < 3; i++) {
     if (!scaled_iv_plus_offset(adr->in(AddPNode::Offset))) {
       assert(!valid(), "too complex");
       return;
     }
< prev index next >