< prev index next >

src/hotspot/share/gc/g1/heapRegionManager.cpp

Print this page
rev 51649 : version 1
rev 52017 : All changes for G1 GC moved from 'combined' repo folder


 496     // this method may be called, we have only completed allocation of the regions,
 497     // but not put into a region set.
 498     prev_committed = true;
 499     prev_end = hr->end();
 500   }
 501   for (uint i = _allocated_heapregions_length; i < max_length(); i++) {
 502     guarantee(_regions.get_by_index(i) == NULL, "invariant i: %u", i);
 503   }
 504 
 505   guarantee(num_committed == _num_committed, "Found %u committed regions, but should be %u", num_committed, _num_committed);
 506   _free_list.verify();
 507 }
 508 
 509 #ifndef PRODUCT
 510 void HeapRegionManager::verify_optional() {
 511   verify();
 512 }
 513 #endif // PRODUCT
 514 
 515 HeapRegionClaimer::HeapRegionClaimer(uint n_workers) :
 516     _n_workers(n_workers), _n_regions(G1CollectedHeap::heap()->_hrm._allocated_heapregions_length), _claims(NULL) {
 517   assert(n_workers > 0, "Need at least one worker.");
 518   uint* new_claims = NEW_C_HEAP_ARRAY(uint, _n_regions, mtGC);
 519   memset(new_claims, Unclaimed, sizeof(*_claims) * _n_regions);
 520   _claims = new_claims;
 521 }
 522 
 523 HeapRegionClaimer::~HeapRegionClaimer() {
 524   if (_claims != NULL) {
 525     FREE_C_HEAP_ARRAY(uint, _claims);
 526   }
 527 }
 528 
 529 uint HeapRegionClaimer::offset_for_worker(uint worker_id) const {
 530   assert(worker_id < _n_workers, "Invalid worker_id.");
 531   return _n_regions * worker_id / _n_workers;
 532 }
 533 
 534 bool HeapRegionClaimer::is_region_claimed(uint region_index) const {
 535   assert(region_index < _n_regions, "Invalid index.");
 536   return _claims[region_index] == Claimed;


 496     // this method may be called, we have only completed allocation of the regions,
 497     // but not put into a region set.
 498     prev_committed = true;
 499     prev_end = hr->end();
 500   }
 501   for (uint i = _allocated_heapregions_length; i < max_length(); i++) {
 502     guarantee(_regions.get_by_index(i) == NULL, "invariant i: %u", i);
 503   }
 504 
 505   guarantee(num_committed == _num_committed, "Found %u committed regions, but should be %u", num_committed, _num_committed);
 506   _free_list.verify();
 507 }
 508 
 509 #ifndef PRODUCT
 510 void HeapRegionManager::verify_optional() {
 511   verify();
 512 }
 513 #endif // PRODUCT
 514 
 515 HeapRegionClaimer::HeapRegionClaimer(uint n_workers) :
 516     _n_workers(n_workers), _n_regions(G1CollectedHeap::heap()->_hrm->_allocated_heapregions_length), _claims(NULL) {
 517   assert(n_workers > 0, "Need at least one worker.");
 518   uint* new_claims = NEW_C_HEAP_ARRAY(uint, _n_regions, mtGC);
 519   memset(new_claims, Unclaimed, sizeof(*_claims) * _n_regions);
 520   _claims = new_claims;
 521 }
 522 
 523 HeapRegionClaimer::~HeapRegionClaimer() {
 524   if (_claims != NULL) {
 525     FREE_C_HEAP_ARRAY(uint, _claims);
 526   }
 527 }
 528 
 529 uint HeapRegionClaimer::offset_for_worker(uint worker_id) const {
 530   assert(worker_id < _n_workers, "Invalid worker_id.");
 531   return _n_regions * worker_id / _n_workers;
 532 }
 533 
 534 bool HeapRegionClaimer::is_region_claimed(uint region_index) const {
 535   assert(region_index < _n_regions, "Invalid index.");
 536   return _claims[region_index] == Claimed;
< prev index next >