Mercurial > hg > truffle
comparison src/share/vm/memory/cardTableModRefBS.cpp @ 3297:6431be02f3ac
Merge
author | trims |
---|---|
date | Fri, 29 Apr 2011 16:55:43 -0700 |
parents | c48ad6ab8bdf |
children | 063382f9b575 |
comparison
equal
deleted
inserted
replaced
3265:d7cc76ea8d06 | 3297:6431be02f3ac |
---|---|
454 } | 454 } |
455 return true; | 455 return true; |
456 } | 456 } |
457 | 457 |
458 | 458 |
459 void CardTableModRefBS::non_clean_card_iterate(Space* sp, | 459 void CardTableModRefBS::non_clean_card_iterate_possibly_parallel(Space* sp, |
460 MemRegion mr, | 460 MemRegion mr, |
461 DirtyCardToOopClosure* dcto_cl, | 461 DirtyCardToOopClosure* dcto_cl, |
462 MemRegionClosure* cl) { | 462 ClearNoncleanCardWrapper* cl) { |
463 if (!mr.is_empty()) { | 463 if (!mr.is_empty()) { |
464 int n_threads = SharedHeap::heap()->n_par_threads(); | 464 int n_threads = SharedHeap::heap()->n_par_threads(); |
465 if (n_threads > 0) { | 465 if (n_threads > 0) { |
466 #ifndef SERIALGC | 466 #ifndef SERIALGC |
467 par_non_clean_card_iterate_work(sp, mr, dcto_cl, cl, n_threads); | 467 non_clean_card_iterate_parallel_work(sp, mr, dcto_cl, cl, n_threads); |
468 #else // SERIALGC | 468 #else // SERIALGC |
469 fatal("Parallel gc not supported here."); | 469 fatal("Parallel gc not supported here."); |
470 #endif // SERIALGC | 470 #endif // SERIALGC |
471 } else { | 471 } else { |
472 non_clean_card_iterate_work(mr, cl); | 472 // We do not call the non_clean_card_iterate_serial() version below because |
473 } | 473 // we want to clear the cards (which non_clean_card_iterate_serial() does not |
474 } | 474 // do for us), and the ClearNoncleanCardWrapper closure itself does the work |
475 } | 475 // of finding contiguous dirty ranges of cards to process (and clear). |
476 | 476 cl->do_MemRegion(mr); |
477 // NOTE: For this to work correctly, it is important that | 477 } |
478 // we look for non-clean cards below (so as to catch those | 478 } |
479 // marked precleaned), rather than look explicitly for dirty | 479 } |
480 // cards (and miss those marked precleaned). In that sense, | 480 |
481 // the name precleaned is currently somewhat of a misnomer. | 481 // The iterator itself is not MT-aware, but |
482 void CardTableModRefBS::non_clean_card_iterate_work(MemRegion mr, | 482 // MT-aware callers and closures can use this to |
483 MemRegionClosure* cl) { | 483 // accomplish dirty card iteration in parallel. The |
484 // iterator itself does not clear the dirty cards, or | |
485 // change their values in any manner. | |
486 void CardTableModRefBS::non_clean_card_iterate_serial(MemRegion mr, | |
487 MemRegionClosure* cl) { | |
484 for (int i = 0; i < _cur_covered_regions; i++) { | 488 for (int i = 0; i < _cur_covered_regions; i++) { |
485 MemRegion mri = mr.intersection(_covered[i]); | 489 MemRegion mri = mr.intersection(_covered[i]); |
486 if (mri.word_size() > 0) { | 490 if (mri.word_size() > 0) { |
487 jbyte* cur_entry = byte_for(mri.last()); | 491 jbyte* cur_entry = byte_for(mri.last()); |
488 jbyte* limit = byte_for(mri.start()); | 492 jbyte* limit = byte_for(mri.start()); |
659 } | 663 } |
660 }; | 664 }; |
661 | 665 |
662 void CardTableModRefBS::verify_clean_region(MemRegion mr) { | 666 void CardTableModRefBS::verify_clean_region(MemRegion mr) { |
663 GuaranteeNotModClosure blk(this); | 667 GuaranteeNotModClosure blk(this); |
664 non_clean_card_iterate_work(mr, &blk); | 668 non_clean_card_iterate_serial(mr, &blk); |
665 } | 669 } |
666 | 670 |
667 // To verify a MemRegion is entirely dirty this closure is passed to | 671 // To verify a MemRegion is entirely dirty this closure is passed to |
668 // dirty_card_iterate. If the region is dirty do_MemRegion will be | 672 // dirty_card_iterate. If the region is dirty do_MemRegion will be |
669 // invoked only once with a MemRegion equal to the one being | 673 // invoked only once with a MemRegion equal to the one being |