hotspot/src/share/vm/opto/graphKit.cpp
changeset 39254 fb4492288b01
parent 38658 34f9c45625d8
child 41055 f9014f1e7dfc
--- a/hotspot/src/share/vm/opto/graphKit.cpp	Wed Jun 01 16:36:44 2016 +0200
+++ b/hotspot/src/share/vm/opto/graphKit.cpp	Thu Jun 02 08:46:52 2016 +0200
@@ -4306,8 +4306,15 @@
       } __ end_if();
     } __ end_if();
   } else {
-    // Object.clone() instrinsic uses this path.
-    g1_mark_card(ideal, card_adr, oop_store, alias_idx, index, index_adr, buffer, tf);
+    // The Object.clone() intrinsic uses this path if !ReduceInitialCardMarks.
+    // We don't need a barrier here if the destination is a newly allocated object
+    // in Eden. Otherwise, GC verification breaks because we assume that cards in Eden
+    // are set to 'g1_young_gen' (see G1SATBCardTableModRefBS::verify_g1_young_region()).
+    assert(!use_ReduceInitialCardMarks(), "can only happen with card marking");
+    Node* card_val = __ load(__ ctrl(), card_adr, TypeInt::INT, T_BYTE, Compile::AliasIdxRaw);
+    __ if_then(card_val, BoolTest::ne, young_card); {
+      g1_mark_card(ideal, card_adr, oop_store, alias_idx, index, index_adr, buffer, tf);
+    } __ end_if();
   }
 
   // Final sync IdealKit and GraphKit.