2323 */
2424
2525#include " asm/macroAssembler.inline.hpp"
26+ #include " code/aotCodeCache.hpp"
2627#include " gc/shared/barrierSet.hpp"
2728#include " gc/shared/cardTable.hpp"
2829#include " gc/shared/cardTableBarrierSet.hpp"
@@ -111,7 +112,15 @@ void CardTableBarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembl
111112 __ shrptr (end, CardTable::card_shift ());
112113 __ subptr (end, addr); // end --> cards count
113114
114- __ mov64 (tmp, (intptr_t )ctbs->card_table_base_const ());
115+ #if INCLUDE_CDS
116+ if (AOTCodeCache::is_on_for_dump ()) {
117+ __ lea (tmp, ExternalAddress (AOTRuntimeConstants::card_table_base_address ()));
118+ __ movq (tmp, Address (tmp, 0 ));
119+ } else
120+ #endif
121+ {
122+ __ mov64 (tmp, (intptr_t )ctbs->card_table_base_const ());
123+ }
115124 __ addptr (addr, tmp);
116125__ BIND (L_loop);
117126 __ movb (Address (addr, count, Address::times_1), 0 );
@@ -121,7 +130,7 @@ __ BIND(L_loop);
121130__ BIND (L_done);
122131}
123132
124- void CardTableBarrierSetAssembler::store_check (MacroAssembler* masm, Register obj, Address dst) {
133+ void CardTableBarrierSetAssembler::store_check (MacroAssembler* masm, Register obj, Address dst, Register rscratch ) {
125134 // Does a store check for the oop in register obj. The content of
126135 // register obj is destroyed afterwards.
127136 CardTableBarrierSet* ctbs = CardTableBarrierSet::barrier_set ();
@@ -136,6 +145,13 @@ void CardTableBarrierSetAssembler::store_check(MacroAssembler* masm, Register ob
136145 // never need to be relocated. On 64bit however the value may be too
137146 // large for a 32bit displacement.
138147 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
139155 if (__ is_simm32 (byte_map_base)) {
140156 card_addr = Address (noreg, obj, Address::times_1, byte_map_base);
141157 } else {
@@ -174,10 +190,10 @@ void CardTableBarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorS
174190 if (needs_post_barrier) {
175191 // flatten object address if needed
176192 if (!precise || (dst.index () == noreg && dst.disp () == 0 )) {
177- store_check (masm, dst.base (), dst);
193+ store_check (masm, dst.base (), dst, tmp2 );
178194 } else {
179195 __ lea (tmp1, dst);
180- store_check (masm, tmp1, dst);
196+ store_check (masm, tmp1, dst, tmp2 );
181197 }
182198 }
183199}
0 commit comments