1686 private: |
1686 private: |
1687 bool _retired; |
1687 bool _retired; |
1688 |
1688 |
1689 public: |
1689 public: |
1690 G1ParGCAllocBuffer(size_t gclab_word_size); |
1690 G1ParGCAllocBuffer(size_t gclab_word_size); |
1691 |
1691 virtual ~G1ParGCAllocBuffer() { |
1692 void set_buf(HeapWord* buf) { |
1692 guarantee(_retired, "Allocation buffer has not been retired"); |
|
1693 } |
|
1694 |
|
1695 virtual void set_buf(HeapWord* buf) { |
1693 ParGCAllocBuffer::set_buf(buf); |
1696 ParGCAllocBuffer::set_buf(buf); |
1694 _retired = false; |
1697 _retired = false; |
1695 } |
1698 } |
1696 |
1699 |
1697 void retire(bool end_of_gc, bool retain) { |
1700 virtual void retire(bool end_of_gc, bool retain) { |
1698 if (_retired) |
1701 if (_retired) { |
1699 return; |
1702 return; |
|
1703 } |
1700 ParGCAllocBuffer::retire(end_of_gc, retain); |
1704 ParGCAllocBuffer::retire(end_of_gc, retain); |
1701 _retired = true; |
1705 _retired = true; |
1702 } |
1706 } |
1703 }; |
1707 }; |
1704 |
1708 |
1764 |
1768 |
1765 public: |
1769 public: |
1766 G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num, ReferenceProcessor* rp); |
1770 G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num, ReferenceProcessor* rp); |
1767 |
1771 |
1768 ~G1ParScanThreadState() { |
1772 ~G1ParScanThreadState() { |
|
1773 retire_alloc_buffers(); |
1769 FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base, mtGC); |
1774 FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base, mtGC); |
1770 } |
1775 } |
1771 |
1776 |
1772 RefToScanQueue* refs() { return _refs; } |
1777 RefToScanQueue* refs() { return _refs; } |
1773 ageTable* age_table() { return &_age_table; } |
1778 ageTable* age_table() { return &_age_table; } |
1874 // We add on to hide entry 0 which accumulates surviving words for |
1879 // We add on to hide entry 0 which accumulates surviving words for |
1875 // age -1 regions (i.e. non-young ones) |
1880 // age -1 regions (i.e. non-young ones) |
1876 return _surviving_young_words; |
1881 return _surviving_young_words; |
1877 } |
1882 } |
1878 |
1883 |
|
1884 private: |
1879 void retire_alloc_buffers() { |
1885 void retire_alloc_buffers() { |
1880 for (int ap = 0; ap < GCAllocPurposeCount; ++ap) { |
1886 for (int ap = 0; ap < GCAllocPurposeCount; ++ap) { |
1881 size_t waste = _alloc_buffers[ap]->words_remaining(); |
1887 size_t waste = _alloc_buffers[ap]->words_remaining(); |
1882 add_to_alloc_buffer_waste(waste); |
1888 add_to_alloc_buffer_waste(waste); |
1883 _alloc_buffers[ap]->flush_stats_and_retire(_g1h->stats_for_purpose((GCAllocPurpose)ap), |
1889 _alloc_buffers[ap]->flush_stats_and_retire(_g1h->stats_for_purpose((GCAllocPurpose)ap), |
1884 true /* end_of_gc */, |
1890 true /* end_of_gc */, |
1885 false /* retain */); |
1891 false /* retain */); |
1886 } |
1892 } |
1887 } |
1893 } |
1888 private: |
1894 |
1889 #define G1_PARTIAL_ARRAY_MASK 0x2 |
1895 #define G1_PARTIAL_ARRAY_MASK 0x2 |
1890 |
1896 |
1891 inline bool has_partial_array_mask(oop* ref) const { |
1897 inline bool has_partial_array_mask(oop* ref) const { |
1892 return ((uintptr_t)ref & G1_PARTIAL_ARRAY_MASK) == G1_PARTIAL_ARRAY_MASK; |
1898 return ((uintptr_t)ref & G1_PARTIAL_ARRAY_MASK) == G1_PARTIAL_ARRAY_MASK; |
1893 } |
1899 } |
1894 |
1900 |