< prev index next >

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

Print this page
@@ -22,10 +22,11 @@
   *
   */
  
  #include "precompiled.hpp"
  #include "asm/macroAssembler.inline.hpp"
+ #include "code/SCCache.hpp"
  #include "gc/shared/barrierSet.hpp"
  #include "gc/shared/cardTable.hpp"
  #include "gc/shared/cardTableBarrierSet.hpp"
  #include "gc/shared/cardTableBarrierSetAssembler.hpp"
  #include "gc/shared/gc_globals.hpp"

@@ -45,11 +46,11 @@
  void CardTableBarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators,
                                                                      Register addr, Register count, Register tmp) {
    BarrierSet *bs = BarrierSet::barrier_set();
    CardTableBarrierSet* ctbs = barrier_set_cast<CardTableBarrierSet>(bs);
    CardTable* ct = ctbs->card_table();
-   intptr_t disp = (intptr_t) ct->byte_map_base();
+   intptr_t byte_map_base = (intptr_t) ct->byte_map_base();
  
    Label L_loop, L_done;
    const Register end = count;
    assert_different_registers(addr, end);
  

@@ -62,11 +63,16 @@
    __ subptr(end, BytesPerHeapOop); // end - 1 to make inclusive
    __ shrptr(addr, CardTable::card_shift());
    __ shrptr(end, CardTable::card_shift());
    __ subptr(end, addr); // end --> cards count
  
-   __ mov64(tmp, disp);
+   if (SCCache::is_on_for_write()) {
+     // SCA needs relocation info for this address
+     __ lea(tmp, ExternalAddress((address)byte_map_base));
+   } else {
+     __ mov64(tmp, byte_map_base);
+   }
    __ addptr(addr, tmp);
  __ BIND(L_loop);
    __ movb(Address(addr, count, Address::times_1), 0);
    __ decrement(count);
    __ jcc(Assembler::greaterEqual, L_loop);

@@ -74,11 +80,11 @@
    __ lea(end,  Address(addr, count, Address::times_ptr, -wordSize));
    __ shrptr(addr, CardTable::card_shift());
    __ shrptr(end,   CardTable::card_shift());
    __ subptr(end, addr); // end --> count
  __ BIND(L_loop);
-   Address cardtable(addr, count, Address::times_1, disp);
+   Address cardtable(addr, count, Address::times_1, byte_map_base);
    __ movb(cardtable, 0);
    __ decrement(count);
    __ jcc(Assembler::greaterEqual, L_loop);
  #endif
  

@@ -101,10 +107,16 @@
    // byte_map_base = _byte_map - (uintptr_t(low_bound) >> card_shift);
    // So this essentially converts an address to a displacement and it will
    // never need to be relocated. On 64bit however the value may be too
    // large for a 32bit displacement.
    intptr_t byte_map_base = (intptr_t)ct->byte_map_base();
+   if (SCCache::is_on_for_write()) {
+     // SCA needs relocation info for this address
+     ExternalAddress cardtable((address)byte_map_base);
+     Address index(noreg, obj, Address::times_1);
+     card_addr = __ as_Address(ArrayAddress(cardtable, index), rscratch1);
+   } else
    if (__ is_simm32(byte_map_base)) {
      card_addr = Address(noreg, obj, Address::times_1, byte_map_base);
    } else {
      // By doing it as an ExternalAddress 'byte_map_base' could be converted to a rip-relative
      // displacement and done in a single instruction given favorable mapping and a
< prev index next >