< prev index next >

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

Print this page




 201 
 202 public:
 203   RSHashTableIter(RSHashTable* rsht) :
 204     _tbl_ind(RSHashTable::NullEntry), // So that first increment gets to 0.
 205     _bl_ind(RSHashTable::NullEntry),
 206     _card_ind((SparsePRTEntry::cards_num() - 1)),
 207     _rsht(rsht) {}
 208 
 209   bool has_next(size_t& card_index);
 210 };
 211 
 212 // Concurrent access to a SparsePRT must be serialized by some external mutex.
 213 
 214 class SparsePRTIter;
 215 
 216 class SparsePRT {
 217   friend class SparsePRTIter;
 218 
 219   RSHashTable* _table;
 220 
 221   static const size_t InitialCapacity = 8;


 222 
 223   void expand();
 224 
 225 public:
 226   SparsePRT();
 227   ~SparsePRT();
 228 
 229   size_t occupied() const { return _table->occupied_cards(); }
 230   size_t mem_size() const;
 231 
 232   // Attempts to ensure that the given card_index in the given region is in
 233   // the sparse table.  If successful (because the card was already
 234   // present, or because it was successfully added) returns "true".
 235   // Otherwise, returns "false" to indicate that the addition would
 236   // overflow the entry for the region.  The caller must transfer these
 237   // entries to a larger-capacity representation.
 238   bool add_card(RegionIdx_t region_id, CardIdx_t card_index);
 239 
 240   // Return the pointer to the entry associated with the given region.
 241   SparsePRTEntry* get_entry(RegionIdx_t region_ind);




 201 
 202 public:
 203   RSHashTableIter(RSHashTable* rsht) :
 204     _tbl_ind(RSHashTable::NullEntry), // So that first increment gets to 0.
 205     _bl_ind(RSHashTable::NullEntry),
 206     _card_ind((SparsePRTEntry::cards_num() - 1)),
 207     _rsht(rsht) {}
 208 
 209   bool has_next(size_t& card_index);
 210 };
 211 
 212 // Concurrent access to a SparsePRT must be serialized by some external mutex.
 213 
 214 class SparsePRTIter;
 215 
 216 class SparsePRT {
 217   friend class SparsePRTIter;
 218 
 219   RSHashTable* _table;
 220 
 221   enum SomeAdditionalPrivateConstants {
 222     InitialCapacity = 16
 223   };
 224 
 225   void expand();
 226 
 227 public:
 228   SparsePRT();
 229   ~SparsePRT();
 230 
 231   size_t occupied() const { return _table->occupied_cards(); }
 232   size_t mem_size() const;
 233 
 234   // Attempts to ensure that the given card_index in the given region is in
 235   // the sparse table.  If successful (because the card was already
 236   // present, or because it was successfully added) returns "true".
 237   // Otherwise, returns "false" to indicate that the addition would
 238   // overflow the entry for the region.  The caller must transfer these
 239   // entries to a larger-capacity representation.
 240   bool add_card(RegionIdx_t region_id, CardIdx_t card_index);
 241 
 242   // Return the pointer to the entry associated with the given region.
 243   SparsePRTEntry* get_entry(RegionIdx_t region_ind);


< prev index next >