468 non_clean_card_iterate_parallel_work(sp, mr, cl, ct, n_threads); |
468 non_clean_card_iterate_parallel_work(sp, mr, cl, ct, n_threads); |
469 #else // INCLUDE_ALL_GCS |
469 #else // INCLUDE_ALL_GCS |
470 fatal("Parallel gc not supported here."); |
470 fatal("Parallel gc not supported here."); |
471 #endif // INCLUDE_ALL_GCS |
471 #endif // INCLUDE_ALL_GCS |
472 } else { |
472 } else { |
473 // We do not call the non_clean_card_iterate_serial() version below because |
473 // clear_cl finds contiguous dirty ranges of cards to process and clear. |
474 // we want to clear the cards (which non_clean_card_iterate_serial() does not |
474 |
475 // do for us): clear_cl here does the work of finding contiguous dirty ranges |
475 DirtyCardToOopClosure* dcto_cl = sp->new_dcto_cl(cl, precision(), cl->gen_boundary()); |
476 // of cards to process and clear. |
|
477 |
|
478 DirtyCardToOopClosure* dcto_cl = sp->new_dcto_cl(cl, precision(), |
|
479 cl->gen_boundary()); |
|
480 ClearNoncleanCardWrapper clear_cl(dcto_cl, ct); |
476 ClearNoncleanCardWrapper clear_cl(dcto_cl, ct); |
481 |
477 |
482 clear_cl.do_MemRegion(mr); |
478 clear_cl.do_MemRegion(mr); |
483 } |
|
484 } |
|
485 } |
|
486 |
|
487 // The iterator itself is not MT-aware, but |
|
488 // MT-aware callers and closures can use this to |
|
489 // accomplish dirty card iteration in parallel. The |
|
490 // iterator itself does not clear the dirty cards, or |
|
491 // change their values in any manner. |
|
492 void CardTableModRefBS::non_clean_card_iterate_serial(MemRegion mr, |
|
493 MemRegionClosure* cl) { |
|
494 bool is_par = (SharedHeap::heap()->n_par_threads() > 0); |
|
495 assert(!is_par || |
|
496 (SharedHeap::heap()->n_par_threads() == |
|
497 SharedHeap::heap()->workers()->active_workers()), "Mismatch"); |
|
498 for (int i = 0; i < _cur_covered_regions; i++) { |
|
499 MemRegion mri = mr.intersection(_covered[i]); |
|
500 if (mri.word_size() > 0) { |
|
501 jbyte* cur_entry = byte_for(mri.last()); |
|
502 jbyte* limit = byte_for(mri.start()); |
|
503 while (cur_entry >= limit) { |
|
504 jbyte* next_entry = cur_entry - 1; |
|
505 if (*cur_entry != clean_card) { |
|
506 size_t non_clean_cards = 1; |
|
507 // Should the next card be included in this range of dirty cards. |
|
508 while (next_entry >= limit && *next_entry != clean_card) { |
|
509 non_clean_cards++; |
|
510 cur_entry = next_entry; |
|
511 next_entry--; |
|
512 } |
|
513 // The memory region may not be on a card boundary. So that |
|
514 // objects beyond the end of the region are not processed, make |
|
515 // cur_cards precise with regard to the end of the memory region. |
|
516 MemRegion cur_cards(addr_for(cur_entry), |
|
517 non_clean_cards * card_size_in_words); |
|
518 MemRegion dirty_region = cur_cards.intersection(mri); |
|
519 cl->do_MemRegion(dirty_region); |
|
520 } |
|
521 cur_entry = next_entry; |
|
522 } |
|
523 } |
479 } |
524 } |
480 } |
525 } |
481 } |
526 |
482 |
527 void CardTableModRefBS::dirty_MemRegion(MemRegion mr) { |
483 void CardTableModRefBS::dirty_MemRegion(MemRegion mr) { |