67 |
67 |
68 class G1DirtyCardQueueSet: public PtrQueueSet { |
68 class G1DirtyCardQueueSet: public PtrQueueSet { |
69 Monitor* _cbl_mon; // Protects the fields below. |
69 Monitor* _cbl_mon; // Protects the fields below. |
70 BufferNode* _completed_buffers_head; |
70 BufferNode* _completed_buffers_head; |
71 BufferNode* _completed_buffers_tail; |
71 BufferNode* _completed_buffers_tail; |
72 volatile size_t _n_completed_buffers; |
72 |
|
73 // Number of actual entries in the list of completed buffers. |
|
74 volatile size_t _num_entries_in_completed_buffers; |
73 |
75 |
74 size_t _process_completed_buffers_threshold; |
76 size_t _process_completed_buffers_threshold; |
75 volatile bool _process_completed_buffers; |
77 volatile bool _process_completed_buffers; |
76 |
78 |
77 // If true, notify_all on _cbl_mon when the threshold is reached. |
79 // If true, notify_all on _cbl_mon when the threshold is reached. |
78 bool _notify_when_complete; |
80 bool _notify_when_complete; |
79 |
|
80 void assert_completed_buffers_list_len_correct_locked() NOT_DEBUG_RETURN; |
|
81 |
81 |
82 void abandon_completed_buffers(); |
82 void abandon_completed_buffers(); |
83 |
83 |
84 // Apply the closure to the elements of "node" from it's index to |
84 // Apply the closure to the elements of "node" from it's index to |
85 // buffer_size. If all closure applications return true, then |
85 // buffer_size. If all closure applications return true, then |
148 |
148 |
149 // If the number of completed buffers is > stop_at, then remove and |
149 // If the number of completed buffers is > stop_at, then remove and |
150 // return a completed buffer from the list. Otherwise, return NULL. |
150 // return a completed buffer from the list. Otherwise, return NULL. |
151 BufferNode* get_completed_buffer(size_t stop_at = 0); |
151 BufferNode* get_completed_buffer(size_t stop_at = 0); |
152 |
152 |
153 // The number of buffers in the list. Racy... |
153 // The number of buffers in the list. Derived as an approximation from the number |
154 size_t completed_buffers_num() const { return _n_completed_buffers; } |
154 // of entries in the buffers. Racy. |
|
155 size_t num_completed_buffers() const { |
|
156 return (num_entries_in_completed_buffers() + buffer_size() - 1) / buffer_size(); |
|
157 } |
|
158 // The number of entries in completed buffers. Read without synchronization. |
|
159 size_t num_entries_in_completed_buffers() const { return _num_entries_in_completed_buffers; } |
|
160 |
|
161 // Verify that _num_entries_in_completed_buffers is equal to the sum of actual entries |
|
162 // in the completed buffers. |
|
163 void verify_num_entries_in_completed_buffers() const NOT_DEBUG_RETURN; |
155 |
164 |
156 bool process_completed_buffers() { return _process_completed_buffers; } |
165 bool process_completed_buffers() { return _process_completed_buffers; } |
157 void set_process_completed_buffers(bool x) { _process_completed_buffers = x; } |
166 void set_process_completed_buffers(bool x) { _process_completed_buffers = x; } |
158 |
167 |
159 // Get/Set the number of completed buffers that triggers log processing. |
168 // Get/Set the number of completed buffers that triggers log processing. |