comparison src/cpu/sparc/vm/c1_Runtime1_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 f98f5d48f511
children f50418dfb1b7
comparison
equal deleted inserted replaced
12834:04b18a42c2f3 12835:69944b868a32
35 #include "runtime/sharedRuntime.hpp" 35 #include "runtime/sharedRuntime.hpp"
36 #include "runtime/signature.hpp" 36 #include "runtime/signature.hpp"
37 #include "runtime/vframeArray.hpp" 37 #include "runtime/vframeArray.hpp"
38 #include "utilities/macros.hpp" 38 #include "utilities/macros.hpp"
39 #include "vmreg_sparc.inline.hpp" 39 #include "vmreg_sparc.inline.hpp"
40 #if INCLUDE_ALL_GCS
41 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
42 #endif
40 43
41 // Implementation of StubAssembler 44 // Implementation of StubAssembler
42 45
43 int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry_point, int number_of_arguments) { 46 int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry_point, int number_of_arguments) {
44 // for sparc changing the number of arguments doesn't change 47 // for sparc changing the number of arguments doesn't change
910 Register cardtable = G5; 913 Register cardtable = G5;
911 Register tmp = G1_scratch; 914 Register tmp = G1_scratch;
912 Register tmp2 = G3_scratch; 915 Register tmp2 = G3_scratch;
913 jbyte* byte_map_base = ((CardTableModRefBS*)bs)->byte_map_base; 916 jbyte* byte_map_base = ((CardTableModRefBS*)bs)->byte_map_base;
914 917
915 Label not_already_dirty, restart, refill; 918 Label not_already_dirty, restart, refill, young_card;
916 919
917 #ifdef _LP64 920 #ifdef _LP64
918 __ srlx(addr, CardTableModRefBS::card_shift, addr); 921 __ srlx(addr, CardTableModRefBS::card_shift, addr);
919 #else 922 #else
920 __ srl(addr, CardTableModRefBS::card_shift, addr); 923 __ srl(addr, CardTableModRefBS::card_shift, addr);
922 925
923 AddressLiteral rs(byte_map_base); 926 AddressLiteral rs(byte_map_base);
924 __ set(rs, cardtable); // cardtable := <card table base> 927 __ set(rs, cardtable); // cardtable := <card table base>
925 __ ldub(addr, cardtable, tmp); // tmp := [addr + cardtable] 928 __ ldub(addr, cardtable, tmp); // tmp := [addr + cardtable]
926 929
930 __ cmp_and_br_short(tmp, G1SATBCardTableModRefBS::g1_young_card_val(), Assembler::equal, Assembler::pt, young_card);
931
932 __ membar(Assembler::Membar_mask_bits(Assembler::StoreLoad));
933 __ ldub(addr, cardtable, tmp); // tmp := [addr + cardtable]
934
927 assert(CardTableModRefBS::dirty_card_val() == 0, "otherwise check this code"); 935 assert(CardTableModRefBS::dirty_card_val() == 0, "otherwise check this code");
928 __ cmp_and_br_short(tmp, G0, Assembler::notEqual, Assembler::pt, not_already_dirty); 936 __ cmp_and_br_short(tmp, G0, Assembler::notEqual, Assembler::pt, not_already_dirty);
929 937
938 __ bind(young_card);
930 // We didn't take the branch, so we're already dirty: return. 939 // We didn't take the branch, so we're already dirty: return.
931 // Use return-from-leaf 940 // Use return-from-leaf
932 __ retl(); 941 __ retl();
933 __ delayed()->nop(); 942 __ delayed()->nop();
934 943