112 DEBUG_ONLY(_collecting = false;) 113 G1BufferNodeList result(_list.pop_all(), _tail, _entry_count); 114 _tail = NULL; 115 _entry_count = 0; 116 DEBUG_ONLY(_collecting = true;) 117 return result; 118 } 119 120 void G1RedirtyCardsQueueSet::update_tail(BufferNode* node) { 121 // Node is the tail of a (possibly single element) list just prepended to 122 // _list. If, after that prepend, node's follower is NULL, then node is 123 // also the tail of _list, so record it as such. 124 if (node->next() == NULL) { 125 assert(_tail == NULL, "invariant"); 126 _tail = node; 127 } 128 } 129 130 void G1RedirtyCardsQueueSet::enqueue_completed_buffer(BufferNode* node) { 131 assert(_collecting, "precondition"); 132 Atomic::add(buffer_size() - node->index(), &_entry_count); 133 _list.push(*node); 134 update_tail(node); 135 } 136 137 void G1RedirtyCardsQueueSet::merge_bufferlist(LocalQSet* src) { 138 assert(_collecting, "precondition"); 139 const G1BufferNodeList from = src->take_all_completed_buffers(); 140 if (from._head != NULL) { 141 assert(from._tail != NULL, "invariant"); 142 Atomic::add(from._entry_count, &_entry_count); 143 _list.prepend(*from._head, *from._tail); 144 update_tail(from._tail); 145 } 146 } | 112 DEBUG_ONLY(_collecting = false;) 113 G1BufferNodeList result(_list.pop_all(), _tail, _entry_count); 114 _tail = NULL; 115 _entry_count = 0; 116 DEBUG_ONLY(_collecting = true;) 117 return result; 118 } 119 120 void G1RedirtyCardsQueueSet::update_tail(BufferNode* node) { 121 // Node is the tail of a (possibly single element) list just prepended to 122 // _list. If, after that prepend, node's follower is NULL, then node is 123 // also the tail of _list, so record it as such. 124 if (node->next() == NULL) { 125 assert(_tail == NULL, "invariant"); 126 _tail = node; 127 } 128 } 129 130 void G1RedirtyCardsQueueSet::enqueue_completed_buffer(BufferNode* node) { 131 assert(_collecting, "precondition"); 132 Atomic::add(&_entry_count, buffer_size() - node->index()); 133 _list.push(*node); 134 update_tail(node); 135 } 136 137 void G1RedirtyCardsQueueSet::merge_bufferlist(LocalQSet* src) { 138 assert(_collecting, "precondition"); 139 const G1BufferNodeList from = src->take_all_completed_buffers(); 140 if (from._head != NULL) { 141 assert(from._tail != NULL, "invariant"); 142 Atomic::add(&_entry_count, from._entry_count); 143 _list.prepend(*from._head, *from._tail); 144 update_tail(from._tail); 145 } 146 } |