comparison src/share/vm/gc_implementation/g1/concurrentMark.cpp @ 2037:b03260081e9b

7006113: G1: Initialize ReferenceProcessor::_is_alive_non_header field Summary: Initialize the _is_alive_non_header field of G1's reference processor with an instance of the G1CMIsAliveClosure. This will stop adding reference objects with live referents to the discovered reference lists unnecessarily. Reviewed-by: tonyp, ysr, jwilhelm, brutisso
author johnc
date Fri, 17 Dec 2010 11:26:53 -0800
parents fd1d227ef1b9
children 7246a374a9f2
comparison
equal deleted inserted replaced
2031:36eef023306f 2037:b03260081e9b
1823 assert(hd == next_hd, "how not?"); 1823 assert(hd == next_hd, "how not?");
1824 } 1824 }
1825 } 1825 }
1826 } 1826 }
1827 1827
1828 1828 bool G1CMIsAliveClosure::do_object_b(oop obj) {
1829 class G1CMIsAliveClosure: public BoolObjectClosure { 1829 HeapWord* addr = (HeapWord*)obj;
1830 G1CollectedHeap* _g1; 1830 return addr != NULL &&
1831 public: 1831 (!_g1->is_in_g1_reserved(addr) || !_g1->is_obj_ill(obj));
1832 G1CMIsAliveClosure(G1CollectedHeap* g1) : 1832 }
1833 _g1(g1)
1834 {}
1835
1836 void do_object(oop obj) {
1837 assert(false, "not to be invoked");
1838 }
1839 bool do_object_b(oop obj) {
1840 HeapWord* addr = (HeapWord*)obj;
1841 return addr != NULL &&
1842 (!_g1->is_in_g1_reserved(addr) || !_g1->is_obj_ill(obj));
1843 }
1844 };
1845 1833
1846 class G1CMKeepAliveClosure: public OopClosure { 1834 class G1CMKeepAliveClosure: public OopClosure {
1847 G1CollectedHeap* _g1; 1835 G1CollectedHeap* _g1;
1848 ConcurrentMark* _cm; 1836 ConcurrentMark* _cm;
1849 CMBitMap* _bitMap; 1837 CMBitMap* _bitMap;
1894 1882
1895 // Process weak references. 1883 // Process weak references.
1896 rp->setup_policy(clear_all_soft_refs); 1884 rp->setup_policy(clear_all_soft_refs);
1897 assert(_markStack.isEmpty(), "mark stack should be empty"); 1885 assert(_markStack.isEmpty(), "mark stack should be empty");
1898 1886
1899 G1CMIsAliveClosure g1IsAliveClosure (g1h); 1887 G1CMIsAliveClosure g1_is_alive(g1h);
1900 G1CMKeepAliveClosure g1KeepAliveClosure(g1h, this, nextMarkBitMap()); 1888 G1CMKeepAliveClosure g1_keep_alive(g1h, this, nextMarkBitMap());
1901 G1CMDrainMarkingStackClosure 1889 G1CMDrainMarkingStackClosure
1902 g1DrainMarkingStackClosure(nextMarkBitMap(), &_markStack, 1890 g1_drain_mark_stack(nextMarkBitMap(), &_markStack, &g1_keep_alive);
1903 &g1KeepAliveClosure);
1904 1891
1905 // XXXYYY Also: copy the parallel ref processing code from CMS. 1892 // XXXYYY Also: copy the parallel ref processing code from CMS.
1906 rp->process_discovered_references(&g1IsAliveClosure, 1893 rp->process_discovered_references(&g1_is_alive,
1907 &g1KeepAliveClosure, 1894 &g1_keep_alive,
1908 &g1DrainMarkingStackClosure, 1895 &g1_drain_mark_stack,
1909 NULL); 1896 NULL);
1910 assert(_markStack.overflow() || _markStack.isEmpty(), 1897 assert(_markStack.overflow() || _markStack.isEmpty(),
1911 "mark stack should be empty (unless it overflowed)"); 1898 "mark stack should be empty (unless it overflowed)");
1912 if (_markStack.overflow()) { 1899 if (_markStack.overflow()) {
1913 set_has_overflown(); 1900 set_has_overflown();
1916 rp->enqueue_discovered_references(); 1903 rp->enqueue_discovered_references();
1917 rp->verify_no_references_recorded(); 1904 rp->verify_no_references_recorded();
1918 assert(!rp->discovery_enabled(), "should have been disabled"); 1905 assert(!rp->discovery_enabled(), "should have been disabled");
1919 1906
1920 // Now clean up stale oops in SymbolTable and StringTable 1907 // Now clean up stale oops in SymbolTable and StringTable
1921 SymbolTable::unlink(&g1IsAliveClosure); 1908 SymbolTable::unlink(&g1_is_alive);
1922 StringTable::unlink(&g1IsAliveClosure); 1909 StringTable::unlink(&g1_is_alive);
1923 } 1910 }
1924 1911
1925 void ConcurrentMark::swapMarkBitMaps() { 1912 void ConcurrentMark::swapMarkBitMaps() {
1926 CMBitMapRO* temp = _prevMarkBitMap; 1913 CMBitMapRO* temp = _prevMarkBitMap;
1927 _prevMarkBitMap = (CMBitMapRO*)_nextMarkBitMap; 1914 _prevMarkBitMap = (CMBitMapRO*)_nextMarkBitMap;