61 static ByteSize byte_offset_of_buf() { 62 return PtrQueue::byte_offset_of_buf<G1DirtyCardQueue>(); 63 } 64 using PtrQueue::byte_width_of_buf; 65 66 }; 67 68 class G1DirtyCardQueueSet: public PtrQueueSet { 69 Monitor* _cbl_mon; // Protects the list and count members. 70 BufferNode* _completed_buffers_head; 71 BufferNode* _completed_buffers_tail; 72 73 // Number of actual cards in the list of completed buffers. 74 volatile size_t _num_cards; 75 76 size_t _process_cards_threshold; 77 volatile bool _process_completed_buffers; 78 79 void abandon_completed_buffers(); 80 81 bool mut_process_buffer(BufferNode* node); 82 83 // If the queue contains more cards than configured here, the 84 // mutator must start doing some of the concurrent refinement work. 85 size_t _max_cards; 86 size_t _max_cards_padding; 87 static const size_t MaxCardsUnlimited = SIZE_MAX; 88 89 G1FreeIdSet _free_ids; 90 91 // Array of cumulative dirty cards refined by mutator threads. 92 // Array has an entry per id in _free_ids. 93 size_t* _mutator_refined_cards_counters; 94 95 public: 96 G1DirtyCardQueueSet(Monitor* cbl_mon, BufferNode::Allocator* allocator); 97 ~G1DirtyCardQueueSet(); 98 99 // The number of parallel ids that can be claimed to allow collector or 100 // mutator threads to do card-processing work. | 61 static ByteSize byte_offset_of_buf() { 62 return PtrQueue::byte_offset_of_buf<G1DirtyCardQueue>(); 63 } 64 using PtrQueue::byte_width_of_buf; 65 66 }; 67 68 class G1DirtyCardQueueSet: public PtrQueueSet { 69 Monitor* _cbl_mon; // Protects the list and count members. 70 BufferNode* _completed_buffers_head; 71 BufferNode* _completed_buffers_tail; 72 73 // Number of actual cards in the list of completed buffers. 74 volatile size_t _num_cards; 75 76 size_t _process_cards_threshold; 77 volatile bool _process_completed_buffers; 78 79 void abandon_completed_buffers(); 80 81 // Refine the cards in "node" from its index to buffer_size. 82 // Stops processing if SuspendibleThreadSet::should_yield() is true. 83 // Returns true if the entire buffer was processed, false if there 84 // is a pending yield request. The node's index is updated to exclude 85 // the processed elements, e.g. up to the element before processing 86 // stopped, or one past the last element if the entire buffer was 87 // processed. Increments *total_refined_cards by the number of cards 88 // processed and removed from the buffer. 89 bool refine_buffer(BufferNode* node, uint worker_id, size_t* total_refined_cards); 90 91 bool mut_process_buffer(BufferNode* node); 92 93 // If the queue contains more cards than configured here, the 94 // mutator must start doing some of the concurrent refinement work. 95 size_t _max_cards; 96 size_t _max_cards_padding; 97 static const size_t MaxCardsUnlimited = SIZE_MAX; 98 99 G1FreeIdSet _free_ids; 100 101 // Array of cumulative dirty cards refined by mutator threads. 102 // Array has an entry per id in _free_ids. 103 size_t* _mutator_refined_cards_counters; 104 105 public: 106 G1DirtyCardQueueSet(Monitor* cbl_mon, BufferNode::Allocator* allocator); 107 ~G1DirtyCardQueueSet(); 108 109 // The number of parallel ids that can be claimed to allow collector or 110 // mutator threads to do card-processing work. |