hotspot/src/share/vm/opto/macro.cpp
changeset 9331 9a575ce594ed
parent 7724 a92d706dbdd5
child 9446 748a37b25d10
--- a/hotspot/src/share/vm/opto/macro.cpp	Tue Apr 26 12:14:22 2011 -0700
+++ b/hotspot/src/share/vm/opto/macro.cpp	Wed Apr 27 15:40:36 2011 -0700
@@ -221,9 +221,16 @@
     Node *shift = p2x->unique_out();
     Node *addp = shift->unique_out();
     for (DUIterator_Last jmin, j = addp->last_outs(jmin); j >= jmin; --j) {
-      Node *st = addp->last_out(j);
-      assert(st->is_Store(), "store required");
-      _igvn.replace_node(st, st->in(MemNode::Memory));
+      Node *mem = addp->last_out(j);
+      if (UseCondCardMark && mem->is_Load()) {
+        assert(mem->Opcode() == Op_LoadB, "unexpected code shape");
+        // The load is checking if the card has been written so
+        // replace it with zero to fold the test.
+        _igvn.replace_node(mem, intcon(0));
+        continue;
+      }
+      assert(mem->is_Store(), "store required");
+      _igvn.replace_node(mem, mem->in(MemNode::Memory));
     }
   } else {
     // G1 pre/post barriers