< prev index next >

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

Print this page




 100 
 101   guarantee(GrainWords == 0, "we should only set it once");
 102   GrainWords = GrainBytes >> LogHeapWordSize;
 103   guarantee((size_t) 1 << LogOfHRGrainWords == GrainWords, "sanity");
 104 
 105   guarantee(CardsPerRegion == 0, "we should only set it once");
 106   CardsPerRegion = GrainBytes >> G1CardTable::card_shift;
 107 
 108   if (G1HeapRegionSize != GrainBytes) {
 109     FLAG_SET_ERGO(size_t, G1HeapRegionSize, GrainBytes);
 110   }
 111 }
 112 
 113 void HeapRegion::hr_clear(bool keep_remset, bool clear_space, bool locked) {
 114   assert(_humongous_start_region == NULL,
 115          "we should have already filtered out humongous regions");
 116   assert(!in_collection_set(),
 117          "Should not clear heap region %u in the collection set", hrm_index());
 118 
 119   set_young_index_in_cset(-1);
 120   clear_index_in_opt_cset();
 121   uninstall_surv_rate_group();
 122   set_free();
 123   reset_pre_dummy_top();
 124 
 125   if (!keep_remset) {
 126     if (locked) {
 127       rem_set()->clear_locked();
 128     } else {
 129       rem_set()->clear();
 130     }
 131   }
 132 
 133   zero_marked_bytes();
 134 
 135   init_top_at_mark_start();
 136   if (clear_space) clear(SpaceDecorator::Mangle);
 137 }
 138 
 139 void HeapRegion::clear_cardtable() {
 140   G1CardTable* ct = G1CollectedHeap::heap()->card_table();


 225   assert(capacity() == HeapRegion::GrainBytes, "pre-condition");
 226   _humongous_start_region = NULL;
 227 
 228   _bot_part.set_object_can_span(false);
 229 }
 230 
 231 HeapRegion::HeapRegion(uint hrm_index,
 232                        G1BlockOffsetTable* bot,
 233                        MemRegion mr) :
 234     G1ContiguousSpace(bot),
 235     _rem_set(NULL),
 236     _hrm_index(hrm_index),
 237     _type(),
 238     _humongous_start_region(NULL),
 239     _evacuation_failed(false),
 240     _next(NULL), _prev(NULL),
 241 #ifdef ASSERT
 242     _containing_set(NULL),
 243 #endif
 244     _prev_marked_bytes(0), _next_marked_bytes(0), _gc_efficiency(0.0),
 245     _index_in_opt_cset(InvalidCSetIndex), _young_index_in_cset(-1),
 246     _surv_rate_group(NULL), _age_index(-1),
 247     _prev_top_at_mark_start(NULL), _next_top_at_mark_start(NULL),
 248     _recorded_rs_length(0), _predicted_elapsed_time_ms(0)
 249 {
 250   _rem_set = new HeapRegionRemSet(bot, this);
 251 
 252   initialize(mr);
 253 }
 254 
 255 void HeapRegion::initialize(MemRegion mr, bool clear_space, bool mangle_space) {
 256   assert(_rem_set->is_empty(), "Remembered set must be empty");
 257 
 258   G1ContiguousSpace::initialize(mr, clear_space, mangle_space);
 259 
 260   hr_clear(false /*par*/, false /*clear_space*/);
 261   set_top(bottom());
 262 }
 263 
 264 void HeapRegion::report_region_type_change(G1HeapRegionTraceType::Type to) {
 265   HeapRegionTracer::send_region_type_change(_hrm_index,




 100 
 101   guarantee(GrainWords == 0, "we should only set it once");
 102   GrainWords = GrainBytes >> LogHeapWordSize;
 103   guarantee((size_t) 1 << LogOfHRGrainWords == GrainWords, "sanity");
 104 
 105   guarantee(CardsPerRegion == 0, "we should only set it once");
 106   CardsPerRegion = GrainBytes >> G1CardTable::card_shift;
 107 
 108   if (G1HeapRegionSize != GrainBytes) {
 109     FLAG_SET_ERGO(size_t, G1HeapRegionSize, GrainBytes);
 110   }
 111 }
 112 
 113 void HeapRegion::hr_clear(bool keep_remset, bool clear_space, bool locked) {
 114   assert(_humongous_start_region == NULL,
 115          "we should have already filtered out humongous regions");
 116   assert(!in_collection_set(),
 117          "Should not clear heap region %u in the collection set", hrm_index());
 118 
 119   set_young_index_in_cset(-1);

 120   uninstall_surv_rate_group();
 121   set_free();
 122   reset_pre_dummy_top();
 123 
 124   if (!keep_remset) {
 125     if (locked) {
 126       rem_set()->clear_locked();
 127     } else {
 128       rem_set()->clear();
 129     }
 130   }
 131 
 132   zero_marked_bytes();
 133 
 134   init_top_at_mark_start();
 135   if (clear_space) clear(SpaceDecorator::Mangle);
 136 }
 137 
 138 void HeapRegion::clear_cardtable() {
 139   G1CardTable* ct = G1CollectedHeap::heap()->card_table();


 224   assert(capacity() == HeapRegion::GrainBytes, "pre-condition");
 225   _humongous_start_region = NULL;
 226 
 227   _bot_part.set_object_can_span(false);
 228 }
 229 
 230 HeapRegion::HeapRegion(uint hrm_index,
 231                        G1BlockOffsetTable* bot,
 232                        MemRegion mr) :
 233     G1ContiguousSpace(bot),
 234     _rem_set(NULL),
 235     _hrm_index(hrm_index),
 236     _type(),
 237     _humongous_start_region(NULL),
 238     _evacuation_failed(false),
 239     _next(NULL), _prev(NULL),
 240 #ifdef ASSERT
 241     _containing_set(NULL),
 242 #endif
 243     _prev_marked_bytes(0), _next_marked_bytes(0), _gc_efficiency(0.0),
 244     _index_in_opt_cset(G1OptionalCSet::InvalidCSetIndex), _young_index_in_cset(-1),
 245     _surv_rate_group(NULL), _age_index(-1),
 246     _prev_top_at_mark_start(NULL), _next_top_at_mark_start(NULL),
 247     _recorded_rs_length(0), _predicted_elapsed_time_ms(0)
 248 {
 249   _rem_set = new HeapRegionRemSet(bot, this);
 250 
 251   initialize(mr);
 252 }
 253 
 254 void HeapRegion::initialize(MemRegion mr, bool clear_space, bool mangle_space) {
 255   assert(_rem_set->is_empty(), "Remembered set must be empty");
 256 
 257   G1ContiguousSpace::initialize(mr, clear_space, mangle_space);
 258 
 259   hr_clear(false /*par*/, false /*clear_space*/);
 260   set_top(bottom());
 261 }
 262 
 263 void HeapRegion::report_region_type_change(G1HeapRegionTraceType::Type to) {
 264   HeapRegionTracer::send_region_type_change(_hrm_index,


< prev index next >