8076987: C1 should support conditional card marks (UseCondCardMark)
authorshade
Wed, 22 Apr 2015 19:10:03 +0300
changeset 30302 ecca632210ef
parent 30301 8ebb82d73cbc
child 30303 c703c89fddbf
child 30305 b92a97e1e9cb
8076987: C1 should support conditional card marks (UseCondCardMark) Reviewed-by: iveresov, roland
hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
hotspot/src/share/vm/opto/c2_globals.hpp
hotspot/src/share/vm/runtime/globals.hpp
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Wed Apr 22 21:33:55 2015 +0300
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Wed Apr 22 19:10:03 2015 +0300
@@ -1606,13 +1606,26 @@
   } else {
     __ unsigned_shift_right(addr, CardTableModRefBS::card_shift, tmp);
   }
+
+  LIR_Address* card_addr;
   if (can_inline_as_constant(card_table_base)) {
-    __ move(LIR_OprFact::intConst(0),
-              new LIR_Address(tmp, card_table_base->as_jint(), T_BYTE));
+    card_addr = new LIR_Address(tmp, card_table_base->as_jint(), T_BYTE);
   } else {
-    __ move(LIR_OprFact::intConst(0),
-              new LIR_Address(tmp, load_constant(card_table_base),
-                              T_BYTE));
+    card_addr = new LIR_Address(tmp, load_constant(card_table_base), T_BYTE);
+  }
+
+  LIR_Opr dirty = LIR_OprFact::intConst(CardTableModRefBS::dirty_card_val());
+  if (UseCondCardMark) {
+    LIR_Opr cur_value = new_register(T_INT);
+    __ move(card_addr, cur_value);
+
+    LabelObj* L_already_dirty = new LabelObj();
+    __ cmp(lir_cond_equal, cur_value, dirty);
+    __ branch(lir_cond_equal, T_BYTE, L_already_dirty->label());
+    __ move(dirty, card_addr);
+    __ branch_destination(L_already_dirty->label());
+  } else {
+    __ move(dirty, card_addr);
   }
 #endif
 }
--- a/hotspot/src/share/vm/opto/c2_globals.hpp	Wed Apr 22 21:33:55 2015 +0300
+++ b/hotspot/src/share/vm/opto/c2_globals.hpp	Wed Apr 22 19:10:03 2015 +0300
@@ -593,9 +593,6 @@
   develop(bool, PoisonOSREntry, true,                                       \
            "Detect abnormal calls to OSR code")                             \
                                                                             \
-  product(bool, UseCondCardMark, false,                                     \
-          "Check for already marked card before updating card table")       \
-                                                                            \
   develop(bool, SoftMatchFailure, trueInProduct,                            \
           "If the DFA fails to match a node, print a message and bail out") \
                                                                             \
--- a/hotspot/src/share/vm/runtime/globals.hpp	Wed Apr 22 21:33:55 2015 +0300
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Wed Apr 22 19:10:03 2015 +0300
@@ -2235,6 +2235,9 @@
           "When +ReduceInitialCardMarks, explicitly defer any that "        \
           "may arise from new_pre_store_barrier")                           \
                                                                             \
+  product(bool, UseCondCardMark, false,                                     \
+          "Check for already marked card before updating card table")       \
+                                                                            \
   diagnostic(bool, VerifyRememberedSets, false,                             \
           "Verify GC remembered sets")                                      \
                                                                             \