--- old/src/share/vm/gc/g1/g1CollectedHeap.hpp 2015-08-12 14:09:27.000000000 +0200 +++ new/src/share/vm/gc/g1/g1CollectedHeap.hpp 2015-08-12 14:09:26.000000000 +0200 @@ -57,6 +57,7 @@ class OopsInHeapRegionClosure; class G1KlassScanClosure; class G1ParScanThreadState; +class GlobalSynchronizer; class ObjectClosure; class SpaceClosure; class CompactibleSpaceClosure; @@ -169,7 +170,51 @@ bool do_object_b(oop p); }; -class RefineCardTableEntryClosure; +class RefineCardTableEntryClosure: public CardTableEntryClosure { +public: + RefineCardTableEntryClosure() { } + bool do_card_ptr(jbyte* card_ptr, uint worker_i); +}; + +class CardBuffer : public CHeapObj { +public: + CardBuffer *_next; + GlobalSynchronizer *_gs; + jbyte **_card_buffer; + MemRegion *_mr_buffer; + int _length; + + int _misses; + + CardBuffer(); + virtual ~CardBuffer(); +}; + +class BufferedRefineCardTableEntryClosure: public CardTableEntryClosure { + CardBuffer *_head_buffer; + CardBuffer *_tail_buffer; + CardBuffer *_current_buffer; + + int _index; + int _async_buffers; + + uint _worker_i; + G1CollectedHeap *const _g1h; + + bool pre_sync(CardBuffer *buffer, bool hard); + bool sync(CardBuffer *buffer, bool hard); + void post_sync(CardBuffer *buffer); + + void general_flush(bool hard); + void soft_flush(); +public: + BufferedRefineCardTableEntryClosure(); + ~BufferedRefineCardTableEntryClosure(); + static int buffer_size(); + bool do_card_ptr(jbyte *card_ptr, uint worker_i); + void flush_buffer(); +}; + class G1RegionMappingChangedListener : public G1MappingChangedListener { private: @@ -831,8 +876,7 @@ // concurrently after the collection. DirtyCardQueueSet _dirty_card_queue_set; - // The closure used to refine a single card. - RefineCardTableEntryClosure* _refine_cte_cl; + bool _refine_cte_cl_concurrency; // A DirtyCardQueueSet that is used to hold cards that contain // references into the current collection set. This is used to @@ -1020,6 +1064,7 @@ public: + bool refine_cte_cl_concurrency(); void set_refine_cte_cl_concurrency(bool concurrent); RefToScanQueue *task_queue(uint i) const;