< prev index next >

src/share/vm/gc/g1/heapRegion.cpp

Print this page




 150   guarantee(GrainWords == 0, "we should only set it once");
 151   GrainWords = GrainBytes >> LogHeapWordSize;
 152   guarantee((size_t) 1 << LogOfHRGrainWords == GrainWords, "sanity");
 153 
 154   guarantee(CardsPerRegion == 0, "we should only set it once");
 155   CardsPerRegion = GrainBytes >> CardTableModRefBS::card_shift;
 156 
 157   if (G1HeapRegionSize != GrainBytes) {
 158     FLAG_SET_ERGO(size_t, G1HeapRegionSize, GrainBytes);
 159   }
 160 }
 161 
 162 void HeapRegion::reset_after_compaction() {
 163   G1ContiguousSpace::reset_after_compaction();
 164   // After a compaction the mark bitmap is invalid, so we must
 165   // treat all objects as being inside the unmarked area.
 166   zero_marked_bytes();
 167   init_top_at_mark_start();
 168 }
 169 
 170 void HeapRegion::hr_clear(bool par, bool clear_space, bool locked) {
 171   assert(_humongous_start_region == NULL,
 172          "we should have already filtered out humongous regions");
 173   assert(!in_collection_set(),
 174          "Should not clear heap region %u in the collection set", hrm_index());
 175 
 176   set_allocation_context(AllocationContext::system());
 177   set_young_index_in_cset(-1);
 178   uninstall_surv_rate_group();
 179   set_free();
 180   reset_pre_dummy_top();
 181 
 182   if (!par) {
 183     // If this is parallel, this will be done later.
 184     HeapRegionRemSet* hrrs = rem_set();
 185     if (locked) {
 186       hrrs->clear_locked();
 187     } else {
 188       hrrs->clear();
 189     }
 190   }

 191   zero_marked_bytes();
 192 
 193   init_top_at_mark_start();
 194   _gc_time_stamp = G1CollectedHeap::heap()->get_gc_time_stamp();
 195   if (clear_space) clear(SpaceDecorator::Mangle);
 196 }
 197 
 198 void HeapRegion::par_clear() {
 199   assert(used() == 0, "the region should have been already cleared");
 200   assert(capacity() == HeapRegion::GrainBytes, "should be back to normal");
 201   HeapRegionRemSet* hrrs = rem_set();
 202   hrrs->clear();
 203   CardTableModRefBS* ct_bs =
 204     barrier_set_cast<CardTableModRefBS>(G1CollectedHeap::heap()->barrier_set());
 205   ct_bs->clear(MemRegion(bottom(), end()));
 206 }
 207 
 208 void HeapRegion::calc_gc_efficiency() {
 209   // GC efficiency is the ratio of how much space would be
 210   // reclaimed over how long we predict it would take to reclaim it.




 150   guarantee(GrainWords == 0, "we should only set it once");
 151   GrainWords = GrainBytes >> LogHeapWordSize;
 152   guarantee((size_t) 1 << LogOfHRGrainWords == GrainWords, "sanity");
 153 
 154   guarantee(CardsPerRegion == 0, "we should only set it once");
 155   CardsPerRegion = GrainBytes >> CardTableModRefBS::card_shift;
 156 
 157   if (G1HeapRegionSize != GrainBytes) {
 158     FLAG_SET_ERGO(size_t, G1HeapRegionSize, GrainBytes);
 159   }
 160 }
 161 
 162 void HeapRegion::reset_after_compaction() {
 163   G1ContiguousSpace::reset_after_compaction();
 164   // After a compaction the mark bitmap is invalid, so we must
 165   // treat all objects as being inside the unmarked area.
 166   zero_marked_bytes();
 167   init_top_at_mark_start();
 168 }
 169 
 170 void HeapRegion::hr_clear(bool keep_remset, bool clear_space, bool locked) {
 171   assert(_humongous_start_region == NULL,
 172          "we should have already filtered out humongous regions");
 173   assert(!in_collection_set(),
 174          "Should not clear heap region %u in the collection set", hrm_index());
 175 
 176   set_allocation_context(AllocationContext::system());
 177   set_young_index_in_cset(-1);
 178   uninstall_surv_rate_group();
 179   set_free();
 180   reset_pre_dummy_top();
 181 
 182   if (!keep_remset) {


 183     if (locked) {
 184       rem_set()->clear_locked();
 185     } else {
 186       rem_set()->clear();  
 187     }
 188   }
 189 
 190   zero_marked_bytes();
 191 
 192   init_top_at_mark_start();
 193   _gc_time_stamp = G1CollectedHeap::heap()->get_gc_time_stamp();
 194   if (clear_space) clear(SpaceDecorator::Mangle);
 195 }
 196 
 197 void HeapRegion::par_clear() {
 198   assert(used() == 0, "the region should have been already cleared");
 199   assert(capacity() == HeapRegion::GrainBytes, "should be back to normal");
 200   HeapRegionRemSet* hrrs = rem_set();
 201   hrrs->clear();
 202   CardTableModRefBS* ct_bs =
 203     barrier_set_cast<CardTableModRefBS>(G1CollectedHeap::heap()->barrier_set());
 204   ct_bs->clear(MemRegion(bottom(), end()));
 205 }
 206 
 207 void HeapRegion::calc_gc_efficiency() {
 208   // GC efficiency is the ratio of how much space would be
 209   // reclaimed over how long we predict it would take to reclaim it.


< prev index next >