src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp

Print this page
rev 6248 : imported patch fast-cset-uses-biasedarray
rev 6251 : 8028710: G1 does not retire allocation buffers after reference processing work
Summary: G1 does not retire allocation buffers after reference processing work when -XX:+ParallelRefProcEnabled is enabled.
Reviewed-by:

*** 1684,1702 **** private: bool _retired; public: G1ParGCAllocBuffer(size_t gclab_word_size); ! void set_buf(HeapWord* buf) { ParGCAllocBuffer::set_buf(buf); _retired = false; } ! void retire(bool end_of_gc, bool retain) { ! if (_retired) return; ParGCAllocBuffer::retire(end_of_gc, retain); _retired = true; } }; --- 1684,1706 ---- private: bool _retired; public: G1ParGCAllocBuffer(size_t gclab_word_size); + virtual ~G1ParGCAllocBuffer() { + guarantee(_retired, "Allocation buffer has not been retired"); + } ! virtual void set_buf(HeapWord* buf) { ParGCAllocBuffer::set_buf(buf); _retired = false; } ! virtual void retire(bool end_of_gc, bool retain) { ! if (_retired) { return; + } ParGCAllocBuffer::retire(end_of_gc, retain); _retired = true; } };
*** 1762,1771 **** --- 1766,1776 ---- public: G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num, ReferenceProcessor* rp); ~G1ParScanThreadState() { + retire_alloc_buffers(); FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base, mtGC); } RefToScanQueue* refs() { return _refs; } ageTable* age_table() { return &_age_table; }
*** 1872,1892 **** // We add on to hide entry 0 which accumulates surviving words for // age -1 regions (i.e. non-young ones) return _surviving_young_words; } void retire_alloc_buffers() { for (int ap = 0; ap < GCAllocPurposeCount; ++ap) { size_t waste = _alloc_buffers[ap]->words_remaining(); add_to_alloc_buffer_waste(waste); _alloc_buffers[ap]->flush_stats_and_retire(_g1h->stats_for_purpose((GCAllocPurpose)ap), true /* end_of_gc */, false /* retain */); } } ! private: ! #define G1_PARTIAL_ARRAY_MASK 0x2 inline bool has_partial_array_mask(oop* ref) const { return ((uintptr_t)ref & G1_PARTIAL_ARRAY_MASK) == G1_PARTIAL_ARRAY_MASK; } --- 1877,1898 ---- // We add on to hide entry 0 which accumulates surviving words for // age -1 regions (i.e. non-young ones) return _surviving_young_words; } + private: void retire_alloc_buffers() { for (int ap = 0; ap < GCAllocPurposeCount; ++ap) { size_t waste = _alloc_buffers[ap]->words_remaining(); add_to_alloc_buffer_waste(waste); _alloc_buffers[ap]->flush_stats_and_retire(_g1h->stats_for_purpose((GCAllocPurpose)ap), true /* end_of_gc */, false /* retain */); } } ! ! #define G1_PARTIAL_ARRAY_MASK 0x2 inline bool has_partial_array_mask(oop* ref) const { return ((uintptr_t)ref & G1_PARTIAL_ARRAY_MASK) == G1_PARTIAL_ARRAY_MASK; }