src/share/vm/memory/cardTableModRefBS.hpp

changeset 2819
c48ad6ab8bdf
parent 2788
c69b1043dfb1
child 2849
063382f9b575
     1.1 --- a/src/share/vm/memory/cardTableModRefBS.hpp	Tue Apr 19 15:46:59 2011 -0400
     1.2 +++ b/src/share/vm/memory/cardTableModRefBS.hpp	Wed Apr 20 19:19:30 2011 -0700
     1.3 @@ -44,6 +44,7 @@
     1.4  class Generation;
     1.5  class OopsInGenClosure;
     1.6  class DirtyCardToOopClosure;
     1.7 +class ClearNoncleanCardWrapper;
     1.8  
     1.9  class CardTableModRefBS: public ModRefBarrierSet {
    1.10    // Some classes get to look at some private stuff.
    1.11 @@ -165,22 +166,28 @@
    1.12  
    1.13    // Iterate over the portion of the card-table which covers the given
    1.14    // region mr in the given space and apply cl to any dirty sub-regions
    1.15 -  // of mr. cl and dcto_cl must either be the same closure or cl must
    1.16 -  // wrap dcto_cl. Both are required - neither may be NULL. Also, dcto_cl
    1.17 -  // may be modified. Note that this function will operate in a parallel
    1.18 -  // mode if worker threads are available.
    1.19 -  void non_clean_card_iterate(Space* sp, MemRegion mr,
    1.20 -                              DirtyCardToOopClosure* dcto_cl,
    1.21 -                              MemRegionClosure* cl);
    1.22 +  // of mr. Dirty cards are _not_ cleared by the iterator method itself,
    1.23 +  // but closures may arrange to do so on their own should they so wish.
    1.24 +  void non_clean_card_iterate_serial(MemRegion mr, MemRegionClosure* cl);
    1.25  
    1.26 -  // Utility function used to implement the other versions below.
    1.27 -  void non_clean_card_iterate_work(MemRegion mr, MemRegionClosure* cl);
    1.28 +  // A variant of the above that will operate in a parallel mode if
    1.29 +  // worker threads are available, and clear the dirty cards as it
    1.30 +  // processes them.
    1.31 +  // ClearNoncleanCardWrapper cl must wrap the DirtyCardToOopClosure dcto_cl,
    1.32 +  // which may itself be modified by the method.
    1.33 +  void non_clean_card_iterate_possibly_parallel(Space* sp, MemRegion mr,
    1.34 +                                                DirtyCardToOopClosure* dcto_cl,
    1.35 +                                                ClearNoncleanCardWrapper* cl);
    1.36  
    1.37 -  void par_non_clean_card_iterate_work(Space* sp, MemRegion mr,
    1.38 -                                       DirtyCardToOopClosure* dcto_cl,
    1.39 -                                       MemRegionClosure* cl,
    1.40 -                                       int n_threads);
    1.41 + private:
    1.42 +  // Work method used to implement non_clean_card_iterate_possibly_parallel()
    1.43 +  // above in the parallel case.
    1.44 +  void non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr,
    1.45 +                                            DirtyCardToOopClosure* dcto_cl,
    1.46 +                                            ClearNoncleanCardWrapper* cl,
    1.47 +                                            int n_threads);
    1.48  
    1.49 + protected:
    1.50    // Dirty the bytes corresponding to "mr" (not all of which must be
    1.51    // covered.)
    1.52    void dirty_MemRegion(MemRegion mr);
    1.53 @@ -237,7 +244,7 @@
    1.54                        MemRegion used,
    1.55                        jint stride, int n_strides,
    1.56                        DirtyCardToOopClosure* dcto_cl,
    1.57 -                      MemRegionClosure* cl,
    1.58 +                      ClearNoncleanCardWrapper* cl,
    1.59                        jbyte** lowest_non_clean,
    1.60                        uintptr_t lowest_non_clean_base_chunk_index,
    1.61                        size_t lowest_non_clean_chunk_size);
    1.62 @@ -409,14 +416,14 @@
    1.63    // marking, where a dirty card may cause scanning, and summarization
    1.64    // marking, of objects that extend onto subsequent cards.)
    1.65    void mod_card_iterate(MemRegionClosure* cl) {
    1.66 -    non_clean_card_iterate_work(_whole_heap, cl);
    1.67 +    non_clean_card_iterate_serial(_whole_heap, cl);
    1.68    }
    1.69  
    1.70    // Like the "mod_cards_iterate" above, except only invokes the closure
    1.71    // for cards within the MemRegion "mr" (which is required to be
    1.72    // card-aligned and sized.)
    1.73    void mod_card_iterate(MemRegion mr, MemRegionClosure* cl) {
    1.74 -    non_clean_card_iterate_work(mr, cl);
    1.75 +    non_clean_card_iterate_serial(mr, cl);
    1.76    }
    1.77  
    1.78    static uintx ct_max_alignment_constraint();
    1.79 @@ -493,4 +500,5 @@
    1.80    void set_CTRS(CardTableRS* rs) { _rs = rs; }
    1.81  };
    1.82  
    1.83 +
    1.84  #endif // SHARE_VM_MEMORY_CARDTABLEMODREFBS_HPP

mercurial