< prev index next >

src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp

Print this page
*** 22,10 ***
--- 22,13 ---
   *
   */
  
  #include "precompiled.hpp"
  #include "asm/macroAssembler.inline.hpp"
+ #if INCLUDE_CDS
+ #include "code/SCCache.hpp"
+ #endif
  #include "gc/g1/g1BarrierSet.hpp"
  #include "gc/g1/g1BarrierSetAssembler.hpp"
  #include "gc/g1/g1BarrierSetRuntime.hpp"
  #include "gc/g1/g1CardTable.hpp"
  #include "gc/g1/g1HeapRegion.hpp"

*** 282,30 ***
    Label done;
    Label runtime;
  
    // Does store cross heap regions?
  
!   __ movptr(tmp, store_addr);
!   __ xorptr(tmp, new_val);
!   __ shrptr(tmp, G1HeapRegion::LogOfHRGrainBytes);
!   __ jcc(Assembler::equal, done);
! 
    // crosses regions, storing null?
  
    __ cmpptr(new_val, NULL_WORD);
    __ jcc(Assembler::equal, done);
  
    // storing region crossing non-null, is card already dirty?
  
    const Register card_addr = tmp;
-   const Register cardtable = tmp2;
  
    __ movptr(card_addr, store_addr);
!   __ shrptr(card_addr, CardTable::card_shift());
    // Do not use ExternalAddress to load 'byte_map_base', since 'byte_map_base' is NOT
    // a valid address and therefore is not properly handled by the relocation code.
!   __ movptr(cardtable, (intptr_t)ct->card_table()->byte_map_base());
    __ addptr(card_addr, cardtable);
  
    __ cmpb(Address(card_addr, 0), G1CardTable::g1_young_card_val());
    __ jcc(Assembler::equal, done);
  
--- 285,74 ---
    Label done;
    Label runtime;
  
    // Does store cross heap regions?
  
! #if INCLUDE_CDS
!   // AOT code needs to load the barrier grain shift from the aot
!   // runtime constants area in the code cache otherwise we can compile
!   // it as an immediate operand
! 
+   if (SCCache::is_on_for_write()) {
+     address grain_shift_addr = AOTRuntimeConstants::grain_shift_address();
+     __ movptr(tmp, store_addr);
+     __ xorptr(tmp, new_val);
+     __ push(rscratch1);
+     __ push(rcx);
+     __ lea(rscratch1, ExternalAddress(grain_shift_addr));
+     __ movptr(rcx, Address(rscratch1, 0));
+     __ shrptr(tmp);
+     __ pop(rcx);
+     __ pop(rscratch1);
+     __ jcc(Assembler::equal, done);
+   } else
+ #endif // INCLUDE_CDS
+   {
+     __ movptr(tmp, store_addr);
+     __ xorptr(tmp, new_val);
+     __ shrptr(tmp, G1HeapRegion::LogOfHRGrainBytes);
+     __ jcc(Assembler::equal, done);
+   }
    // crosses regions, storing null?
  
    __ cmpptr(new_val, NULL_WORD);
    __ jcc(Assembler::equal, done);
  
    // storing region crossing non-null, is card already dirty?
  
    const Register card_addr = tmp;
  
    __ movptr(card_addr, store_addr);
! #if INCLUDE_CDS
+   // AOT code needs to load the barrier card shift from the aot
+   // runtime constants area in the code cache otherwise we can compile
+   // it as an immediate operand
+   if (SCCache::is_on_for_write()) {
+     address card_shift_addr = AOTRuntimeConstants::card_shift_address();
+     __ push(rscratch1);
+     __ push(rcx);
+     __ lea(rscratch1, ExternalAddress(card_shift_addr));
+     __ movptr(rcx, Address(rscratch1, 0));
+     __ shrptr(card_addr);
+     __ pop(rcx);
+     __ pop(rscratch1);
+   } else
+ #endif // INCLUDE_CDS
+   {
+     __ shrptr(card_addr, CardTable::card_shift());
+   }
+ 
+   const Register cardtable = tmp2;
+ 
    // Do not use ExternalAddress to load 'byte_map_base', since 'byte_map_base' is NOT
    // a valid address and therefore is not properly handled by the relocation code.
!   if (SCCache::is_on_for_write()) {
+     // SCA needs relocation info for this address
+     __ lea(cardtable, ExternalAddress((address)ct->card_table()->byte_map_base()));
+   } else {
+     __ movptr(cardtable, (intptr_t)ct->card_table()->byte_map_base());
+   }
    __ addptr(card_addr, cardtable);
  
    __ cmpb(Address(card_addr, 0), G1CardTable::g1_young_card_val());
    __ jcc(Assembler::equal, done);
  

*** 536,11 ***
  
    __ load_parameter(0, card_addr);
    __ shrptr(card_addr, CardTable::card_shift());
    // Do not use ExternalAddress to load 'byte_map_base', since 'byte_map_base' is NOT
    // a valid address and therefore is not properly handled by the relocation code.
!   __ movptr(cardtable, (intptr_t)ct->card_table()->byte_map_base());
    __ addptr(card_addr, cardtable);
  
    NOT_LP64(__ get_thread(thread);)
  
    __ cmpb(Address(card_addr, 0), G1CardTable::g1_young_card_val());
--- 583,16 ---
  
    __ load_parameter(0, card_addr);
    __ shrptr(card_addr, CardTable::card_shift());
    // Do not use ExternalAddress to load 'byte_map_base', since 'byte_map_base' is NOT
    // a valid address and therefore is not properly handled by the relocation code.
!   if (SCCache::is_on()) {
+     // SCA needs relocation info for this address
+     __ lea(cardtable, ExternalAddress((address)ct->card_table()->byte_map_base()));
+   } else {
+     __ movptr(cardtable, (intptr_t)ct->card_table()->byte_map_base());
+   }
    __ addptr(card_addr, cardtable);
  
    NOT_LP64(__ get_thread(thread);)
  
    __ cmpb(Address(card_addr, 0), G1CardTable::g1_young_card_val());
< prev index next >