# HG changeset patch # User kbarrett # Date 1440799046 -7200 # Node ID d5dfba5286736fbdc47c02d233b9e147805ce614 # Parent 8cde9aca5e9ff7322e1dae829b0f707415b7faaf# Parent 8feecdee315608eee26fb2329ce1943a170f9634 Merge diff -r 8cde9aca5e9f -r d5dfba528673 hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp --- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp Fri Aug 28 17:32:31 2015 +0300 +++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp Fri Aug 28 23:57:26 2015 +0200 @@ -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(bs); assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); diff -r 8cde9aca5e9f -r d5dfba528673 hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp --- a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp Fri Aug 28 17:32:31 2015 +0300 +++ b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp Fri Aug 28 23:57:26 2015 +0200 @@ -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; diff -r 8cde9aca5e9f -r d5dfba528673 hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp --- a/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp Fri Aug 28 17:32:31 2015 +0300 +++ b/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp Fri Aug 28 23:57:26 2015 +0200 @@ -186,7 +186,7 @@ } break; #endif // INCLUDE_ALL_GCS - case BarrierSet::CardTableModRef: + case BarrierSet::CardTableForRS: case BarrierSet::CardTableExtension: { if (val == noreg) { diff -r 8cde9aca5e9f -r d5dfba528673 hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp --- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp Fri Aug 28 17:32:31 2015 +0300 +++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp Fri Aug 28 23:57:26 2015 +0200 @@ -2614,7 +2614,7 @@ void MacroAssembler::card_write_barrier_post(Register Rstore_addr, Register Rnew_val, Register Rtmp) { CardTableModRefBS* bs = barrier_set_cast(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); diff -r 8cde9aca5e9f -r d5dfba528673 hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp --- a/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp Fri Aug 28 17:32:31 2015 +0300 +++ b/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp Fri Aug 28 23:57:26 2015 +0200 @@ -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; diff -r 8cde9aca5e9f -r d5dfba528673 hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp --- a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp Fri Aug 28 17:32:31 2015 +0300 +++ b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp Fri Aug 28 23:57:26 2015 +0200 @@ -105,7 +105,7 @@ } break; #endif // INCLUDE_ALL_GCS - case BarrierSet::CardTableModRef: + case BarrierSet::CardTableForRS: case BarrierSet::CardTableExtension: { Label Lnull, Ldone; diff -r 8cde9aca5e9f -r d5dfba528673 hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp Fri Aug 28 17:32:31 2015 +0300 +++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp Fri Aug 28 23:57:26 2015 +0200 @@ -3958,7 +3958,7 @@ if (new_val == G0) return; CardTableModRefBS* bs = barrier_set_cast(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); } diff -r 8cde9aca5e9f -r d5dfba528673 hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp Fri Aug 28 17:32:31 2015 +0300 +++ b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp Fri Aug 28 23:57:26 2015 +0200 @@ -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(bs); diff -r 8cde9aca5e9f -r d5dfba528673 hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp Fri Aug 28 17:32:31 2015 +0300 +++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp Fri Aug 28 23:57:26 2015 +0200 @@ -91,7 +91,7 @@ } break; #endif // INCLUDE_ALL_GCS - case BarrierSet::CardTableModRef: + case BarrierSet::CardTableForRS: case BarrierSet::CardTableExtension: { if (index == noreg ) { diff -r 8cde9aca5e9f -r d5dfba528673 hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp --- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Fri Aug 28 17:32:31 2015 +0300 +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Fri Aug 28 23:57:26 2015 +0200 @@ -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(bs); assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); diff -r 8cde9aca5e9f -r d5dfba528673 hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp Fri Aug 28 17:32:31 2015 +0300 +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp Fri Aug 28 23:57:26 2015 +0200 @@ -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(bs); diff -r 8cde9aca5e9f -r d5dfba528673 hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp Fri Aug 28 17:32:31 2015 +0300 +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp Fri Aug 28 23:57:26 2015 +0200 @@ -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(bs); diff -r 8cde9aca5e9f -r d5dfba528673 hotspot/src/cpu/x86/vm/templateTable_x86.cpp --- a/hotspot/src/cpu/x86/vm/templateTable_x86.cpp Fri Aug 28 17:32:31 2015 +0300 +++ b/hotspot/src/cpu/x86/vm/templateTable_x86.cpp Fri Aug 28 23:57:26 2015 +0200 @@ -200,7 +200,7 @@ } break; #endif // INCLUDE_ALL_GCS - case BarrierSet::CardTableModRef: + case BarrierSet::CardTableForRS: case BarrierSet::CardTableExtension: { if (val == noreg) { diff -r 8cde9aca5e9f -r d5dfba528673 hotspot/src/share/vm/c1/c1_LIRGenerator.cpp --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Fri Aug 28 17:32:31 2015 +0300 +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Fri Aug 28 23:57:26 2015 +0200 @@ -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; diff -r 8cde9aca5e9f -r d5dfba528673 hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp --- a/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp Fri Aug 28 17:32:31 2015 +0300 +++ b/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp Fri Aug 28 23:57:26 2015 +0200 @@ -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. diff -r 8cde9aca5e9f -r d5dfba528673 hotspot/src/share/vm/gc/parallel/cardTableExtension.hpp --- a/hotspot/src/share/vm/gc/parallel/cardTableExtension.hpp Fri Aug 28 17:32:31 2015 +0300 +++ b/hotspot/src/share/vm/gc/parallel/cardTableExtension.hpp Fri Aug 28 23:57:26 2015 +0200 @@ -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 diff -r 8cde9aca5e9f -r d5dfba528673 hotspot/src/share/vm/gc/shared/barrierSet.hpp --- a/hotspot/src/share/vm/gc/shared/barrierSet.hpp Fri Aug 28 17:32:31 2015 +0300 +++ b/hotspot/src/share/vm/gc/shared/barrierSet.hpp Fri Aug 28 23:57:26 2015 +0200 @@ -132,6 +132,9 @@ // First the pre-write versions... template 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: diff -r 8cde9aca5e9f -r d5dfba528673 hotspot/src/share/vm/gc/shared/barrierSet.inline.hpp --- a/hotspot/src/share/vm/gc/shared/barrierSet.inline.hpp Fri Aug 28 17:32:31 2015 +0300 +++ b/hotspot/src/share/vm/gc/shared/barrierSet.inline.hpp Fri Aug 28 23:57:26 2015 +0200 @@ -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 void BarrierSet::write_ref_field_pre(T* field, oop new_val) { - if (kind() == CardTableModRef) { + if (devirtualize_reference_writes()) { barrier_set_cast(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(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(this)->inline_write_region(mr); } else { write_region_work(mr); diff -r 8cde9aca5e9f -r d5dfba528673 hotspot/src/share/vm/gc/shared/cardTableModRefBSForCTRS.cpp --- a/hotspot/src/share/vm/gc/shared/cardTableModRefBSForCTRS.cpp Fri Aug 28 17:32:31 2015 +0300 +++ b/hotspot/src/share/vm/gc/shared/cardTableModRefBSForCTRS.cpp Fri Aug 28 23:57:26 2015 +0200 @@ -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), diff -r 8cde9aca5e9f -r d5dfba528673 hotspot/src/share/vm/gc/shared/collectorPolicy.hpp --- a/hotspot/src/share/vm/gc/shared/collectorPolicy.hpp Fri Aug 28 17:32:31 2015 +0300 +++ b/hotspot/src/share/vm/gc/shared/collectorPolicy.hpp Fri Aug 28 23:57:26 2015 +0200 @@ -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; } diff -r 8cde9aca5e9f -r d5dfba528673 hotspot/src/share/vm/opto/graphKit.cpp --- a/hotspot/src/share/vm/opto/graphKit.cpp Fri Aug 28 17:32:31 2015 +0300 +++ b/hotspot/src/share/vm/opto/graphKit.cpp Fri Aug 28 23:57:26 2015 +0200 @@ -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) ); diff -r 8cde9aca5e9f -r d5dfba528673 hotspot/src/share/vm/runtime/vmStructs.cpp --- a/hotspot/src/share/vm/runtime/vmStructs.cpp Fri Aug 28 17:32:31 2015 +0300 +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp Fri Aug 28 23:57:26 2015 +0200 @@ -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) \ diff -r 8cde9aca5e9f -r d5dfba528673 hotspot/src/share/vm/shark/sharkBuilder.cpp --- a/hotspot/src/share/vm/shark/sharkBuilder.cpp Fri Aug 28 17:32:31 2015 +0300 +++ b/hotspot/src/share/vm/shark/sharkBuilder.cpp Fri Aug 28 23:57:26 2015 +0200 @@ -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()),