src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp

Print this page




 228 
 229 public:
 230   enum Event {
 231     Event_EvacStart, Event_EvacEnd, Event_RSUpdateEnd
 232   };
 233 
 234 private:
 235   G1BlockOffsetSharedArray* _bosa;
 236   G1BlockOffsetSharedArray* bosa() const { return _bosa; }
 237 
 238   // A set of code blobs (nmethods) whose code contains pointers into
 239   // the region that owns this RSet.
 240   G1CodeRootSet _code_roots;
 241 
 242   Mutex _m;
 243 
 244   OtherRegionsTable _other_regions;
 245 
 246   enum ParIterState { Unclaimed, Claimed, Complete };
 247   volatile ParIterState _iter_state;
 248   volatile jlong _iter_claimed;
 249 
 250   // Unused unless G1RecordHRRSOops is true.
 251 
 252   static const int MaxRecorded = 1000000;
 253   static OopOrNarrowOopStar* _recorded_oops;
 254   static HeapWord**          _recorded_cards;
 255   static HeapRegion**        _recorded_regions;
 256   static int                 _n_recorded;
 257 
 258   static const int MaxRecordedEvents = 1000;
 259   static Event*       _recorded_events;
 260   static int*         _recorded_event_index;
 261   static int          _n_recorded_events;
 262 
 263   static void print_event(outputStream* str, Event evnt);
 264 
 265 public:
 266   HeapRegionRemSet(G1BlockOffsetSharedArray* bosa, HeapRegion* hr);
 267 
 268   static uint num_par_rem_sets();


 302   }
 303 
 304   // Removes any entries shown by the given bitmaps to contain only dead
 305   // objects.
 306   void scrub(CardTableModRefBS* ctbs, BitMap* region_bm, BitMap* card_bm);
 307 
 308   // The region is being reclaimed; clear its remset, and any mention of
 309   // entries for this region in other remsets.
 310   void clear();
 311   void clear_locked();
 312 
 313   // Attempt to claim the region.  Returns true iff this call caused an
 314   // atomic transition from Unclaimed to Claimed.
 315   bool claim_iter();
 316   // Sets the iteration state to "complete".
 317   void set_iter_complete();
 318   // Returns "true" iff the region's iteration is complete.
 319   bool iter_is_complete();
 320 
 321   // Support for claiming blocks of cards during iteration
 322   size_t iter_claimed() const { return (size_t)_iter_claimed; }
 323   // Claim the next block of cards
 324   size_t iter_claimed_next(size_t step) {
 325     size_t current, next;
 326     do {
 327       current = iter_claimed();
 328       next = current + step;
 329     } while (Atomic::cmpxchg((jlong)next, &_iter_claimed, (jlong)current) != (jlong)current);
 330     return current;
 331   }

 332   void reset_for_par_iteration();
 333 
 334   bool verify_ready_for_par_iteration() {
 335     return (_iter_state == Unclaimed) && (_iter_claimed == 0);
 336   }
 337 
 338   // The actual # of bytes this hr_remset takes up.
 339   // Note also includes the strong code root set.
 340   size_t mem_size() {
 341     MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag);
 342     return _other_regions.mem_size()
 343       // This correction is necessary because the above includes the second
 344       // part.
 345       + (sizeof(this) - sizeof(OtherRegionsTable))
 346       + strong_code_roots_mem_size();
 347   }
 348 
 349   // Returns the memory occupancy of all static data structures associated
 350   // with remembered sets.
 351   static size_t static_mem_size() {




 228 
 229 public:
 230   enum Event {
 231     Event_EvacStart, Event_EvacEnd, Event_RSUpdateEnd
 232   };
 233 
 234 private:
 235   G1BlockOffsetSharedArray* _bosa;
 236   G1BlockOffsetSharedArray* bosa() const { return _bosa; }
 237 
 238   // A set of code blobs (nmethods) whose code contains pointers into
 239   // the region that owns this RSet.
 240   G1CodeRootSet _code_roots;
 241 
 242   Mutex _m;
 243 
 244   OtherRegionsTable _other_regions;
 245 
 246   enum ParIterState { Unclaimed, Claimed, Complete };
 247   volatile ParIterState _iter_state;
 248   volatile size_t _iter_claimed;
 249 
 250   // Unused unless G1RecordHRRSOops is true.
 251 
 252   static const int MaxRecorded = 1000000;
 253   static OopOrNarrowOopStar* _recorded_oops;
 254   static HeapWord**          _recorded_cards;
 255   static HeapRegion**        _recorded_regions;
 256   static int                 _n_recorded;
 257 
 258   static const int MaxRecordedEvents = 1000;
 259   static Event*       _recorded_events;
 260   static int*         _recorded_event_index;
 261   static int          _n_recorded_events;
 262 
 263   static void print_event(outputStream* str, Event evnt);
 264 
 265 public:
 266   HeapRegionRemSet(G1BlockOffsetSharedArray* bosa, HeapRegion* hr);
 267 
 268   static uint num_par_rem_sets();


 302   }
 303 
 304   // Removes any entries shown by the given bitmaps to contain only dead
 305   // objects.
 306   void scrub(CardTableModRefBS* ctbs, BitMap* region_bm, BitMap* card_bm);
 307 
 308   // The region is being reclaimed; clear its remset, and any mention of
 309   // entries for this region in other remsets.
 310   void clear();
 311   void clear_locked();
 312 
 313   // Attempt to claim the region.  Returns true iff this call caused an
 314   // atomic transition from Unclaimed to Claimed.
 315   bool claim_iter();
 316   // Sets the iteration state to "complete".
 317   void set_iter_complete();
 318   // Returns "true" iff the region's iteration is complete.
 319   bool iter_is_complete();
 320 
 321   // Support for claiming blocks of cards during iteration
 322   size_t iter_claimed() const { return _iter_claimed; }
 323   // Claim the next block of cards
 324   size_t iter_claimed_next(size_t step) {
 325         return Atomic::add(step, &_iter_claimed) - step;





 326   }
 327 
 328   void reset_for_par_iteration();
 329 
 330   bool verify_ready_for_par_iteration() {
 331     return (_iter_state == Unclaimed) && (_iter_claimed == 0);
 332   }
 333 
 334   // The actual # of bytes this hr_remset takes up.
 335   // Note also includes the strong code root set.
 336   size_t mem_size() {
 337     MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag);
 338     return _other_regions.mem_size()
 339       // This correction is necessary because the above includes the second
 340       // part.
 341       + (sizeof(this) - sizeof(OtherRegionsTable))
 342       + strong_code_roots_mem_size();
 343   }
 344 
 345   // Returns the memory occupancy of all static data structures associated
 346   // with remembered sets.
 347   static size_t static_mem_size() {