comparison src/cpu/sparc/vm/macroAssembler_sparc.cpp @ 12835:69944b868a32

8014555: G1: Memory ordering problem with Conc refinement and card marking Summary: Add a StoreLoad barrier in the G1 post-barrier to fix a race with concurrent refinement. Also-reviewed-by: martin.doerr@sap.com Reviewed-by: iveresov, tschatzl, brutisso, roland, kvn
author mgerdin
date Tue, 08 Oct 2013 17:35:51 +0200
parents 7944aba7ba41
children 252d541466ea 209aa13ab8c0
comparison
equal deleted inserted replaced
12834:04b18a42c2f3 12835:69944b868a32
3750 CodeBuffer buf(bb); 3750 CodeBuffer buf(bb);
3751 MacroAssembler masm(&buf); 3751 MacroAssembler masm(&buf);
3752 #define __ masm. 3752 #define __ masm.
3753 address start = __ pc(); 3753 address start = __ pc();
3754 3754
3755 Label not_already_dirty, restart, refill; 3755 Label not_already_dirty, restart, refill, young_card;
3756 3756
3757 #ifdef _LP64 3757 #ifdef _LP64
3758 __ srlx(O0, CardTableModRefBS::card_shift, O0); 3758 __ srlx(O0, CardTableModRefBS::card_shift, O0);
3759 #else 3759 #else
3760 __ srl(O0, CardTableModRefBS::card_shift, O0); 3760 __ srl(O0, CardTableModRefBS::card_shift, O0);
3761 #endif 3761 #endif
3762 AddressLiteral addrlit(byte_map_base); 3762 AddressLiteral addrlit(byte_map_base);
3763 __ set(addrlit, O1); // O1 := <card table base> 3763 __ set(addrlit, O1); // O1 := <card table base>
3764 __ ldub(O0, O1, O2); // O2 := [O0 + O1] 3764 __ ldub(O0, O1, O2); // O2 := [O0 + O1]
3765 3765
3766 __ cmp_and_br_short(O2, G1SATBCardTableModRefBS::g1_young_card_val(), Assembler::equal, Assembler::pt, young_card);
3767
3768 __ membar(Assembler::Membar_mask_bits(Assembler::StoreLoad));
3769 __ ldub(O0, O1, O2); // O2 := [O0 + O1]
3770
3766 assert(CardTableModRefBS::dirty_card_val() == 0, "otherwise check this code"); 3771 assert(CardTableModRefBS::dirty_card_val() == 0, "otherwise check this code");
3767 __ cmp_and_br_short(O2, G0, Assembler::notEqual, Assembler::pt, not_already_dirty); 3772 __ cmp_and_br_short(O2, G0, Assembler::notEqual, Assembler::pt, not_already_dirty);
3768 3773
3774 __ bind(young_card);
3769 // We didn't take the branch, so we're already dirty: return. 3775 // We didn't take the branch, so we're already dirty: return.
3770 // Use return-from-leaf 3776 // Use return-from-leaf
3771 __ retl(); 3777 __ retl();
3772 __ delayed()->nop(); 3778 __ delayed()->nop();
3773 3779