< prev index next >

src/share/vm/gc/g1/g1RemSet.cpp

Print this page




 239       return;
 240     }
 241 
 242     bool marked_as_dirty = Atomic::cmpxchg(Dirty, &_in_dirty_region_buffer[region], Clean) == Clean;
 243     if (marked_as_dirty) {
 244       size_t allocated = Atomic::add(1, &_cur_dirty_region) - 1;
 245       _dirty_region_buffer[allocated] = region;
 246     }
 247   }
 248 
 249   HeapWord* scan_top(uint region_idx) const {
 250     return _scan_top[region_idx];
 251   }
 252 
 253   // Clear the card table of "dirty" regions.
 254   void clear_card_table(WorkGang* workers) {
 255     if (_cur_dirty_region == 0) {
 256       return;
 257     }
 258 
 259     size_t const num_chunks = align_size_up(_cur_dirty_region * HeapRegion::CardsPerRegion, G1ClearCardTableTask::chunk_size()) / G1ClearCardTableTask::chunk_size();
 260     uint const num_workers = (uint)MIN2(num_chunks, (size_t)workers->active_workers());
 261     size_t const chunk_length = G1ClearCardTableTask::chunk_size() / HeapRegion::CardsPerRegion;
 262 
 263     // Iterate over the dirty cards region list.
 264     G1ClearCardTableTask cl(G1CollectedHeap::heap(), _dirty_region_buffer, _cur_dirty_region, chunk_length);
 265 
 266     log_debug(gc, ergo)("Running %s using %u workers for " SIZE_FORMAT " "
 267                         "units of work for " SIZE_FORMAT " regions.",
 268                         cl.name(), num_workers, num_chunks, _cur_dirty_region);
 269     workers->run_task(&cl, num_workers);
 270 
 271 #ifndef PRODUCT
 272     // Need to synchronize with concurrent cleanup since it needs to
 273     // finish its card table clearing before we can verify.
 274     G1CollectedHeap::heap()->wait_while_free_regions_coming();
 275     G1CollectedHeap::heap()->verifier()->verify_card_table_cleanup();
 276 #endif
 277   }
 278 };
 279 




 239       return;
 240     }
 241 
 242     bool marked_as_dirty = Atomic::cmpxchg(Dirty, &_in_dirty_region_buffer[region], Clean) == Clean;
 243     if (marked_as_dirty) {
 244       size_t allocated = Atomic::add(1, &_cur_dirty_region) - 1;
 245       _dirty_region_buffer[allocated] = region;
 246     }
 247   }
 248 
 249   HeapWord* scan_top(uint region_idx) const {
 250     return _scan_top[region_idx];
 251   }
 252 
 253   // Clear the card table of "dirty" regions.
 254   void clear_card_table(WorkGang* workers) {
 255     if (_cur_dirty_region == 0) {
 256       return;
 257     }
 258 
 259     size_t const num_chunks = align_up(_cur_dirty_region * HeapRegion::CardsPerRegion, G1ClearCardTableTask::chunk_size()) / G1ClearCardTableTask::chunk_size();
 260     uint const num_workers = (uint)MIN2(num_chunks, (size_t)workers->active_workers());
 261     size_t const chunk_length = G1ClearCardTableTask::chunk_size() / HeapRegion::CardsPerRegion;
 262 
 263     // Iterate over the dirty cards region list.
 264     G1ClearCardTableTask cl(G1CollectedHeap::heap(), _dirty_region_buffer, _cur_dirty_region, chunk_length);
 265 
 266     log_debug(gc, ergo)("Running %s using %u workers for " SIZE_FORMAT " "
 267                         "units of work for " SIZE_FORMAT " regions.",
 268                         cl.name(), num_workers, num_chunks, _cur_dirty_region);
 269     workers->run_task(&cl, num_workers);
 270 
 271 #ifndef PRODUCT
 272     // Need to synchronize with concurrent cleanup since it needs to
 273     // finish its card table clearing before we can verify.
 274     G1CollectedHeap::heap()->wait_while_free_regions_coming();
 275     G1CollectedHeap::heap()->verifier()->verify_card_table_cleanup();
 276 #endif
 277   }
 278 };
 279 


< prev index next >