8072817: CardTableExtension kind() should be BarrierSet::CardTableExtension
Summary: Use BarrierSet::CardTableForRS where needed, and update concrete bs tags.
Reviewed-by: jwilhelm, jmasa
--- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp Fri Aug 28 11:10:57 2015 +0200
+++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp Tue Aug 18 17:48:35 2015 -0400
@@ -3037,7 +3037,9 @@
// register obj is destroyed afterwards.
BarrierSet* bs = Universe::heap()->barrier_set();
- assert(bs->kind() == BarrierSet::CardTableModRef, "Wrong barrier set kind");
+ assert(bs->kind() == BarrierSet::CardTableForRS ||
+ bs->kind() == BarrierSet::CardTableExtension,
+ "Wrong barrier set kind");
CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs);
assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
--- a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp Fri Aug 28 11:10:57 2015 +0200
+++ b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp Tue Aug 18 17:48:35 2015 -0400
@@ -691,7 +691,7 @@
__ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre), 2);
__ pop(RegSet::range(r0, r29), sp); // integer registers except lr & sp }
break;
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
case BarrierSet::ModRef:
break;
@@ -731,7 +731,7 @@
__ pop(RegSet::range(r0, r29), sp); // integer registers except lr & sp }
}
break;
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
{
CardTableModRefBS* ct = (CardTableModRefBS*)bs;
--- a/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp Fri Aug 28 11:10:57 2015 +0200
+++ b/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp Tue Aug 18 17:48:35 2015 -0400
@@ -186,7 +186,7 @@
}
break;
#endif // INCLUDE_ALL_GCS
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
{
if (val == noreg) {
--- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp Fri Aug 28 11:10:57 2015 +0200
+++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp Tue Aug 18 17:48:35 2015 -0400
@@ -2614,7 +2614,7 @@
void MacroAssembler::card_write_barrier_post(Register Rstore_addr, Register Rnew_val, Register Rtmp) {
CardTableModRefBS* bs =
barrier_set_cast<CardTableModRefBS>(Universe::heap()->barrier_set());
- assert(bs->kind() == BarrierSet::CardTableModRef ||
+ assert(bs->kind() == BarrierSet::CardTableForRS ||
bs->kind() == BarrierSet::CardTableExtension, "wrong barrier");
#ifdef ASSERT
cmpdi(CCR0, Rnew_val, 0);
--- a/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp Fri Aug 28 11:10:57 2015 +0200
+++ b/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp Tue Aug 18 17:48:35 2015 -0400
@@ -656,7 +656,7 @@
__ bind(filtered);
}
break;
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
case BarrierSet::ModRef:
break;
@@ -697,7 +697,7 @@
}
}
break;
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
{
Label Lskip_loop, Lstore_loop;
--- a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp Fri Aug 28 11:10:57 2015 +0200
+++ b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp Tue Aug 18 17:48:35 2015 -0400
@@ -105,7 +105,7 @@
}
break;
#endif // INCLUDE_ALL_GCS
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
{
Label Lnull, Ldone;
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp Fri Aug 28 11:10:57 2015 +0200
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp Tue Aug 18 17:48:35 2015 -0400
@@ -3958,7 +3958,7 @@
if (new_val == G0) return;
CardTableModRefBS* bs =
barrier_set_cast<CardTableModRefBS>(Universe::heap()->barrier_set());
- assert(bs->kind() == BarrierSet::CardTableModRef ||
+ assert(bs->kind() == BarrierSet::CardTableForRS ||
bs->kind() == BarrierSet::CardTableExtension, "wrong barrier");
card_table_write(bs->byte_map_base, tmp, store_addr);
}
--- a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp Fri Aug 28 11:10:57 2015 +0200
+++ b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp Tue Aug 18 17:48:35 2015 -0400
@@ -981,7 +981,7 @@
__ restore();
}
break;
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
case BarrierSet::ModRef:
break;
@@ -1014,7 +1014,7 @@
__ restore();
}
break;
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
{
CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs);
--- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp Fri Aug 28 11:10:57 2015 +0200
+++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp Tue Aug 18 17:48:35 2015 -0400
@@ -91,7 +91,7 @@
}
break;
#endif // INCLUDE_ALL_GCS
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
{
if (index == noreg ) {
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Fri Aug 28 11:10:57 2015 +0200
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Tue Aug 18 17:48:35 2015 -0400
@@ -4284,7 +4284,9 @@
// register obj is destroyed afterwards.
BarrierSet* bs = Universe::heap()->barrier_set();
- assert(bs->kind() == BarrierSet::CardTableModRef, "Wrong barrier set kind");
+ assert(bs->kind() == BarrierSet::CardTableForRS ||
+ bs->kind() == BarrierSet::CardTableExtension,
+ "Wrong barrier set kind");
CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs);
assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp Fri Aug 28 11:10:57 2015 +0200
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp Tue Aug 18 17:48:35 2015 -0400
@@ -722,7 +722,7 @@
__ popa();
}
break;
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
case BarrierSet::ModRef:
break;
@@ -754,7 +754,7 @@
}
break;
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
{
CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs);
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp Fri Aug 28 11:10:57 2015 +0200
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp Tue Aug 18 17:48:35 2015 -0400
@@ -1253,7 +1253,7 @@
__ popa();
}
break;
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
case BarrierSet::ModRef:
break;
@@ -1293,7 +1293,7 @@
__ popa();
}
break;
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
{
CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(bs);
--- a/hotspot/src/cpu/x86/vm/templateTable_x86.cpp Fri Aug 28 11:10:57 2015 +0200
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86.cpp Tue Aug 18 17:48:35 2015 -0400
@@ -200,7 +200,7 @@
}
break;
#endif // INCLUDE_ALL_GCS
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
{
if (val == noreg) {
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Fri Aug 28 11:10:57 2015 +0200
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Tue Aug 18 17:48:35 2015 -0400
@@ -1425,7 +1425,7 @@
G1SATBCardTableModRef_pre_barrier(addr_opr, pre_val, do_load, patch, info);
break;
#endif // INCLUDE_ALL_GCS
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
// No pre barriers
break;
@@ -1445,7 +1445,7 @@
G1SATBCardTableModRef_post_barrier(addr, new_val);
break;
#endif // INCLUDE_ALL_GCS
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
CardTableModRef_post_barrier(addr, new_val);
break;
--- a/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp Fri Aug 28 11:10:57 2015 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp Tue Aug 18 17:48:35 2015 -0400
@@ -634,8 +634,6 @@
virtual HeapWord* satisfy_failed_allocation(size_t size,
bool is_tlab);
- BarrierSet::Name barrier_set_name() { return BarrierSet::G1SATBCTLogging; }
-
bool need_to_start_conc_mark(const char* source, size_t alloc_word_size = 0);
// Record the start and end of an evacuation pause.
--- a/hotspot/src/share/vm/gc/parallel/cardTableExtension.hpp Fri Aug 28 11:10:57 2015 +0200
+++ b/hotspot/src/share/vm/gc/parallel/cardTableExtension.hpp Tue Aug 18 17:48:35 2015 -0400
@@ -56,13 +56,7 @@
CardTableExtension(MemRegion whole_heap) :
CardTableModRefBS(
whole_heap,
- // Concrete tag should be BarrierSet::CardTableExtension.
- // That will presently break things in a bunch of places though.
- // The concrete tag is used as a dispatch key in many places, and
- // CardTableExtension does not correctly dispatch in some of those
- // uses. This will be addressed as part of a reorganization of the
- // BarrierSet hierarchy.
- BarrierSet::FakeRtti(BarrierSet::CardTableModRef, 0).add_tag(BarrierSet::CardTableExtension))
+ BarrierSet::FakeRtti(BarrierSet::CardTableExtension))
{ }
// Scavenge support
--- a/hotspot/src/share/vm/gc/shared/barrierSet.hpp Fri Aug 28 11:10:57 2015 +0200
+++ b/hotspot/src/share/vm/gc/shared/barrierSet.hpp Tue Aug 18 17:48:35 2015 -0400
@@ -132,6 +132,9 @@
// First the pre-write versions...
template <class T> inline void write_ref_field_pre(T* field, oop new_val);
private:
+ // Helper for write_ref_field_pre and friends, testing for specialized cases.
+ bool devirtualize_reference_writes() const;
+
// Keep this private so as to catch violations at build time.
virtual void write_ref_field_pre_work( void* field, oop new_val) { guarantee(false, "Not needed"); };
protected:
--- a/hotspot/src/share/vm/gc/shared/barrierSet.inline.hpp Fri Aug 28 11:10:57 2015 +0200
+++ b/hotspot/src/share/vm/gc/shared/barrierSet.inline.hpp Tue Aug 18 17:48:35 2015 -0400
@@ -32,8 +32,18 @@
// performance-critical calls when the barrier is the most common
// card-table kind.
+inline bool BarrierSet::devirtualize_reference_writes() const {
+ switch (kind()) {
+ case CardTableForRS:
+ case CardTableExtension:
+ return true;
+ default:
+ return false;
+ }
+}
+
template <class T> void BarrierSet::write_ref_field_pre(T* field, oop new_val) {
- if (kind() == CardTableModRef) {
+ if (devirtualize_reference_writes()) {
barrier_set_cast<CardTableModRefBS>(this)->inline_write_ref_field_pre(field, new_val);
} else {
write_ref_field_pre_work(field, new_val);
@@ -41,7 +51,7 @@
}
void BarrierSet::write_ref_field(void* field, oop new_val, bool release) {
- if (kind() == CardTableModRef) {
+ if (devirtualize_reference_writes()) {
barrier_set_cast<CardTableModRefBS>(this)->inline_write_ref_field(field, new_val, release);
} else {
write_ref_field_work(field, new_val, release);
@@ -77,7 +87,7 @@
inline void BarrierSet::write_region(MemRegion mr) {
- if (kind() == CardTableModRef) {
+ if (devirtualize_reference_writes()) {
barrier_set_cast<CardTableModRefBS>(this)->inline_write_region(mr);
} else {
write_region_work(mr);
--- a/hotspot/src/share/vm/gc/shared/cardTableModRefBSForCTRS.cpp Fri Aug 28 11:10:57 2015 +0200
+++ b/hotspot/src/share/vm/gc/shared/cardTableModRefBSForCTRS.cpp Tue Aug 18 17:48:35 2015 -0400
@@ -31,13 +31,7 @@
CardTableModRefBSForCTRS::CardTableModRefBSForCTRS(MemRegion whole_heap) :
CardTableModRefBS(
whole_heap,
- // Concrete tag should be BarrierSet::CardTableForRS.
- // That will presently break things in a bunch of places though.
- // The concrete tag is used as a dispatch key in many places, and
- // CardTableForRS does not correctly dispatch in some of those
- // uses. This will be addressed as part of a reorganization of the
- // BarrierSet hierarchy.
- BarrierSet::FakeRtti(BarrierSet::CardTableModRef, 0).add_tag(BarrierSet::CardTableForRS)),
+ BarrierSet::FakeRtti(BarrierSet::CardTableForRS)),
// LNC functionality
_lowest_non_clean(NULL),
_lowest_non_clean_chunk_size(NULL),
--- a/hotspot/src/share/vm/gc/shared/collectorPolicy.hpp Fri Aug 28 11:10:57 2015 +0200
+++ b/hotspot/src/share/vm/gc/shared/collectorPolicy.hpp Tue Aug 18 17:48:35 2015 -0400
@@ -150,8 +150,6 @@
#endif // INCLUDE_ALL_GCS
- virtual BarrierSet::Name barrier_set_name() = 0;
-
virtual GenRemSet* create_rem_set(MemRegion reserved);
// This method controls how a collector satisfies a request
@@ -299,8 +297,6 @@
assert(_max_young_size == MaxNewSize, "Should be taken care of by initialize_size_info");
}
- BarrierSet::Name barrier_set_name() { return BarrierSet::CardTableModRef; }
-
virtual CollectorPolicy::Name kind() {
return CollectorPolicy::GenCollectorPolicyKind;
}
--- a/hotspot/src/share/vm/opto/graphKit.cpp Fri Aug 28 11:10:57 2015 +0200
+++ b/hotspot/src/share/vm/opto/graphKit.cpp Tue Aug 18 17:48:35 2015 -0400
@@ -1522,7 +1522,7 @@
g1_write_barrier_pre(do_load, obj, adr, adr_idx, val, val_type, pre_val, bt);
break;
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
case BarrierSet::ModRef:
break;
@@ -1539,7 +1539,7 @@
case BarrierSet::G1SATBCTLogging:
return true; // Can move it if no safepoint
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
case BarrierSet::ModRef:
return true; // There is no pre-barrier
@@ -1565,7 +1565,7 @@
g1_write_barrier_post(store, obj, adr, adr_idx, val, bt, use_precise);
break;
- case BarrierSet::CardTableModRef:
+ case BarrierSet::CardTableForRS:
case BarrierSet::CardTableExtension:
write_barrier_post(store, obj, adr, adr_idx, val, use_precise);
break;
@@ -3791,7 +3791,7 @@
Node* cast = __ CastPX(__ ctrl(), adr);
// Divide by card size
- assert(Universe::heap()->barrier_set()->kind() == BarrierSet::CardTableModRef,
+ assert(Universe::heap()->barrier_set()->is_a(BarrierSet::CardTableModRef),
"Only one we handle so far.");
Node* card_offset = __ URShiftX( cast, __ ConI(CardTableModRefBS::card_shift) );
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp Fri Aug 28 11:10:57 2015 +0200
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp Tue Aug 18 17:48:35 2015 -0400
@@ -2253,6 +2253,7 @@
\
declare_constant(BarrierSet::ModRef) \
declare_constant(BarrierSet::CardTableModRef) \
+ declare_constant(BarrierSet::CardTableForRS) \
declare_constant(BarrierSet::CardTableExtension) \
declare_constant(BarrierSet::G1SATBCT) \
declare_constant(BarrierSet::G1SATBCTLogging) \
--- a/hotspot/src/share/vm/shark/sharkBuilder.cpp Fri Aug 28 11:10:57 2015 +0200
+++ b/hotspot/src/share/vm/shark/sharkBuilder.cpp Tue Aug 18 17:48:35 2015 -0400
@@ -440,8 +440,10 @@
// HotSpot memory barriers
void SharkBuilder::CreateUpdateBarrierSet(BarrierSet* bs, Value* field) {
- if (bs->kind() != BarrierSet::CardTableModRef)
+ if (bs->kind() != BarrierSet::CardTableForRS &&
+ bs->kind() != BarrierSet::CardTableExtension) {
Unimplemented();
+ }
CreateStore(
LLVMValue::jbyte_constant(CardTableModRefBS::dirty_card_val()),