src/share/vm/memory/cardTableModRefBS.cpp

changeset 2819
c48ad6ab8bdf
parent 2788
c69b1043dfb1
child 2849
063382f9b575
     1.1 --- a/src/share/vm/memory/cardTableModRefBS.cpp	Tue Apr 19 15:46:59 2011 -0400
     1.2 +++ b/src/share/vm/memory/cardTableModRefBS.cpp	Wed Apr 20 19:19:30 2011 -0700
     1.3 @@ -456,31 +456,35 @@
     1.4  }
     1.5  
     1.6  
     1.7 -void CardTableModRefBS::non_clean_card_iterate(Space* sp,
     1.8 -                                               MemRegion mr,
     1.9 -                                               DirtyCardToOopClosure* dcto_cl,
    1.10 -                                               MemRegionClosure* cl) {
    1.11 +void CardTableModRefBS::non_clean_card_iterate_possibly_parallel(Space* sp,
    1.12 +                                                                 MemRegion mr,
    1.13 +                                                                 DirtyCardToOopClosure* dcto_cl,
    1.14 +                                                                 ClearNoncleanCardWrapper* cl) {
    1.15    if (!mr.is_empty()) {
    1.16      int n_threads = SharedHeap::heap()->n_par_threads();
    1.17      if (n_threads > 0) {
    1.18  #ifndef SERIALGC
    1.19 -      par_non_clean_card_iterate_work(sp, mr, dcto_cl, cl, n_threads);
    1.20 +      non_clean_card_iterate_parallel_work(sp, mr, dcto_cl, cl, n_threads);
    1.21  #else  // SERIALGC
    1.22        fatal("Parallel gc not supported here.");
    1.23  #endif // SERIALGC
    1.24      } else {
    1.25 -      non_clean_card_iterate_work(mr, cl);
    1.26 +      // We do not call the non_clean_card_iterate_serial() version below because
    1.27 +      // we want to clear the cards (which non_clean_card_iterate_serial() does not
    1.28 +      // do for us), and the ClearNoncleanCardWrapper closure itself does the work
    1.29 +      // of finding contiguous dirty ranges of cards to process (and clear).
    1.30 +      cl->do_MemRegion(mr);
    1.31      }
    1.32    }
    1.33  }
    1.34  
    1.35 -// NOTE: For this to work correctly, it is important that
    1.36 -// we look for non-clean cards below (so as to catch those
    1.37 -// marked precleaned), rather than look explicitly for dirty
    1.38 -// cards (and miss those marked precleaned). In that sense,
    1.39 -// the name precleaned is currently somewhat of a misnomer.
    1.40 -void CardTableModRefBS::non_clean_card_iterate_work(MemRegion mr,
    1.41 -                                                    MemRegionClosure* cl) {
    1.42 +// The iterator itself is not MT-aware, but
    1.43 +// MT-aware callers and closures can use this to
    1.44 +// accomplish dirty card iteration in parallel. The
    1.45 +// iterator itself does not clear the dirty cards, or
    1.46 +// change their values in any manner.
    1.47 +void CardTableModRefBS::non_clean_card_iterate_serial(MemRegion mr,
    1.48 +                                                      MemRegionClosure* cl) {
    1.49    for (int i = 0; i < _cur_covered_regions; i++) {
    1.50      MemRegion mri = mr.intersection(_covered[i]);
    1.51      if (mri.word_size() > 0) {
    1.52 @@ -661,7 +665,7 @@
    1.53  
    1.54  void CardTableModRefBS::verify_clean_region(MemRegion mr) {
    1.55    GuaranteeNotModClosure blk(this);
    1.56 -  non_clean_card_iterate_work(mr, &blk);
    1.57 +  non_clean_card_iterate_serial(mr, &blk);
    1.58  }
    1.59  
    1.60  // To verify a MemRegion is entirely dirty this closure is passed to

mercurial