src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp

Print this page
rev 2896 : 6484965: G1: piggy-back liveness accounting phase on marking
Summary: Remove the separate counting phase of concurrent marking by tracking the amount of marked bytes and the cards spanned by marked objects in marking task/worker thread local data structures, which are updated as individual objects are marked.
Reviewed-by: brutisso

*** 860,870 **** // structures. void finalize_for_evac_failure(); // An attempt to evacuate "obj" has failed; take necessary steps. oop handle_evacuation_failure_par(OopsInHeapRegionClosure* cl, oop obj, ! bool should_mark_root); void handle_evacuation_failure_common(oop obj, markOop m); // ("Weak") Reference processing support. // // G1 has 2 instances of the referece processor class. One --- 860,871 ---- // structures. void finalize_for_evac_failure(); // An attempt to evacuate "obj" has failed; take necessary steps. oop handle_evacuation_failure_par(OopsInHeapRegionClosure* cl, oop obj, ! bool should_mark_root, ! int worker_i); void handle_evacuation_failure_common(oop obj, markOop m); // ("Weak") Reference processing support. // // G1 has 2 instances of the referece processor class. One
*** 1728,1737 **** --- 1729,1739 ---- // starts from the middle of the bitmap, we need to add enough // space (i.e. up to a bitmap word) to ensure that we have // enough bits in the bitmap. return bits_in_bitmap + BitsPerWord - 1; } + public: GCLabBitMap(HeapWord* heap_start, size_t gclab_word_size) : BitMap(bitmap_size_in_bits(gclab_word_size)), _cm(G1CollectedHeap::heap()->concurrent_mark()), _shifter(shifter()),
*** 1817,1850 **** GCLabBitMapClosure cl(_cm, this); iterate(&cl); } #endif // PRODUCT ! void retire() { ! guarantee(use_local_bitmaps, "invariant"); ! assert(fields_well_formed(), "invariant"); ! ! if (_start_word != NULL) { ! CMBitMap* mark_bitmap = _cm->nextMarkBitMap(); ! ! // this means that the bitmap was set up for the GCLab ! assert(_real_start_word != NULL && _real_end_word != NULL, "invariant"); ! ! mark_bitmap->mostly_disjoint_range_union(this, ! 0, // always start from the start of the bitmap ! _start_word, ! gclab_real_word_size()); ! _cm->grayRegionIfNecessary(MemRegion(_real_start_word, _real_end_word)); ! ! #ifndef PRODUCT ! if (use_local_bitmaps && verify_local_bitmaps) ! verify(); ! #endif // PRODUCT ! } else { ! assert(_real_start_word == NULL && _real_end_word == NULL, "invariant"); ! } ! } size_t bitmap_size_in_words() const { return (bitmap_size_in_bits(gclab_word_size()) + BitsPerWord - 1) / BitsPerWord; } --- 1819,1829 ---- GCLabBitMapClosure cl(_cm, this); iterate(&cl); } #endif // PRODUCT ! void retire(int worker_i); size_t bitmap_size_in_words() const { return (bitmap_size_in_bits(gclab_word_size()) + BitsPerWord - 1) / BitsPerWord; }
*** 1853,1865 **** class G1ParGCAllocBuffer: public ParGCAllocBuffer { private: bool _retired; bool _should_mark_objects; GCLabBitMap _bitmap; public: ! G1ParGCAllocBuffer(size_t gclab_word_size); inline bool mark(HeapWord* addr) { guarantee(use_local_bitmaps, "invariant"); assert(_should_mark_objects, "invariant"); return _bitmap.mark(addr); --- 1832,1845 ---- class G1ParGCAllocBuffer: public ParGCAllocBuffer { private: bool _retired; bool _should_mark_objects; GCLabBitMap _bitmap; + int _worker_i; public: ! G1ParGCAllocBuffer(size_t gclab_word_size, int worker_i); inline bool mark(HeapWord* addr) { guarantee(use_local_bitmaps, "invariant"); assert(_should_mark_objects, "invariant"); return _bitmap.mark(addr);
*** 1875,1885 **** inline void retire(bool end_of_gc, bool retain) { if (_retired) return; if (use_local_bitmaps && _should_mark_objects) { ! _bitmap.retire(); } ParGCAllocBuffer::retire(end_of_gc, retain); _retired = true; } }; --- 1855,1865 ---- inline void retire(bool end_of_gc, bool retain) { if (_retired) return; if (use_local_bitmaps && _should_mark_objects) { ! _bitmap.retire(_worker_i); } ParGCAllocBuffer::retire(end_of_gc, retain); _retired = true; } };