comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @ 3886:eeae91c9baba

7080389: G1: refactor marking code in evacuation pause copy closures Summary: Refactor code marking code in the evacuation pause copy closures so that an evacuated object is only marked by the thread that successfully copies it. Reviewed-by: stefank, brutisso, tonyp
author johnc
date Mon, 29 Aug 2011 10:13:06 -0700
parents ff53346271fe
children 663cb89032b1
comparison
equal deleted inserted replaced
3885:3cd0157e1d4d 3886:eeae91c9baba
1713 }; 1713 };
1714 1714
1715 class G1ParGCAllocBuffer: public ParGCAllocBuffer { 1715 class G1ParGCAllocBuffer: public ParGCAllocBuffer {
1716 private: 1716 private:
1717 bool _retired; 1717 bool _retired;
1718 bool _during_marking; 1718 bool _should_mark_objects;
1719 GCLabBitMap _bitmap; 1719 GCLabBitMap _bitmap;
1720 1720
1721 public: 1721 public:
1722 G1ParGCAllocBuffer(size_t gclab_word_size) : 1722 G1ParGCAllocBuffer(size_t gclab_word_size);
1723 ParGCAllocBuffer(gclab_word_size),
1724 _during_marking(G1CollectedHeap::heap()->mark_in_progress()),
1725 _bitmap(G1CollectedHeap::heap()->reserved_region().start(), gclab_word_size),
1726 _retired(false)
1727 { }
1728 1723
1729 inline bool mark(HeapWord* addr) { 1724 inline bool mark(HeapWord* addr) {
1730 guarantee(use_local_bitmaps, "invariant"); 1725 guarantee(use_local_bitmaps, "invariant");
1731 assert(_during_marking, "invariant"); 1726 assert(_should_mark_objects, "invariant");
1732 return _bitmap.mark(addr); 1727 return _bitmap.mark(addr);
1733 } 1728 }
1734 1729
1735 inline void set_buf(HeapWord* buf) { 1730 inline void set_buf(HeapWord* buf) {
1736 if (use_local_bitmaps && _during_marking) 1731 if (use_local_bitmaps && _should_mark_objects) {
1737 _bitmap.set_buffer(buf); 1732 _bitmap.set_buffer(buf);
1733 }
1738 ParGCAllocBuffer::set_buf(buf); 1734 ParGCAllocBuffer::set_buf(buf);
1739 _retired = false; 1735 _retired = false;
1740 } 1736 }
1741 1737
1742 inline void retire(bool end_of_gc, bool retain) { 1738 inline void retire(bool end_of_gc, bool retain) {
1743 if (_retired) 1739 if (_retired)
1744 return; 1740 return;
1745 if (use_local_bitmaps && _during_marking) { 1741 if (use_local_bitmaps && _should_mark_objects) {
1746 _bitmap.retire(); 1742 _bitmap.retire();
1747 } 1743 }
1748 ParGCAllocBuffer::retire(end_of_gc, retain); 1744 ParGCAllocBuffer::retire(end_of_gc, retain);
1749 _retired = true; 1745 _retired = true;
1750 } 1746 }