44 void CardTableBarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators,
45 Register addr, Register count, Register tmp) {
46 BLOCK_COMMENT("CardTablePostBarrier");
47 BarrierSet* bs = BarrierSet::barrier_set();
48 CardTableBarrierSet* ctbs = barrier_set_cast<CardTableBarrierSet>(bs);
49 CardTable* ct = ctbs->card_table();
50 assert(sizeof(*ct->byte_map_base()) == sizeof(jbyte), "adjust this code");
51
52 Label L_cardtable_loop, L_done;
53
54 __ cbz_32(count, L_done); // zero count - nothing to do
55
56 __ add_ptr_scaled_int32(count, addr, count, LogBytesPerHeapOop);
57 __ sub(count, count, BytesPerHeapOop); // last addr
58
59 __ logical_shift_right(addr, addr, CardTable::card_shift);
60 __ logical_shift_right(count, count, CardTable::card_shift);
61 __ sub(count, count, addr); // nb of cards
62
63 // warning: Rthread has not been preserved
64 __ mov_address(tmp, (address) ct->byte_map_base(), symbolic_Relocation::card_table_reference);
65 __ add(addr,tmp, addr);
66
67 Register zero = __ zero_register(tmp);
68
69 __ BIND(L_cardtable_loop);
70 __ strb(zero, Address(addr, 1, post_indexed));
71 __ subs(count, count, 1);
72 __ b(L_cardtable_loop, ge);
73 __ BIND(L_done);
74 }
75
76 void CardTableBarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
77 Address obj, Register new_val, Register tmp1, Register tmp2, Register tmp3, bool is_null) {
78 bool is_array = (decorators & IS_ARRAY) != 0;
79 bool on_anonymous = (decorators & ON_UNKNOWN_OOP_REF) != 0;
80 bool precise = is_array || on_anonymous;
81
82 if (is_null) {
83 BarrierSetAssembler::store_at(masm, decorators, type, obj, new_val, tmp1, tmp2, tmp3, true);
84 } else {
102
103 CardTableBarrierSet* ctbs = barrier_set_cast<CardTableBarrierSet>(bs);
104 CardTable* ct = ctbs->card_table();
105 assert(sizeof(*ct->byte_map_base()) == sizeof(jbyte), "Adjust store check code");
106
107 // Load card table base address.
108
109 /* Performance note.
110
111 There is an alternative way of loading card table base address
112 from thread descriptor, which may look more efficient:
113
114 ldr(card_table_base, Address(Rthread, JavaThread::card_table_base_offset()));
115
116 However, performance measurements of micro benchmarks and specJVM98
117 showed that loading of card table base from thread descriptor is
118 7-18% slower compared to loading of literal embedded into the code.
119 Possible cause is a cache miss (card table base address resides in a
120 rarely accessed area of thread descriptor).
121 */
122 __ mov_address(card_table_base, (address)ct->byte_map_base(), symbolic_Relocation::card_table_reference);
123 }
124
125 // The 2nd part of the store check.
126 void CardTableBarrierSetAssembler::store_check_part2(MacroAssembler* masm, Register obj, Register card_table_base, Register tmp) {
127 assert_different_registers(obj, card_table_base, tmp);
128
129 BarrierSet* bs = BarrierSet::barrier_set();
130 assert(bs->kind() == BarrierSet::CardTableBarrierSet,
131 "Wrong barrier set kind");
132
133 CardTableBarrierSet* ctbs = barrier_set_cast<CardTableBarrierSet>(bs);
134 CardTable* ct = ctbs->card_table();
135 assert(sizeof(*ct->byte_map_base()) == sizeof(jbyte), "Adjust store check code");
136
137 assert(CardTable::dirty_card_val() == 0, "Dirty card value must be 0 due to optimizations.");
138 Address card_table_addr(card_table_base, obj, lsr, CardTable::card_shift);
139
140 if (UseCondCardMark) {
141 if (ct->scanned_concurrently()) {
142 __ membar(MacroAssembler::Membar_mask_bits(MacroAssembler::StoreLoad), noreg);
|
44 void CardTableBarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators,
45 Register addr, Register count, Register tmp) {
46 BLOCK_COMMENT("CardTablePostBarrier");
47 BarrierSet* bs = BarrierSet::barrier_set();
48 CardTableBarrierSet* ctbs = barrier_set_cast<CardTableBarrierSet>(bs);
49 CardTable* ct = ctbs->card_table();
50 assert(sizeof(*ct->byte_map_base()) == sizeof(jbyte), "adjust this code");
51
52 Label L_cardtable_loop, L_done;
53
54 __ cbz_32(count, L_done); // zero count - nothing to do
55
56 __ add_ptr_scaled_int32(count, addr, count, LogBytesPerHeapOop);
57 __ sub(count, count, BytesPerHeapOop); // last addr
58
59 __ logical_shift_right(addr, addr, CardTable::card_shift);
60 __ logical_shift_right(count, count, CardTable::card_shift);
61 __ sub(count, count, addr); // nb of cards
62
63 // warning: Rthread has not been preserved
64 __ mov_address(tmp, (address) ct->byte_map_base());
65 __ add(addr,tmp, addr);
66
67 Register zero = __ zero_register(tmp);
68
69 __ BIND(L_cardtable_loop);
70 __ strb(zero, Address(addr, 1, post_indexed));
71 __ subs(count, count, 1);
72 __ b(L_cardtable_loop, ge);
73 __ BIND(L_done);
74 }
75
76 void CardTableBarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
77 Address obj, Register new_val, Register tmp1, Register tmp2, Register tmp3, bool is_null) {
78 bool is_array = (decorators & IS_ARRAY) != 0;
79 bool on_anonymous = (decorators & ON_UNKNOWN_OOP_REF) != 0;
80 bool precise = is_array || on_anonymous;
81
82 if (is_null) {
83 BarrierSetAssembler::store_at(masm, decorators, type, obj, new_val, tmp1, tmp2, tmp3, true);
84 } else {
102
103 CardTableBarrierSet* ctbs = barrier_set_cast<CardTableBarrierSet>(bs);
104 CardTable* ct = ctbs->card_table();
105 assert(sizeof(*ct->byte_map_base()) == sizeof(jbyte), "Adjust store check code");
106
107 // Load card table base address.
108
109 /* Performance note.
110
111 There is an alternative way of loading card table base address
112 from thread descriptor, which may look more efficient:
113
114 ldr(card_table_base, Address(Rthread, JavaThread::card_table_base_offset()));
115
116 However, performance measurements of micro benchmarks and specJVM98
117 showed that loading of card table base from thread descriptor is
118 7-18% slower compared to loading of literal embedded into the code.
119 Possible cause is a cache miss (card table base address resides in a
120 rarely accessed area of thread descriptor).
121 */
122 __ mov_address(card_table_base, (address)ct->byte_map_base());
123 }
124
125 // The 2nd part of the store check.
126 void CardTableBarrierSetAssembler::store_check_part2(MacroAssembler* masm, Register obj, Register card_table_base, Register tmp) {
127 assert_different_registers(obj, card_table_base, tmp);
128
129 BarrierSet* bs = BarrierSet::barrier_set();
130 assert(bs->kind() == BarrierSet::CardTableBarrierSet,
131 "Wrong barrier set kind");
132
133 CardTableBarrierSet* ctbs = barrier_set_cast<CardTableBarrierSet>(bs);
134 CardTable* ct = ctbs->card_table();
135 assert(sizeof(*ct->byte_map_base()) == sizeof(jbyte), "Adjust store check code");
136
137 assert(CardTable::dirty_card_val() == 0, "Dirty card value must be 0 due to optimizations.");
138 Address card_table_addr(card_table_base, obj, lsr, CardTable::card_shift);
139
140 if (UseCondCardMark) {
141 if (ct->scanned_concurrently()) {
142 __ membar(MacroAssembler::Membar_mask_bits(MacroAssembler::StoreLoad), noreg);
|