< prev index next >

src/hotspot/share/gc/g1/dirtyCardQueue.cpp

Print this page




 263     return false;
 264   } else {
 265     if (apply_closure_to_buffer(cl, nd, true, worker_i)) {
 266       assert_fully_consumed(nd, buffer_size());
 267       // Done with fully processed buffer.
 268       deallocate_buffer(nd);
 269       Atomic::inc(&_processed_buffers_rs_thread);
 270     } else {
 271       // Return partially processed buffer to the queue.
 272       guarantee(!during_pause, "Should never stop early");
 273       enqueue_complete_buffer(nd);
 274     }
 275     return true;
 276   }
 277 }
 278 
 279 void DirtyCardQueueSet::par_apply_closure_to_all_completed_buffers(CardTableEntryClosure* cl) {
 280   BufferNode* nd = _cur_par_buffer_node;
 281   while (nd != NULL) {
 282     BufferNode* next = nd->next();
 283     void* actual = Atomic::cmpxchg_ptr(next, &_cur_par_buffer_node, nd);
 284     if (actual == nd) {
 285       bool b = apply_closure_to_buffer(cl, nd, false);
 286       guarantee(b, "Should not stop early.");
 287       nd = next;
 288     } else {
 289       nd = static_cast<BufferNode*>(actual);
 290     }
 291   }
 292 }
 293 
 294 // Deallocates any completed log buffers
 295 void DirtyCardQueueSet::clear() {
 296   BufferNode* buffers_to_delete = NULL;
 297   {
 298     MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag);
 299     while (_completed_buffers_head != NULL) {
 300       BufferNode* nd = _completed_buffers_head;
 301       _completed_buffers_head = nd->next();
 302       nd->set_next(buffers_to_delete);
 303       buffers_to_delete = nd;
 304     }
 305     _n_completed_buffers = 0;
 306     _completed_buffers_tail = NULL;
 307     DEBUG_ONLY(assert_completed_buffer_list_len_correct_locked());
 308   }
 309   while (buffers_to_delete != NULL) {




 263     return false;
 264   } else {
 265     if (apply_closure_to_buffer(cl, nd, true, worker_i)) {
 266       assert_fully_consumed(nd, buffer_size());
 267       // Done with fully processed buffer.
 268       deallocate_buffer(nd);
 269       Atomic::inc(&_processed_buffers_rs_thread);
 270     } else {
 271       // Return partially processed buffer to the queue.
 272       guarantee(!during_pause, "Should never stop early");
 273       enqueue_complete_buffer(nd);
 274     }
 275     return true;
 276   }
 277 }
 278 
 279 void DirtyCardQueueSet::par_apply_closure_to_all_completed_buffers(CardTableEntryClosure* cl) {
 280   BufferNode* nd = _cur_par_buffer_node;
 281   while (nd != NULL) {
 282     BufferNode* next = nd->next();
 283     BufferNode* actual = Atomic::cmpxchg(next, &_cur_par_buffer_node, nd);
 284     if (actual == nd) {
 285       bool b = apply_closure_to_buffer(cl, nd, false);
 286       guarantee(b, "Should not stop early.");
 287       nd = next;
 288     } else {
 289       nd = actual;
 290     }
 291   }
 292 }
 293 
 294 // Deallocates any completed log buffers
 295 void DirtyCardQueueSet::clear() {
 296   BufferNode* buffers_to_delete = NULL;
 297   {
 298     MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag);
 299     while (_completed_buffers_head != NULL) {
 300       BufferNode* nd = _completed_buffers_head;
 301       _completed_buffers_head = nd->next();
 302       nd->set_next(buffers_to_delete);
 303       buffers_to_delete = nd;
 304     }
 305     _n_completed_buffers = 0;
 306     _completed_buffers_tail = NULL;
 307     DEBUG_ONLY(assert_completed_buffer_list_len_correct_locked());
 308   }
 309   while (buffers_to_delete != NULL) {


< prev index next >