< prev index next >

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

Print this page




2131 }
2132 
2133 void G1CollectedHeap::reset_gc_time_stamps(HeapRegion* hr) {
2134   hr->reset_gc_time_stamp();
2135 }
2136 
2137 #ifndef PRODUCT
2138 
2139 class CheckGCTimeStampsHRClosure : public HeapRegionClosure {
2140 private:
2141   unsigned _gc_time_stamp;
2142   bool _failures;
2143 
2144 public:
2145   CheckGCTimeStampsHRClosure(unsigned gc_time_stamp) :
2146     _gc_time_stamp(gc_time_stamp), _failures(false) { }
2147 
2148   virtual bool doHeapRegion(HeapRegion* hr) {
2149     unsigned region_gc_time_stamp = hr->get_gc_time_stamp();
2150     if (_gc_time_stamp != region_gc_time_stamp) {
2151       log_info(gc, verify)("Region " HR_FORMAT " has GC time stamp = %d, expected %d", HR_FORMAT_PARAMS(hr),
2152                            region_gc_time_stamp, _gc_time_stamp);
2153       _failures = true;
2154     }
2155     return false;
2156   }
2157 
2158   bool failures() { return _failures; }
2159 };
2160 
2161 void G1CollectedHeap::check_gc_time_stamps() {
2162   CheckGCTimeStampsHRClosure cl(_gc_time_stamp);
2163   heap_region_iterate(&cl);
2164   guarantee(!cl.failures(), "all GC time stamps should have been reset");
2165 }
2166 #endif // PRODUCT
2167 
2168 void G1CollectedHeap::iterate_hcc_closure(CardTableEntryClosure* cl, uint worker_i) {
2169   _cg1r->hot_card_cache()->drain(cl, worker_i);
2170 }
2171 


5169   }
5170 
5171   log_develop_trace(gc, freelist)("G1ConcRegionFreeing [other] : done waiting for free regions");
5172 }
5173 
5174 bool G1CollectedHeap::is_old_gc_alloc_region(HeapRegion* hr) {
5175   return _allocator->is_retained_old_region(hr);
5176 }
5177 
5178 void G1CollectedHeap::set_region_short_lived_locked(HeapRegion* hr) {
5179   _young_list->push_region(hr);
5180 }
5181 
5182 class NoYoungRegionsClosure: public HeapRegionClosure {
5183 private:
5184   bool _success;
5185 public:
5186   NoYoungRegionsClosure() : _success(true) { }
5187   bool doHeapRegion(HeapRegion* r) {
5188     if (r->is_young()) {
5189       log_info(gc, verify)("Region [" PTR_FORMAT ", " PTR_FORMAT ") tagged as young",
5190                            p2i(r->bottom()), p2i(r->end()));
5191       _success = false;
5192     }
5193     return false;
5194   }
5195   bool success() { return _success; }
5196 };
5197 
5198 bool G1CollectedHeap::check_young_list_empty(bool check_heap, bool check_sample) {
5199   bool ret = _young_list->check_list_empty(check_sample);
5200 
5201   if (check_heap) {
5202     NoYoungRegionsClosure closure;
5203     heap_region_iterate(&closure);
5204     ret = ret && closure.success();
5205   }
5206 
5207   return ret;
5208 }
5209 




2131 }
2132 
2133 void G1CollectedHeap::reset_gc_time_stamps(HeapRegion* hr) {
2134   hr->reset_gc_time_stamp();
2135 }
2136 
2137 #ifndef PRODUCT
2138 
2139 class CheckGCTimeStampsHRClosure : public HeapRegionClosure {
2140 private:
2141   unsigned _gc_time_stamp;
2142   bool _failures;
2143 
2144 public:
2145   CheckGCTimeStampsHRClosure(unsigned gc_time_stamp) :
2146     _gc_time_stamp(gc_time_stamp), _failures(false) { }
2147 
2148   virtual bool doHeapRegion(HeapRegion* hr) {
2149     unsigned region_gc_time_stamp = hr->get_gc_time_stamp();
2150     if (_gc_time_stamp != region_gc_time_stamp) {
2151       log_error(gc, verify)("Region " HR_FORMAT " has GC time stamp = %d, expected %d", HR_FORMAT_PARAMS(hr),
2152                             region_gc_time_stamp, _gc_time_stamp);
2153       _failures = true;
2154     }
2155     return false;
2156   }
2157 
2158   bool failures() { return _failures; }
2159 };
2160 
2161 void G1CollectedHeap::check_gc_time_stamps() {
2162   CheckGCTimeStampsHRClosure cl(_gc_time_stamp);
2163   heap_region_iterate(&cl);
2164   guarantee(!cl.failures(), "all GC time stamps should have been reset");
2165 }
2166 #endif // PRODUCT
2167 
2168 void G1CollectedHeap::iterate_hcc_closure(CardTableEntryClosure* cl, uint worker_i) {
2169   _cg1r->hot_card_cache()->drain(cl, worker_i);
2170 }
2171 


5169   }
5170 
5171   log_develop_trace(gc, freelist)("G1ConcRegionFreeing [other] : done waiting for free regions");
5172 }
5173 
5174 bool G1CollectedHeap::is_old_gc_alloc_region(HeapRegion* hr) {
5175   return _allocator->is_retained_old_region(hr);
5176 }
5177 
5178 void G1CollectedHeap::set_region_short_lived_locked(HeapRegion* hr) {
5179   _young_list->push_region(hr);
5180 }
5181 
5182 class NoYoungRegionsClosure: public HeapRegionClosure {
5183 private:
5184   bool _success;
5185 public:
5186   NoYoungRegionsClosure() : _success(true) { }
5187   bool doHeapRegion(HeapRegion* r) {
5188     if (r->is_young()) {
5189       log_error(gc, verify)("Region [" PTR_FORMAT ", " PTR_FORMAT ") tagged as young",
5190                             p2i(r->bottom()), p2i(r->end()));
5191       _success = false;
5192     }
5193     return false;
5194   }
5195   bool success() { return _success; }
5196 };
5197 
5198 bool G1CollectedHeap::check_young_list_empty(bool check_heap, bool check_sample) {
5199   bool ret = _young_list->check_list_empty(check_sample);
5200 
5201   if (check_heap) {
5202     NoYoungRegionsClosure closure;
5203     heap_region_iterate(&closure);
5204     ret = ret && closure.success();
5205   }
5206 
5207   return ret;
5208 }
5209 


< prev index next >