--- old/src/share/vm/c1/c1_LIRGenerator.cpp 2015-04-06 00:47:13.687989498 +0300 +++ new/src/share/vm/c1/c1_LIRGenerator.cpp 2015-04-06 00:47:13.635992953 +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 } --- old/src/share/vm/opto/c2_globals.hpp 2015-04-06 00:47:13.891975943 +0300 +++ new/src/share/vm/opto/c2_globals.hpp 2015-04-06 00:47:13.839979398 +0300 @@ -590,9 +590,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") \ \ --- old/src/share/vm/runtime/globals.hpp 2015-04-06 00:47:14.079963454 +0300 +++ new/src/share/vm/runtime/globals.hpp 2015-04-06 00:47:14.019967440 +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") \ \