< prev index next >

src/hotspot/share/gc/g1/heapRegionRemSet.hpp

Print this page
rev 52572 : imported patch 8213996-remove-sparseprt-table
rev 52573 : [mq]: 8213996-remove-sparseprt-table-more-cleanup


 100   static size_t _max_fine_entries;
 101   static size_t _mod_max_fine_entries_mask;
 102 
 103   // Requires "prt" to be the first element of the bucket list appropriate
 104   // for "hr".  If this list contains an entry for "hr", return it,
 105   // otherwise return "NULL".
 106   PerRegionTable* find_region_table(size_t ind, HeapRegion* hr) const;
 107 
 108   // Find, delete, and return a candidate PerRegionTable, if any exists,
 109   // adding the deleted region to the coarse bitmap.  Requires the caller
 110   // to hold _m, and the fine-grain table to be full.
 111   PerRegionTable* delete_region_table();
 112 
 113   // link/add the given fine grain remembered set into the "all" list
 114   void link_to_all(PerRegionTable * prt);
 115   // unlink/remove the given fine grain remembered set into the "all" list
 116   void unlink_from_all(PerRegionTable * prt);
 117 
 118   bool contains_reference_locked(OopOrNarrowOopStar from) const;
 119 




 120 public:
 121   // Create a new remembered set. The given mutex is used to ensure consistency.
 122   OtherRegionsTable(Mutex* m);
 123 
 124   // Returns the card index of the given within_region pointer relative to the bottom
 125   // of the given heap region.
 126   static CardIdx_t card_within_region(OopOrNarrowOopStar within_region, HeapRegion* hr);
 127   // Adds the reference from "from to this remembered set.
 128   void add_reference(OopOrNarrowOopStar from, uint tid);
 129 
 130   // Returns whether the remembered set contains the given reference.
 131   bool contains_reference(OopOrNarrowOopStar from) const;
 132 
 133   // Returns whether this remembered set (and all sub-sets) have an occupancy
 134   // that is less or equal than the given occupancy.
 135   bool occupancy_less_or_equal_than(size_t limit) const;
 136 
 137   // Returns whether this remembered set (and all sub-sets) does not contain any entry.
 138   bool is_empty() const;
 139 
 140   // Returns the number of cards contained in this remembered set.
 141   size_t occupied() const;
 142   size_t occ_fine() const;
 143   size_t occ_coarse() const;
 144   size_t occ_sparse() const;
 145 
 146   static jint n_coarsenings() { return _n_coarsenings; }
 147 
 148   // Returns size of the actual remembered set containers in bytes.
 149   size_t mem_size() const;
 150   // Returns the size of static data in bytes.
 151   static size_t static_mem_size();
 152   // Returns the size of the free list content in bytes.
 153   static size_t fl_mem_size();
 154 
 155   // Clear the entire contents of this remembered set.
 156   void clear();
 157 };
 158 
 159 class HeapRegionRemSet : public CHeapObj<mtGC> {
 160   friend class VMStructs;
 161   friend class HeapRegionRemSetIterator;
 162 
 163 private:
 164   G1BlockOffsetTable* _bot;


 181   static void setup_remset_size();
 182 
 183   bool cardset_is_empty() const {
 184     return _other_regions.is_empty();
 185   }
 186 
 187   bool is_empty() const {
 188     return (strong_code_roots_list_length() == 0) && cardset_is_empty();
 189   }
 190 
 191   bool occupancy_less_or_equal_than(size_t occ) const {
 192     return (strong_code_roots_list_length() == 0) && _other_regions.occupancy_less_or_equal_than(occ);
 193   }
 194 
 195   size_t occupied() {
 196     MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag);
 197     return occupied_locked();
 198   }
 199   size_t occupied_locked() {
 200     return _other_regions.occupied();
 201   }
 202   size_t occ_fine() const {
 203     return _other_regions.occ_fine();
 204   }
 205   size_t occ_coarse() const {
 206     return _other_regions.occ_coarse();
 207   }
 208   size_t occ_sparse() const {
 209     return _other_regions.occ_sparse();
 210   }
 211 
 212   static jint n_coarsenings() { return OtherRegionsTable::n_coarsenings(); }
 213 
 214 private:
 215   enum RemSetState {
 216     Untracked,
 217     Updating,
 218     Complete
 219   };
 220 
 221   RemSetState _state;
 222 
 223   static const char* _state_strings[];
 224   static const char* _short_state_strings[];
 225 public:
 226 
 227   const char* get_state_str() const { return _state_strings[_state]; }
 228   const char* get_short_state_str() const { return _short_state_strings[_state]; }
 229 




 100   static size_t _max_fine_entries;
 101   static size_t _mod_max_fine_entries_mask;
 102 
 103   // Requires "prt" to be the first element of the bucket list appropriate
 104   // for "hr".  If this list contains an entry for "hr", return it,
 105   // otherwise return "NULL".
 106   PerRegionTable* find_region_table(size_t ind, HeapRegion* hr) const;
 107 
 108   // Find, delete, and return a candidate PerRegionTable, if any exists,
 109   // adding the deleted region to the coarse bitmap.  Requires the caller
 110   // to hold _m, and the fine-grain table to be full.
 111   PerRegionTable* delete_region_table();
 112 
 113   // link/add the given fine grain remembered set into the "all" list
 114   void link_to_all(PerRegionTable * prt);
 115   // unlink/remove the given fine grain remembered set into the "all" list
 116   void unlink_from_all(PerRegionTable * prt);
 117 
 118   bool contains_reference_locked(OopOrNarrowOopStar from) const;
 119 
 120   size_t occ_fine() const;
 121   size_t occ_coarse() const;
 122   size_t occ_sparse() const;
 123 
 124 public:
 125   // Create a new remembered set. The given mutex is used to ensure consistency.
 126   OtherRegionsTable(Mutex* m);
 127 
 128   // Returns the card index of the given within_region pointer relative to the bottom
 129   // of the given heap region.
 130   static CardIdx_t card_within_region(OopOrNarrowOopStar within_region, HeapRegion* hr);
 131   // Adds the reference from "from to this remembered set.
 132   void add_reference(OopOrNarrowOopStar from, uint tid);
 133 
 134   // Returns whether the remembered set contains the given reference.
 135   bool contains_reference(OopOrNarrowOopStar from) const;
 136 
 137   // Returns whether this remembered set (and all sub-sets) have an occupancy
 138   // that is less or equal than the given occupancy.
 139   bool occupancy_less_or_equal_than(size_t limit) const;
 140 
 141   // Returns whether this remembered set (and all sub-sets) does not contain any entry.
 142   bool is_empty() const;
 143 
 144   // Returns the number of cards contained in this remembered set.
 145   size_t occupied() const;



 146 
 147   static jint n_coarsenings() { return _n_coarsenings; }
 148 
 149   // Returns size of the actual remembered set containers in bytes.
 150   size_t mem_size() const;
 151   // Returns the size of static data in bytes.
 152   static size_t static_mem_size();
 153   // Returns the size of the free list content in bytes.
 154   static size_t fl_mem_size();
 155 
 156   // Clear the entire contents of this remembered set.
 157   void clear();
 158 };
 159 
 160 class HeapRegionRemSet : public CHeapObj<mtGC> {
 161   friend class VMStructs;
 162   friend class HeapRegionRemSetIterator;
 163 
 164 private:
 165   G1BlockOffsetTable* _bot;


 182   static void setup_remset_size();
 183 
 184   bool cardset_is_empty() const {
 185     return _other_regions.is_empty();
 186   }
 187 
 188   bool is_empty() const {
 189     return (strong_code_roots_list_length() == 0) && cardset_is_empty();
 190   }
 191 
 192   bool occupancy_less_or_equal_than(size_t occ) const {
 193     return (strong_code_roots_list_length() == 0) && _other_regions.occupancy_less_or_equal_than(occ);
 194   }
 195 
 196   size_t occupied() {
 197     MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag);
 198     return occupied_locked();
 199   }
 200   size_t occupied_locked() {
 201     return _other_regions.occupied();









 202   }
 203 
 204   static jint n_coarsenings() { return OtherRegionsTable::n_coarsenings(); }
 205 
 206 private:
 207   enum RemSetState {
 208     Untracked,
 209     Updating,
 210     Complete
 211   };
 212 
 213   RemSetState _state;
 214 
 215   static const char* _state_strings[];
 216   static const char* _short_state_strings[];
 217 public:
 218 
 219   const char* get_state_str() const { return _state_strings[_state]; }
 220   const char* get_short_state_str() const { return _short_state_strings[_state]; }
 221 


< prev index next >