< prev index next >

src/share/vm/gc/shared/cardTableRS.hpp

Print this page




  39   friend class VMStructs;
  40   // Below are private classes used in impl.
  41   friend class VerifyCTSpaceClosure;
  42   friend class ClearNoncleanCardWrapper;
  43 
  44   static jbyte clean_card_val() {
  45     return CardTableModRefBS::clean_card;
  46   }
  47 
  48   static intptr_t clean_card_row() {
  49     return CardTableModRefBS::clean_card_row;
  50   }
  51 
  52   static bool
  53   card_is_dirty_wrt_gen_iter(jbyte cv) {
  54     return CardTableModRefBS::card_is_dirty_wrt_gen_iter(cv);
  55   }
  56 
  57   CardTableModRefBSForCTRS* _ct_bs;
  58 
  59   virtual void younger_refs_in_space_iterate(Space* sp, OopsInGenClosure* cl);
  60 
  61   void verify_space(Space* s, HeapWord* gen_start);
  62 
  63   enum ExtendedCardValue {
  64     youngergen_card   = CardTableModRefBS::CT_MR_BS_last_reserved + 1,
  65     // These are for parallel collection.
  66     // There are three P (parallel) youngergen card values.  In general, this
  67     // needs to be more than the number of generations (including the perm
  68     // gen) that might have younger_refs_do invoked on them separately.  So
  69     // if we add more gens, we have to add more values.
  70     youngergenP1_card  = CardTableModRefBS::CT_MR_BS_last_reserved + 2,
  71     youngergenP2_card  = CardTableModRefBS::CT_MR_BS_last_reserved + 3,
  72     youngergenP3_card  = CardTableModRefBS::CT_MR_BS_last_reserved + 4,
  73     cur_youngergen_and_prev_nonclean_card =
  74       CardTableModRefBS::CT_MR_BS_last_reserved + 5
  75   };
  76 
  77   // An array that contains, for each generation, the card table value last
  78   // used as the current value for a younger_refs_do iteration of that
  79   // portion of the table.  (The perm gen is index 0; other gens are at


  99       v != _cur_youngergen_card_val;
 100   }
 101   // Return a youngergen_card_value that is not currently in use.
 102   jbyte find_unused_youngergenP_card_value();
 103 
 104 public:
 105   CardTableRS(MemRegion whole_heap);
 106   ~CardTableRS();
 107 
 108   // *** GenRemSet functions.
 109   CardTableRS* as_CardTableRS() { return this; }
 110 
 111   CardTableModRefBS* ct_bs() { return _ct_bs; }
 112 
 113   // Override.
 114   void prepare_for_younger_refs_iterate(bool parallel);
 115 
 116   // Card table entries are cleared before application; "blk" is
 117   // responsible for dirtying if the oop is still older-to-younger after
 118   // closure application.
 119   void younger_refs_iterate(Generation* g, OopsInGenClosure* blk);
 120 
 121   void inline_write_ref_field_gc(void* field, oop new_val) {
 122     jbyte* byte = _ct_bs->byte_for(field);
 123     *byte = youngergen_card;
 124   }
 125   void write_ref_field_gc_work(void* field, oop new_val) {
 126     inline_write_ref_field_gc(field, new_val);
 127   }
 128 
 129   // Override.  Might want to devirtualize this in the same fashion as
 130   // above.  Ensures that the value of the card for field says that it's
 131   // a younger card in the current collection.
 132   virtual void write_ref_field_gc_par(void* field, oop new_val);
 133 
 134   void resize_covered_region(MemRegion new_region);
 135 
 136   bool is_aligned(HeapWord* addr) {
 137     return _ct_bs->is_card_aligned(addr);
 138   }
 139 


 166     return cv == CardTableRS::cur_youngergen_and_prev_nonclean_card;
 167   }
 168 
 169 };
 170 
 171 class ClearNoncleanCardWrapper: public MemRegionClosure {
 172   DirtyCardToOopClosure* _dirty_card_closure;
 173   CardTableRS* _ct;
 174   bool _is_par;
 175 private:
 176   // Clears the given card, return true if the corresponding card should be
 177   // processed.
 178   inline bool clear_card(jbyte* entry);
 179   // Work methods called by the clear_card()
 180   inline bool clear_card_serial(jbyte* entry);
 181   inline bool clear_card_parallel(jbyte* entry);
 182   // check alignment of pointer
 183   bool is_word_aligned(jbyte* entry);
 184 
 185 public:
 186   ClearNoncleanCardWrapper(DirtyCardToOopClosure* dirty_card_closure, CardTableRS* ct);
 187   void do_MemRegion(MemRegion mr);
 188 };
 189 
 190 #endif // SHARE_VM_GC_SHARED_CARDTABLERS_HPP


  39   friend class VMStructs;
  40   // Below are private classes used in impl.
  41   friend class VerifyCTSpaceClosure;
  42   friend class ClearNoncleanCardWrapper;
  43 
  44   static jbyte clean_card_val() {
  45     return CardTableModRefBS::clean_card;
  46   }
  47 
  48   static intptr_t clean_card_row() {
  49     return CardTableModRefBS::clean_card_row;
  50   }
  51 
  52   static bool
  53   card_is_dirty_wrt_gen_iter(jbyte cv) {
  54     return CardTableModRefBS::card_is_dirty_wrt_gen_iter(cv);
  55   }
  56 
  57   CardTableModRefBSForCTRS* _ct_bs;
  58 
  59   virtual void younger_refs_in_space_iterate(Space* sp, OopsInGenClosure* cl, uint n_threads);
  60 
  61   void verify_space(Space* s, HeapWord* gen_start);
  62 
  63   enum ExtendedCardValue {
  64     youngergen_card   = CardTableModRefBS::CT_MR_BS_last_reserved + 1,
  65     // These are for parallel collection.
  66     // There are three P (parallel) youngergen card values.  In general, this
  67     // needs to be more than the number of generations (including the perm
  68     // gen) that might have younger_refs_do invoked on them separately.  So
  69     // if we add more gens, we have to add more values.
  70     youngergenP1_card  = CardTableModRefBS::CT_MR_BS_last_reserved + 2,
  71     youngergenP2_card  = CardTableModRefBS::CT_MR_BS_last_reserved + 3,
  72     youngergenP3_card  = CardTableModRefBS::CT_MR_BS_last_reserved + 4,
  73     cur_youngergen_and_prev_nonclean_card =
  74       CardTableModRefBS::CT_MR_BS_last_reserved + 5
  75   };
  76 
  77   // An array that contains, for each generation, the card table value last
  78   // used as the current value for a younger_refs_do iteration of that
  79   // portion of the table.  (The perm gen is index 0; other gens are at


  99       v != _cur_youngergen_card_val;
 100   }
 101   // Return a youngergen_card_value that is not currently in use.
 102   jbyte find_unused_youngergenP_card_value();
 103 
 104 public:
 105   CardTableRS(MemRegion whole_heap);
 106   ~CardTableRS();
 107 
 108   // *** GenRemSet functions.
 109   CardTableRS* as_CardTableRS() { return this; }
 110 
 111   CardTableModRefBS* ct_bs() { return _ct_bs; }
 112 
 113   // Override.
 114   void prepare_for_younger_refs_iterate(bool parallel);
 115 
 116   // Card table entries are cleared before application; "blk" is
 117   // responsible for dirtying if the oop is still older-to-younger after
 118   // closure application.
 119   void younger_refs_iterate(Generation* g, OopsInGenClosure* blk, uint n_threads);
 120 
 121   void inline_write_ref_field_gc(void* field, oop new_val) {
 122     jbyte* byte = _ct_bs->byte_for(field);
 123     *byte = youngergen_card;
 124   }
 125   void write_ref_field_gc_work(void* field, oop new_val) {
 126     inline_write_ref_field_gc(field, new_val);
 127   }
 128 
 129   // Override.  Might want to devirtualize this in the same fashion as
 130   // above.  Ensures that the value of the card for field says that it's
 131   // a younger card in the current collection.
 132   virtual void write_ref_field_gc_par(void* field, oop new_val);
 133 
 134   void resize_covered_region(MemRegion new_region);
 135 
 136   bool is_aligned(HeapWord* addr) {
 137     return _ct_bs->is_card_aligned(addr);
 138   }
 139 


 166     return cv == CardTableRS::cur_youngergen_and_prev_nonclean_card;
 167   }
 168 
 169 };
 170 
 171 class ClearNoncleanCardWrapper: public MemRegionClosure {
 172   DirtyCardToOopClosure* _dirty_card_closure;
 173   CardTableRS* _ct;
 174   bool _is_par;
 175 private:
 176   // Clears the given card, return true if the corresponding card should be
 177   // processed.
 178   inline bool clear_card(jbyte* entry);
 179   // Work methods called by the clear_card()
 180   inline bool clear_card_serial(jbyte* entry);
 181   inline bool clear_card_parallel(jbyte* entry);
 182   // check alignment of pointer
 183   bool is_word_aligned(jbyte* entry);
 184 
 185 public:
 186   ClearNoncleanCardWrapper(DirtyCardToOopClosure* dirty_card_closure, CardTableRS* ct, bool is_par);
 187   void do_MemRegion(MemRegion mr);
 188 };
 189 
 190 #endif // SHARE_VM_GC_SHARED_CARDTABLERS_HPP
< prev index next >