8202082: Remove explicit CMS checks in CardTableBarrierSetAssembler
authoreosterlund
Fri, 27 Apr 2018 10:59:46 +0200
changeset 49910 c822dd1a3b66
parent 49909 f276b348ec14
child 49911 358be4680d12
8202082: Remove explicit CMS checks in CardTableBarrierSetAssembler Reviewed-by: shade, kbarrett
src/hotspot/cpu/aarch64/gc/shared/cardTableBarrierSetAssembler_aarch64.cpp
src/hotspot/cpu/ppc/gc/shared/cardTableBarrierSetAssembler_ppc.cpp
src/hotspot/cpu/x86/gc/shared/cardTableBarrierSetAssembler_x86.cpp
--- a/src/hotspot/cpu/aarch64/gc/shared/cardTableBarrierSetAssembler_aarch64.cpp	Fri Apr 27 03:57:00 2018 -0400
+++ b/src/hotspot/cpu/aarch64/gc/shared/cardTableBarrierSetAssembler_aarch64.cpp	Fri Apr 27 10:59:46 2018 +0200
@@ -56,7 +56,7 @@
     __ strb(zr, Address(obj, rscratch1));
     __ bind(L_already_dirty);
   } else {
-    if (UseConcMarkSweepGC && CMSPrecleaningEnabled) {
+    if (ct->scanned_concurrently()) {
       __ membar(Assembler::StoreStore);
     }
     __ strb(zr, Address(obj, rscratch1));
@@ -79,7 +79,7 @@
   const Register count = end; // 'end' register contains bytes count now
   __ load_byte_map_base(scratch);
   __ add(start, start, scratch);
-  if (UseConcMarkSweepGC) {
+  if (ct->scanned_concurrently()) {
     __ membar(__ StoreStore);
   }
   __ bind(L_loop);
--- a/src/hotspot/cpu/ppc/gc/shared/cardTableBarrierSetAssembler_ppc.cpp	Fri Apr 27 03:57:00 2018 -0400
+++ b/src/hotspot/cpu/ppc/gc/shared/cardTableBarrierSetAssembler_ppc.cpp	Fri Apr 27 10:59:46 2018 +0200
@@ -50,7 +50,7 @@
 
   Label Lskip_loop, Lstore_loop;
 
-  if (UseConcMarkSweepGC) { __ membar(Assembler::StoreStore); }
+  if (ct->scanned_concurrently()) { __ membar(Assembler::StoreStore); }
 
   __ sldi_(count, count, LogBytesPerHeapOop);
   __ beq(CCR0, Lskip_loop); // zero length
@@ -75,11 +75,13 @@
 void CardTableBarrierSetAssembler::card_table_write(MacroAssembler* masm,
                                                     jbyte* byte_map_base,
                                                     Register tmp, Register obj) {
+  CardTableBarrierSet* ctbs = barrier_set_cast<CardTableBarrierSet>(BarrierSet::barrier_set());
+  CardTable* ct = ctbs->card_table();
   assert_different_registers(obj, tmp, R0);
   __ load_const_optimized(tmp, (address)byte_map_base, R0);
   __ srdi(obj, obj, CardTable::card_shift);
   __ li(R0, CardTable::dirty_card_val());
-  if (UseConcMarkSweepGC) { __ membar(Assembler::StoreStore); }
+  if (ct->scanned_concurrently()) { __ membar(Assembler::StoreStore); }
   __ stbx(R0, tmp, obj);
 }
 
--- a/src/hotspot/cpu/x86/gc/shared/cardTableBarrierSetAssembler_x86.cpp	Fri Apr 27 03:57:00 2018 -0400
+++ b/src/hotspot/cpu/x86/gc/shared/cardTableBarrierSetAssembler_x86.cpp	Fri Apr 27 10:59:46 2018 +0200
@@ -90,8 +90,9 @@
   // register obj is destroyed afterwards.
   BarrierSet* bs = BarrierSet::barrier_set();
 
-  CardTableBarrierSet* ct = barrier_set_cast<CardTableBarrierSet>(bs);
-  assert(sizeof(*ct->card_table()->byte_map_base()) == sizeof(jbyte), "adjust this code");
+  CardTableBarrierSet* ctbs = barrier_set_cast<CardTableBarrierSet>(bs);
+  CardTable* ct = ctbs->card_table();
+  assert(sizeof(*ct->byte_map_base()) == sizeof(jbyte), "adjust this code");
 
   __ shrptr(obj, CardTable::card_shift);
 
@@ -102,15 +103,15 @@
   // 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 disp = (intptr_t) ct->card_table()->byte_map_base();
-  if (__ is_simm32(disp)) {
-    card_addr = Address(noreg, obj, Address::times_1, disp);
+  intptr_t byte_map_base = (intptr_t)ct->byte_map_base();
+  if (__ is_simm32(byte_map_base)) {
+    card_addr = Address(noreg, obj, Address::times_1, byte_map_base);
   } else {
-    // By doing it as an ExternalAddress 'disp' could be converted to a rip-relative
+    // 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
     // smarter version of as_Address. However, 'ExternalAddress' generates a relocation
     // entry and that entry is not properly handled by the relocation code.
-    AddressLiteral cardtable((address)ct->card_table()->byte_map_base(), relocInfo::none);
+    AddressLiteral cardtable((address)byte_map_base, relocInfo::none);
     Address index(noreg, obj, Address::times_1);
     card_addr = __ as_Address(ArrayAddress(cardtable, index));
   }
@@ -118,7 +119,7 @@
   int dirty = CardTable::dirty_card_val();
   if (UseCondCardMark) {
     Label L_already_dirty;
-    if (UseConcMarkSweepGC) {
+    if (ct->scanned_concurrently()) {
       __ membar(Assembler::StoreLoad);
     }
     __ cmpb(card_addr, dirty);