< prev index next >

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

Print this page




 203 
 204   static jint n_coarsenings() { return _n_coarsenings; }
 205 
 206   // Returns size of the actual remembered set containers in bytes.
 207   size_t mem_size() const;
 208   // Returns the size of static data in bytes.
 209   static size_t static_mem_size();
 210   // Returns the size of the free list content in bytes.
 211   static size_t fl_mem_size();
 212 
 213   // Clear the entire contents of this remembered set.
 214   void clear();
 215 
 216   void do_cleanup_work(HRRSCleanupTask* hrrs_cleanup_task);
 217 };
 218 
 219 class HeapRegionRemSet : public CHeapObj<mtGC> {
 220   friend class VMStructs;
 221   friend class HeapRegionRemSetIterator;
 222 
 223 public:
 224   enum Event {
 225     Event_EvacStart, Event_EvacEnd, Event_RSUpdateEnd, Event_illegal
 226   };
 227 
 228 private:
 229   G1BlockOffsetSharedArray* _bosa;
 230 
 231   // A set of code blobs (nmethods) whose code contains pointers into
 232   // the region that owns this RSet.
 233   G1CodeRootSet _code_roots;
 234 
 235   Mutex _m;
 236 
 237   OtherRegionsTable _other_regions;
 238 
 239   enum ParIterState { Unclaimed, Claimed, Complete };
 240   volatile ParIterState _iter_state;
 241   volatile size_t _iter_claimed;
 242 
 243   // Unused unless G1RecordHRRSOops is true.
 244 
 245   static const int MaxRecorded = 1000000;
 246   static OopOrNarrowOopStar* _recorded_oops;
 247   static HeapWord**          _recorded_cards;
 248   static HeapRegion**        _recorded_regions;
 249   static int                 _n_recorded;
 250 
 251   static const int MaxRecordedEvents = 1000;
 252   static Event*       _recorded_events;
 253   static int*         _recorded_event_index;
 254   static int          _n_recorded_events;
 255 
 256   static void print_event(outputStream* str, Event evnt);
 257 
 258 public:
 259   HeapRegionRemSet(G1BlockOffsetSharedArray* bosa, HeapRegion* hr);
 260 
 261   static uint num_par_rem_sets();
 262   static void setup_remset_size();
 263 
 264   bool is_empty() const {
 265     return (strong_code_roots_list_length() == 0) && _other_regions.is_empty();
 266   }
 267 
 268   bool occupancy_less_or_equal_than(size_t occ) const {
 269     return (strong_code_roots_list_length() == 0) && _other_regions.occupancy_less_or_equal_than(occ);
 270   }
 271 
 272   size_t occupied() {
 273     MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag);
 274     return occupied_locked();
 275   }
 276   size_t occupied_locked() {
 277     return _other_regions.occupied();


 386   void print() PRODUCT_RETURN;
 387 
 388   // Called during a stop-world phase to perform any deferred cleanups.
 389   static void cleanup();
 390 
 391   // Declare the heap size (in # of regions) to the HeapRegionRemSet(s).
 392   // (Uses it to initialize from_card_cache).
 393   static void init_heap(uint max_regions) {
 394     FromCardCache::initialize(num_par_rem_sets(), max_regions);
 395   }
 396 
 397   static void invalidate_from_card_cache(uint start_idx, size_t num_regions) {
 398     FromCardCache::invalidate(start_idx, num_regions);
 399   }
 400 
 401 #ifndef PRODUCT
 402   static void print_from_card_cache() {
 403     FromCardCache::print();
 404   }
 405 #endif
 406 
 407   static void record(HeapRegion* hr, OopOrNarrowOopStar f);
 408   static void print_recorded();
 409   static void record_event(Event evnt);
 410 
 411   // These are wrappers for the similarly-named methods on
 412   // SparsePRT. Look at sparsePRT.hpp for more details.
 413   static void reset_for_cleanup_tasks();
 414   void do_cleanup_work(HRRSCleanupTask* hrrs_cleanup_task);
 415   static void finish_cleanup_task(HRRSCleanupTask* hrrs_cleanup_task);
 416 
 417   // Run unit tests.
 418 #ifndef PRODUCT
 419   static void test_prt();
 420   static void test();
 421 #endif
 422 };
 423 
 424 class HeapRegionRemSetIterator : public StackObj {
 425  private:
 426   // The region RSet over which we are iterating.
 427   HeapRegionRemSet* _hrrs;
 428 
 429   // Local caching of HRRS fields.




 203 
 204   static jint n_coarsenings() { return _n_coarsenings; }
 205 
 206   // Returns size of the actual remembered set containers in bytes.
 207   size_t mem_size() const;
 208   // Returns the size of static data in bytes.
 209   static size_t static_mem_size();
 210   // Returns the size of the free list content in bytes.
 211   static size_t fl_mem_size();
 212 
 213   // Clear the entire contents of this remembered set.
 214   void clear();
 215 
 216   void do_cleanup_work(HRRSCleanupTask* hrrs_cleanup_task);
 217 };
 218 
 219 class HeapRegionRemSet : public CHeapObj<mtGC> {
 220   friend class VMStructs;
 221   friend class HeapRegionRemSetIterator;
 222 





 223 private:
 224   G1BlockOffsetSharedArray* _bosa;
 225 
 226   // A set of code blobs (nmethods) whose code contains pointers into
 227   // the region that owns this RSet.
 228   G1CodeRootSet _code_roots;
 229 
 230   Mutex _m;
 231 
 232   OtherRegionsTable _other_regions;
 233 
 234   enum ParIterState { Unclaimed, Claimed, Complete };
 235   volatile ParIterState _iter_state;
 236   volatile size_t _iter_claimed;
 237 















 238 public:
 239   HeapRegionRemSet(G1BlockOffsetSharedArray* bosa, HeapRegion* hr);
 240 
 241   static uint num_par_rem_sets();
 242   static void setup_remset_size();
 243 
 244   bool is_empty() const {
 245     return (strong_code_roots_list_length() == 0) && _other_regions.is_empty();
 246   }
 247 
 248   bool occupancy_less_or_equal_than(size_t occ) const {
 249     return (strong_code_roots_list_length() == 0) && _other_regions.occupancy_less_or_equal_than(occ);
 250   }
 251 
 252   size_t occupied() {
 253     MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag);
 254     return occupied_locked();
 255   }
 256   size_t occupied_locked() {
 257     return _other_regions.occupied();


 366   void print() PRODUCT_RETURN;
 367 
 368   // Called during a stop-world phase to perform any deferred cleanups.
 369   static void cleanup();
 370 
 371   // Declare the heap size (in # of regions) to the HeapRegionRemSet(s).
 372   // (Uses it to initialize from_card_cache).
 373   static void init_heap(uint max_regions) {
 374     FromCardCache::initialize(num_par_rem_sets(), max_regions);
 375   }
 376 
 377   static void invalidate_from_card_cache(uint start_idx, size_t num_regions) {
 378     FromCardCache::invalidate(start_idx, num_regions);
 379   }
 380 
 381 #ifndef PRODUCT
 382   static void print_from_card_cache() {
 383     FromCardCache::print();
 384   }
 385 #endif




 386 
 387   // These are wrappers for the similarly-named methods on
 388   // SparsePRT. Look at sparsePRT.hpp for more details.
 389   static void reset_for_cleanup_tasks();
 390   void do_cleanup_work(HRRSCleanupTask* hrrs_cleanup_task);
 391   static void finish_cleanup_task(HRRSCleanupTask* hrrs_cleanup_task);
 392 
 393   // Run unit tests.
 394 #ifndef PRODUCT
 395   static void test_prt();
 396   static void test();
 397 #endif
 398 };
 399 
 400 class HeapRegionRemSetIterator : public StackObj {
 401  private:
 402   // The region RSet over which we are iterating.
 403   HeapRegionRemSet* _hrrs;
 404 
 405   // Local caching of HRRS fields.


< prev index next >