Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @ 20215:983092f35ff7
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. This causes wrong calculation of PLAB sizes, as the amount of space wasted is not updated correctly.
Reviewed-by: brutisso
author | tschatzl |
---|---|
date | Mon, 21 Jul 2014 09:40:19 +0200 |
parents | d7e2d5f2846b |
children | b0c374311c4e |
comparison
equal
deleted
inserted
replaced
20214:8cc89a893545 | 20215:983092f35ff7 |
---|---|
1689 private: | 1689 private: |
1690 bool _retired; | 1690 bool _retired; |
1691 | 1691 |
1692 public: | 1692 public: |
1693 G1ParGCAllocBuffer(size_t gclab_word_size); | 1693 G1ParGCAllocBuffer(size_t gclab_word_size); |
1694 | 1694 virtual ~G1ParGCAllocBuffer() { |
1695 void set_buf(HeapWord* buf) { | 1695 guarantee(_retired, "Allocation buffer has not been retired"); |
1696 } | |
1697 | |
1698 virtual void set_buf(HeapWord* buf) { | |
1696 ParGCAllocBuffer::set_buf(buf); | 1699 ParGCAllocBuffer::set_buf(buf); |
1697 _retired = false; | 1700 _retired = false; |
1698 } | 1701 } |
1699 | 1702 |
1700 void retire(bool end_of_gc, bool retain) { | 1703 virtual void retire(bool end_of_gc, bool retain) { |
1701 if (_retired) | 1704 if (_retired) { |
1702 return; | 1705 return; |
1706 } | |
1703 ParGCAllocBuffer::retire(end_of_gc, retain); | 1707 ParGCAllocBuffer::retire(end_of_gc, retain); |
1704 _retired = true; | 1708 _retired = true; |
1705 } | 1709 } |
1706 }; | 1710 }; |
1707 | 1711 |
1767 | 1771 |
1768 public: | 1772 public: |
1769 G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num, ReferenceProcessor* rp); | 1773 G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num, ReferenceProcessor* rp); |
1770 | 1774 |
1771 ~G1ParScanThreadState() { | 1775 ~G1ParScanThreadState() { |
1776 retire_alloc_buffers(); | |
1772 FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base, mtGC); | 1777 FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base, mtGC); |
1773 } | 1778 } |
1774 | 1779 |
1775 RefToScanQueue* refs() { return _refs; } | 1780 RefToScanQueue* refs() { return _refs; } |
1776 ageTable* age_table() { return &_age_table; } | 1781 ageTable* age_table() { return &_age_table; } |
1877 // We add on to hide entry 0 which accumulates surviving words for | 1882 // We add on to hide entry 0 which accumulates surviving words for |
1878 // age -1 regions (i.e. non-young ones) | 1883 // age -1 regions (i.e. non-young ones) |
1879 return _surviving_young_words; | 1884 return _surviving_young_words; |
1880 } | 1885 } |
1881 | 1886 |
1887 private: | |
1882 void retire_alloc_buffers() { | 1888 void retire_alloc_buffers() { |
1883 for (int ap = 0; ap < GCAllocPurposeCount; ++ap) { | 1889 for (int ap = 0; ap < GCAllocPurposeCount; ++ap) { |
1884 size_t waste = _alloc_buffers[ap]->words_remaining(); | 1890 size_t waste = _alloc_buffers[ap]->words_remaining(); |
1885 add_to_alloc_buffer_waste(waste); | 1891 add_to_alloc_buffer_waste(waste); |
1886 _alloc_buffers[ap]->flush_stats_and_retire(_g1h->stats_for_purpose((GCAllocPurpose)ap), | 1892 _alloc_buffers[ap]->flush_stats_and_retire(_g1h->stats_for_purpose((GCAllocPurpose)ap), |
1887 true /* end_of_gc */, | 1893 true /* end_of_gc */, |
1888 false /* retain */); | 1894 false /* retain */); |
1889 } | 1895 } |
1890 } | 1896 } |
1891 private: | 1897 |
1892 #define G1_PARTIAL_ARRAY_MASK 0x2 | 1898 #define G1_PARTIAL_ARRAY_MASK 0x2 |
1893 | 1899 |
1894 inline bool has_partial_array_mask(oop* ref) const { | 1900 inline bool has_partial_array_mask(oop* ref) const { |
1895 return ((uintptr_t)ref & G1_PARTIAL_ARRAY_MASK) == G1_PARTIAL_ARRAY_MASK; | 1901 return ((uintptr_t)ref & G1_PARTIAL_ARRAY_MASK) == G1_PARTIAL_ARRAY_MASK; |
1896 } | 1902 } |
1897 | 1903 |