< prev index next >

src/hotspot/cpu/x86/gc/shared/cardTableBarrierSetAssembler_x86.cpp

Print this page

121   {
122     __ mov64(tmp, (intptr_t)ctbs->card_table_base_const());
123   }
124   __ addptr(addr, tmp);
125 __ BIND(L_loop);
126   __ movb(Address(addr, count, Address::times_1), 0);
127   __ decrement(count);
128   __ jcc(Assembler::greaterEqual, L_loop);
129 
130 __ BIND(L_done);
131 }
132 
133 void CardTableBarrierSetAssembler::store_check(MacroAssembler* masm, Register obj, Address dst, Register rscratch) {
134   // Does a store check for the oop in register obj. The content of
135   // register obj is destroyed afterwards.
136   CardTableBarrierSet* ctbs = CardTableBarrierSet::barrier_set();
137 
138   __ shrptr(obj, CardTable::card_shift());
139 
140   Address card_addr;

141 
142   // The calculation for byte_map_base is as follows:
143   // byte_map_base = _byte_map - (uintptr_t(low_bound) >> card_shift);
144   // So this essentially converts an address to a displacement and it will
145   // never need to be relocated. On 64bit however the value may be too
146   // large for a 32bit displacement.
147   intptr_t byte_map_base = (intptr_t)ctbs->card_table_base_const();
148 #if INCLUDE_CDS
149   if (AOTCodeCache::is_on_for_dump()) {
150     __ lea(rscratch, ExternalAddress(AOTRuntimeConstants::card_table_base_address()));
151     __ movq(rscratch, Address(rscratch, 0));
152     card_addr = Address(rscratch, obj, Address::times_1, 0);
153   } else
154 #endif
155   if (__ is_simm32(byte_map_base)) {
156     card_addr = Address(noreg, obj, Address::times_1, byte_map_base);
157   } else {
158     // By doing it as an ExternalAddress 'byte_map_base' could be converted to a rip-relative
159     // displacement and done in a single instruction given favorable mapping and a
160     // smarter version of as_Address. However, 'ExternalAddress' generates a relocation
161     // entry and that entry is not properly handled by the relocation code.
162     AddressLiteral cardtable((address)byte_map_base, relocInfo::none);
163     Address index(noreg, obj, Address::times_1);
164     card_addr = __ as_Address(ArrayAddress(cardtable, index), rscratch1);
165   }
166 
167   int dirty = CardTable::dirty_card_val();
168   if (UseCondCardMark) {
169     Label L_already_dirty;
170     __ cmpb(card_addr, dirty);
171     __ jccb(Assembler::equal, L_already_dirty);
172     __ movb(card_addr, dirty);
173     __ bind(L_already_dirty);
174   } else {
175     __ movb(card_addr, dirty);
176   }
177 }
178 
179 void CardTableBarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
180                                                 Address dst, Register val, Register tmp1, Register tmp2, Register tmp3) {
181   bool in_heap = (decorators & IN_HEAP) != 0;
182 
183   bool is_array = (decorators & IS_ARRAY) != 0;
184   bool on_anonymous = (decorators & ON_UNKNOWN_OOP_REF) != 0;

121   {
122     __ mov64(tmp, (intptr_t)ctbs->card_table_base_const());
123   }
124   __ addptr(addr, tmp);
125 __ BIND(L_loop);
126   __ movb(Address(addr, count, Address::times_1), 0);
127   __ decrement(count);
128   __ jcc(Assembler::greaterEqual, L_loop);
129 
130 __ BIND(L_done);
131 }
132 
133 void CardTableBarrierSetAssembler::store_check(MacroAssembler* masm, Register obj, Address dst, Register rscratch) {
134   // Does a store check for the oop in register obj. The content of
135   // register obj is destroyed afterwards.
136   CardTableBarrierSet* ctbs = CardTableBarrierSet::barrier_set();
137 
138   __ shrptr(obj, CardTable::card_shift());
139 
140   Address card_addr;
141   precond(rscratch != noreg);
142 
143   // The calculation for byte_map_base is as follows:
144   // byte_map_base = _byte_map - (uintptr_t(low_bound) >> card_shift);
145   // So this essentially converts an address to a displacement and it will
146   // never need to be relocated. On 64bit however the value may be too
147   // large for a 32bit displacement.
148   intptr_t byte_map_base = (intptr_t)ctbs->card_table_base_const();
149 #if INCLUDE_CDS
150   if (AOTCodeCache::is_on_for_dump()) {
151     __ lea(rscratch, ExternalAddress(AOTRuntimeConstants::card_table_base_address()));
152     __ movq(rscratch, Address(rscratch, 0));
153     card_addr = Address(rscratch, obj, Address::times_1, 0);
154   } else
155 #endif
156   if (__ is_simm32(byte_map_base)) {
157     card_addr = Address(noreg, obj, Address::times_1, byte_map_base);
158   } else {
159     // By doing it as an ExternalAddress 'byte_map_base' could be converted to a rip-relative
160     // displacement and done in a single instruction given favorable mapping and a
161     // smarter version of as_Address. However, 'ExternalAddress' generates a relocation
162     // entry and that entry is not properly handled by the relocation code.
163     AddressLiteral cardtable((address)byte_map_base, relocInfo::none);
164     Address index(noreg, obj, Address::times_1);
165     card_addr = __ as_Address(ArrayAddress(cardtable, index), rscratch);
166   }
167 
168   int dirty = CardTable::dirty_card_val();
169   if (UseCondCardMark) {
170     Label L_already_dirty;
171     __ cmpb(card_addr, dirty);
172     __ jccb(Assembler::equal, L_already_dirty);
173     __ movb(card_addr, dirty);
174     __ bind(L_already_dirty);
175   } else {
176     __ movb(card_addr, dirty);
177   }
178 }
179 
180 void CardTableBarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
181                                                 Address dst, Register val, Register tmp1, Register tmp2, Register tmp3) {
182   bool in_heap = (decorators & IN_HEAP) != 0;
183 
184   bool is_array = (decorators & IS_ARRAY) != 0;
185   bool on_anonymous = (decorators & ON_UNKNOWN_OOP_REF) != 0;
< prev index next >