1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Mon Jul 21 09:40:19 2014 +0200 1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Mon Jul 21 09:40:19 2014 +0200 1.3 @@ -1691,15 +1691,19 @@ 1.4 1.5 public: 1.6 G1ParGCAllocBuffer(size_t gclab_word_size); 1.7 + virtual ~G1ParGCAllocBuffer() { 1.8 + guarantee(_retired, "Allocation buffer has not been retired"); 1.9 + } 1.10 1.11 - void set_buf(HeapWord* buf) { 1.12 + virtual void set_buf(HeapWord* buf) { 1.13 ParGCAllocBuffer::set_buf(buf); 1.14 _retired = false; 1.15 } 1.16 1.17 - void retire(bool end_of_gc, bool retain) { 1.18 - if (_retired) 1.19 + virtual void retire(bool end_of_gc, bool retain) { 1.20 + if (_retired) { 1.21 return; 1.22 + } 1.23 ParGCAllocBuffer::retire(end_of_gc, retain); 1.24 _retired = true; 1.25 } 1.26 @@ -1769,6 +1773,7 @@ 1.27 G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num, ReferenceProcessor* rp); 1.28 1.29 ~G1ParScanThreadState() { 1.30 + retire_alloc_buffers(); 1.31 FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base, mtGC); 1.32 } 1.33 1.34 @@ -1879,6 +1884,7 @@ 1.35 return _surviving_young_words; 1.36 } 1.37 1.38 +private: 1.39 void retire_alloc_buffers() { 1.40 for (int ap = 0; ap < GCAllocPurposeCount; ++ap) { 1.41 size_t waste = _alloc_buffers[ap]->words_remaining(); 1.42 @@ -1888,8 +1894,8 @@ 1.43 false /* retain */); 1.44 } 1.45 } 1.46 -private: 1.47 - #define G1_PARTIAL_ARRAY_MASK 0x2 1.48 + 1.49 +#define G1_PARTIAL_ARRAY_MASK 0x2 1.50 1.51 inline bool has_partial_array_mask(oop* ref) const { 1.52 return ((uintptr_t)ref & G1_PARTIAL_ARRAY_MASK) == G1_PARTIAL_ARRAY_MASK;