comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @ 5988:2a0172480595

7127697: G1: remove dead code after recent concurrent mark changes Summary: Removed lots of dead code after some recent conc mark changes. Reviewed-by: brutisso, johnc
author tonyp
date Thu, 05 Apr 2012 13:57:23 -0400
parents 748051fd24ce
children b632e80fc9dc
comparison
equal deleted inserted replaced
5987:748051fd24ce 5988:2a0172480595
1675 1675
1676 protected: 1676 protected:
1677 size_t _max_heap_capacity; 1677 size_t _max_heap_capacity;
1678 }; 1678 };
1679 1679
1680 #define use_local_bitmaps 1
1681 #define verify_local_bitmaps 0
1682 #define oop_buffer_length 256
1683
1684 #ifndef PRODUCT
1685 class GCLabBitMap;
1686 class GCLabBitMapClosure: public BitMapClosure {
1687 private:
1688 ConcurrentMark* _cm;
1689 GCLabBitMap* _bitmap;
1690
1691 public:
1692 GCLabBitMapClosure(ConcurrentMark* cm,
1693 GCLabBitMap* bitmap) {
1694 _cm = cm;
1695 _bitmap = bitmap;
1696 }
1697
1698 virtual bool do_bit(size_t offset);
1699 };
1700 #endif // !PRODUCT
1701
1702 class GCLabBitMap: public BitMap {
1703 private:
1704 ConcurrentMark* _cm;
1705
1706 int _shifter;
1707 size_t _bitmap_word_covers_words;
1708
1709 // beginning of the heap
1710 HeapWord* _heap_start;
1711
1712 // this is the actual start of the GCLab
1713 HeapWord* _real_start_word;
1714
1715 // this is the actual end of the GCLab
1716 HeapWord* _real_end_word;
1717
1718 // this is the first word, possibly located before the actual start
1719 // of the GCLab, that corresponds to the first bit of the bitmap
1720 HeapWord* _start_word;
1721
1722 // size of a GCLab in words
1723 size_t _gclab_word_size;
1724
1725 static int shifter() {
1726 return MinObjAlignment - 1;
1727 }
1728
1729 // how many heap words does a single bitmap word corresponds to?
1730 static size_t bitmap_word_covers_words() {
1731 return BitsPerWord << shifter();
1732 }
1733
1734 size_t gclab_word_size() const {
1735 return _gclab_word_size;
1736 }
1737
1738 // Calculates actual GCLab size in words
1739 size_t gclab_real_word_size() const {
1740 return bitmap_size_in_bits(pointer_delta(_real_end_word, _start_word))
1741 / BitsPerWord;
1742 }
1743
1744 static size_t bitmap_size_in_bits(size_t gclab_word_size) {
1745 size_t bits_in_bitmap = gclab_word_size >> shifter();
1746 // We are going to ensure that the beginning of a word in this
1747 // bitmap also corresponds to the beginning of a word in the
1748 // global marking bitmap. To handle the case where a GCLab
1749 // starts from the middle of the bitmap, we need to add enough
1750 // space (i.e. up to a bitmap word) to ensure that we have
1751 // enough bits in the bitmap.
1752 return bits_in_bitmap + BitsPerWord - 1;
1753 }
1754 public:
1755 GCLabBitMap(HeapWord* heap_start, size_t gclab_word_size)
1756 : BitMap(bitmap_size_in_bits(gclab_word_size)),
1757 _cm(G1CollectedHeap::heap()->concurrent_mark()),
1758 _shifter(shifter()),
1759 _bitmap_word_covers_words(bitmap_word_covers_words()),
1760 _heap_start(heap_start),
1761 _gclab_word_size(gclab_word_size),
1762 _real_start_word(NULL),
1763 _real_end_word(NULL),
1764 _start_word(NULL) {
1765 guarantee(false, "GCLabBitMap::GCLabBitmap(): don't call this any more");
1766 }
1767
1768 inline unsigned heapWordToOffset(HeapWord* addr) {
1769 unsigned offset = (unsigned) pointer_delta(addr, _start_word) >> _shifter;
1770 assert(offset < size(), "offset should be within bounds");
1771 return offset;
1772 }
1773
1774 inline HeapWord* offsetToHeapWord(size_t offset) {
1775 HeapWord* addr = _start_word + (offset << _shifter);
1776 assert(_real_start_word <= addr && addr < _real_end_word, "invariant");
1777 return addr;
1778 }
1779
1780 bool fields_well_formed() {
1781 bool ret1 = (_real_start_word == NULL) &&
1782 (_real_end_word == NULL) &&
1783 (_start_word == NULL);
1784 if (ret1)
1785 return true;
1786
1787 bool ret2 = _real_start_word >= _start_word &&
1788 _start_word < _real_end_word &&
1789 (_real_start_word + _gclab_word_size) == _real_end_word &&
1790 (_start_word + _gclab_word_size + _bitmap_word_covers_words)
1791 > _real_end_word;
1792 return ret2;
1793 }
1794
1795 inline bool mark(HeapWord* addr) {
1796 guarantee(use_local_bitmaps, "invariant");
1797 assert(fields_well_formed(), "invariant");
1798
1799 if (addr >= _real_start_word && addr < _real_end_word) {
1800 assert(!isMarked(addr), "should not have already been marked");
1801
1802 // first mark it on the bitmap
1803 at_put(heapWordToOffset(addr), true);
1804
1805 return true;
1806 } else {
1807 return false;
1808 }
1809 }
1810
1811 inline bool isMarked(HeapWord* addr) {
1812 guarantee(use_local_bitmaps, "invariant");
1813 assert(fields_well_formed(), "invariant");
1814
1815 return at(heapWordToOffset(addr));
1816 }
1817
1818 void set_buffer(HeapWord* start) {
1819 guarantee(false, "set_buffer(): don't call this any more");
1820
1821 guarantee(use_local_bitmaps, "invariant");
1822 clear();
1823
1824 assert(start != NULL, "invariant");
1825 _real_start_word = start;
1826 _real_end_word = start + _gclab_word_size;
1827
1828 size_t diff =
1829 pointer_delta(start, _heap_start) % _bitmap_word_covers_words;
1830 _start_word = start - diff;
1831
1832 assert(fields_well_formed(), "invariant");
1833 }
1834
1835 #ifndef PRODUCT
1836 void verify() {
1837 // verify that the marks have been propagated
1838 GCLabBitMapClosure cl(_cm, this);
1839 iterate(&cl);
1840 }
1841 #endif // PRODUCT
1842
1843 void retire() {
1844 guarantee(false, "retire(): don't call this any more");
1845
1846 guarantee(use_local_bitmaps, "invariant");
1847 assert(fields_well_formed(), "invariant");
1848
1849 if (_start_word != NULL) {
1850 CMBitMap* mark_bitmap = _cm->nextMarkBitMap();
1851
1852 // this means that the bitmap was set up for the GCLab
1853 assert(_real_start_word != NULL && _real_end_word != NULL, "invariant");
1854
1855 mark_bitmap->mostly_disjoint_range_union(this,
1856 0, // always start from the start of the bitmap
1857 _start_word,
1858 gclab_real_word_size());
1859 _cm->grayRegionIfNecessary(MemRegion(_real_start_word, _real_end_word));
1860
1861 #ifndef PRODUCT
1862 if (use_local_bitmaps && verify_local_bitmaps)
1863 verify();
1864 #endif // PRODUCT
1865 } else {
1866 assert(_real_start_word == NULL && _real_end_word == NULL, "invariant");
1867 }
1868 }
1869
1870 size_t bitmap_size_in_words() const {
1871 return (bitmap_size_in_bits(gclab_word_size()) + BitsPerWord - 1) / BitsPerWord;
1872 }
1873
1874 };
1875
1876 class G1ParGCAllocBuffer: public ParGCAllocBuffer { 1680 class G1ParGCAllocBuffer: public ParGCAllocBuffer {
1877 private: 1681 private:
1878 bool _retired; 1682 bool _retired;
1879 1683
1880 public: 1684 public: