changeset 8286:15767942af74

8076987: C1 should support conditional card marks (UseCondCardMark) Reviewed-by: iveresov, roland
author shade
date Wed, 22 Apr 2015 19:10:03 +0300
parents 364dd48a2c48
children 88847a1b3718 382e9e4b3b71
files src/share/vm/c1/c1_LIRGenerator.cpp src/share/vm/opto/c2_globals.hpp src/share/vm/runtime/globals.hpp
diffstat 3 files changed, 21 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/c1/c1_LIRGenerator.cpp	Wed Apr 22 21:33:55 2015 +0300
+++ b/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/src/share/vm/opto/c2_globals.hpp	Wed Apr 22 21:33:55 2015 +0300
+++ b/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/src/share/vm/runtime/globals.hpp	Wed Apr 22 21:33:55 2015 +0300
+++ b/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")                                      \
                                                                             \