equal
deleted
inserted
replaced
1067 |
1067 |
1068 class PostCompactionPrinterClosure: public HeapRegionClosure { |
1068 class PostCompactionPrinterClosure: public HeapRegionClosure { |
1069 private: |
1069 private: |
1070 G1HRPrinter* _hr_printer; |
1070 G1HRPrinter* _hr_printer; |
1071 public: |
1071 public: |
1072 bool doHeapRegion(HeapRegion* hr) { |
1072 bool do_heap_region(HeapRegion* hr) { |
1073 assert(!hr->is_young(), "not expecting to find young regions"); |
1073 assert(!hr->is_young(), "not expecting to find young regions"); |
1074 _hr_printer->post_compaction(hr); |
1074 _hr_printer->post_compaction(hr); |
1075 return false; |
1075 return false; |
1076 } |
1076 } |
1077 |
1077 |
1978 |
1978 |
1979 public: |
1979 public: |
1980 CheckGCTimeStampsHRClosure(unsigned gc_time_stamp) : |
1980 CheckGCTimeStampsHRClosure(unsigned gc_time_stamp) : |
1981 _gc_time_stamp(gc_time_stamp), _failures(false) { } |
1981 _gc_time_stamp(gc_time_stamp), _failures(false) { } |
1982 |
1982 |
1983 virtual bool doHeapRegion(HeapRegion* hr) { |
1983 virtual bool do_heap_region(HeapRegion* hr) { |
1984 unsigned region_gc_time_stamp = hr->get_gc_time_stamp(); |
1984 unsigned region_gc_time_stamp = hr->get_gc_time_stamp(); |
1985 if (_gc_time_stamp != region_gc_time_stamp) { |
1985 if (_gc_time_stamp != region_gc_time_stamp) { |
1986 log_error(gc, verify)("Region " HR_FORMAT " has GC time stamp = %d, expected %d", HR_FORMAT_PARAMS(hr), |
1986 log_error(gc, verify)("Region " HR_FORMAT " has GC time stamp = %d, expected %d", HR_FORMAT_PARAMS(hr), |
1987 region_gc_time_stamp, _gc_time_stamp); |
1987 region_gc_time_stamp, _gc_time_stamp); |
1988 _failures = true; |
1988 _failures = true; |
2030 |
2030 |
2031 class SumUsedClosure: public HeapRegionClosure { |
2031 class SumUsedClosure: public HeapRegionClosure { |
2032 size_t _used; |
2032 size_t _used; |
2033 public: |
2033 public: |
2034 SumUsedClosure() : _used(0) {} |
2034 SumUsedClosure() : _used(0) {} |
2035 bool doHeapRegion(HeapRegion* r) { |
2035 bool do_heap_region(HeapRegion* r) { |
2036 _used += r->used(); |
2036 _used += r->used(); |
2037 return false; |
2037 return false; |
2038 } |
2038 } |
2039 size_t result() { return _used; } |
2039 size_t result() { return _used; } |
2040 }; |
2040 }; |
2249 |
2249 |
2250 class IterateObjectClosureRegionClosure: public HeapRegionClosure { |
2250 class IterateObjectClosureRegionClosure: public HeapRegionClosure { |
2251 ObjectClosure* _cl; |
2251 ObjectClosure* _cl; |
2252 public: |
2252 public: |
2253 IterateObjectClosureRegionClosure(ObjectClosure* cl) : _cl(cl) {} |
2253 IterateObjectClosureRegionClosure(ObjectClosure* cl) : _cl(cl) {} |
2254 bool doHeapRegion(HeapRegion* r) { |
2254 bool do_heap_region(HeapRegion* r) { |
2255 if (!r->is_continues_humongous()) { |
2255 if (!r->is_continues_humongous()) { |
2256 r->object_iterate(_cl); |
2256 r->object_iterate(_cl); |
2257 } |
2257 } |
2258 return false; |
2258 return false; |
2259 } |
2259 } |
2364 |
2364 |
2365 class PrintRegionClosure: public HeapRegionClosure { |
2365 class PrintRegionClosure: public HeapRegionClosure { |
2366 outputStream* _st; |
2366 outputStream* _st; |
2367 public: |
2367 public: |
2368 PrintRegionClosure(outputStream* st) : _st(st) {} |
2368 PrintRegionClosure(outputStream* st) : _st(st) {} |
2369 bool doHeapRegion(HeapRegion* r) { |
2369 bool do_heap_region(HeapRegion* r) { |
2370 r->print_on(_st); |
2370 r->print_on(_st); |
2371 return false; |
2371 return false; |
2372 } |
2372 } |
2373 }; |
2373 }; |
2374 |
2374 |
2483 private: |
2483 private: |
2484 const char* _msg; |
2484 const char* _msg; |
2485 size_t _occupied_sum; |
2485 size_t _occupied_sum; |
2486 |
2486 |
2487 public: |
2487 public: |
2488 bool doHeapRegion(HeapRegion* r) { |
2488 bool do_heap_region(HeapRegion* r) { |
2489 HeapRegionRemSet* hrrs = r->rem_set(); |
2489 HeapRegionRemSet* hrrs = r->rem_set(); |
2490 size_t occupied = hrrs->occupied(); |
2490 size_t occupied = hrrs->occupied(); |
2491 _occupied_sum += occupied; |
2491 _occupied_sum += occupied; |
2492 |
2492 |
2493 tty->print_cr("Printing RSet for region " HR_FORMAT, HR_FORMAT_PARAMS(r)); |
2493 tty->print_cr("Printing RSet for region " HR_FORMAT, HR_FORMAT_PARAMS(r)); |
2731 : _total_humongous(0), |
2731 : _total_humongous(0), |
2732 _candidate_humongous(0), |
2732 _candidate_humongous(0), |
2733 _dcq(&JavaThread::dirty_card_queue_set()) { |
2733 _dcq(&JavaThread::dirty_card_queue_set()) { |
2734 } |
2734 } |
2735 |
2735 |
2736 virtual bool doHeapRegion(HeapRegion* r) { |
2736 virtual bool do_heap_region(HeapRegion* r) { |
2737 if (!r->is_starts_humongous()) { |
2737 if (!r->is_starts_humongous()) { |
2738 return false; |
2738 return false; |
2739 } |
2739 } |
2740 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
2740 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
2741 |
2741 |
2807 cl.flush_rem_set_entries(); |
2807 cl.flush_rem_set_entries(); |
2808 } |
2808 } |
2809 |
2809 |
2810 class VerifyRegionRemSetClosure : public HeapRegionClosure { |
2810 class VerifyRegionRemSetClosure : public HeapRegionClosure { |
2811 public: |
2811 public: |
2812 bool doHeapRegion(HeapRegion* hr) { |
2812 bool do_heap_region(HeapRegion* hr) { |
2813 if (!hr->is_archive() && !hr->is_continues_humongous()) { |
2813 if (!hr->is_archive() && !hr->is_continues_humongous()) { |
2814 hr->verify_rem_set(); |
2814 hr->verify_rem_set(); |
2815 } |
2815 } |
2816 return false; |
2816 return false; |
2817 } |
2817 } |
2877 private: |
2877 private: |
2878 G1HRPrinter* _hr_printer; |
2878 G1HRPrinter* _hr_printer; |
2879 public: |
2879 public: |
2880 G1PrintCollectionSetClosure(G1HRPrinter* hr_printer) : HeapRegionClosure(), _hr_printer(hr_printer) { } |
2880 G1PrintCollectionSetClosure(G1HRPrinter* hr_printer) : HeapRegionClosure(), _hr_printer(hr_printer) { } |
2881 |
2881 |
2882 virtual bool doHeapRegion(HeapRegion* r) { |
2882 virtual bool do_heap_region(HeapRegion* r) { |
2883 _hr_printer->cset(r); |
2883 _hr_printer->cset(r); |
2884 return false; |
2884 return false; |
2885 } |
2885 } |
2886 }; |
2886 }; |
2887 |
2887 |
4567 _failure_used_words(0), |
4567 _failure_used_words(0), |
4568 _failure_waste_words(0), |
4568 _failure_waste_words(0), |
4569 _local_free_list("Local Region List for CSet Freeing") { |
4569 _local_free_list("Local Region List for CSet Freeing") { |
4570 } |
4570 } |
4571 |
4571 |
4572 virtual bool doHeapRegion(HeapRegion* r) { |
4572 virtual bool do_heap_region(HeapRegion* r) { |
4573 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
4573 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
4574 |
4574 |
4575 assert(r->in_collection_set(), "Region %u should be in collection set.", r->hrm_index()); |
4575 assert(r->in_collection_set(), "Region %u should be in collection set.", r->hrm_index()); |
4576 g1h->clear_in_cset(r); |
4576 g1h->clear_in_cset(r); |
4577 |
4577 |
4690 size_t _cur_idx; |
4690 size_t _cur_idx; |
4691 WorkItem* _work_items; |
4691 WorkItem* _work_items; |
4692 public: |
4692 public: |
4693 G1PrepareFreeCollectionSetClosure(WorkItem* work_items) : HeapRegionClosure(), _cur_idx(0), _work_items(work_items) { } |
4693 G1PrepareFreeCollectionSetClosure(WorkItem* work_items) : HeapRegionClosure(), _cur_idx(0), _work_items(work_items) { } |
4694 |
4694 |
4695 virtual bool doHeapRegion(HeapRegion* r) { |
4695 virtual bool do_heap_region(HeapRegion* r) { |
4696 _work_items[_cur_idx++] = WorkItem(r); |
4696 _work_items[_cur_idx++] = WorkItem(r); |
4697 return false; |
4697 return false; |
4698 } |
4698 } |
4699 }; |
4699 }; |
4700 |
4700 |
4824 |
4824 |
4825 G1FreeHumongousRegionClosure(FreeRegionList* free_region_list) : |
4825 G1FreeHumongousRegionClosure(FreeRegionList* free_region_list) : |
4826 _free_region_list(free_region_list), _humongous_objects_reclaimed(0), _humongous_regions_reclaimed(0), _freed_bytes(0) { |
4826 _free_region_list(free_region_list), _humongous_objects_reclaimed(0), _humongous_regions_reclaimed(0), _freed_bytes(0) { |
4827 } |
4827 } |
4828 |
4828 |
4829 virtual bool doHeapRegion(HeapRegion* r) { |
4829 virtual bool do_heap_region(HeapRegion* r) { |
4830 if (!r->is_starts_humongous()) { |
4830 if (!r->is_starts_humongous()) { |
4831 return false; |
4831 return false; |
4832 } |
4832 } |
4833 |
4833 |
4834 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
4834 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
4959 cl.humongous_objects_reclaimed()); |
4959 cl.humongous_objects_reclaimed()); |
4960 } |
4960 } |
4961 |
4961 |
4962 class G1AbandonCollectionSetClosure : public HeapRegionClosure { |
4962 class G1AbandonCollectionSetClosure : public HeapRegionClosure { |
4963 public: |
4963 public: |
4964 virtual bool doHeapRegion(HeapRegion* r) { |
4964 virtual bool do_heap_region(HeapRegion* r) { |
4965 assert(r->in_collection_set(), "Region %u must have been in collection set", r->hrm_index()); |
4965 assert(r->in_collection_set(), "Region %u must have been in collection set", r->hrm_index()); |
4966 G1CollectedHeap::heap()->clear_in_cset(r); |
4966 G1CollectedHeap::heap()->clear_in_cset(r); |
4967 r->set_young_index_in_cset(-1); |
4967 r->set_young_index_in_cset(-1); |
4968 return false; |
4968 return false; |
4969 } |
4969 } |
5029 class NoYoungRegionsClosure: public HeapRegionClosure { |
5029 class NoYoungRegionsClosure: public HeapRegionClosure { |
5030 private: |
5030 private: |
5031 bool _success; |
5031 bool _success; |
5032 public: |
5032 public: |
5033 NoYoungRegionsClosure() : _success(true) { } |
5033 NoYoungRegionsClosure() : _success(true) { } |
5034 bool doHeapRegion(HeapRegion* r) { |
5034 bool do_heap_region(HeapRegion* r) { |
5035 if (r->is_young()) { |
5035 if (r->is_young()) { |
5036 log_error(gc, verify)("Region [" PTR_FORMAT ", " PTR_FORMAT ") tagged as young", |
5036 log_error(gc, verify)("Region [" PTR_FORMAT ", " PTR_FORMAT ") tagged as young", |
5037 p2i(r->bottom()), p2i(r->end())); |
5037 p2i(r->bottom()), p2i(r->end())); |
5038 _success = false; |
5038 _success = false; |
5039 } |
5039 } |
5059 HeapRegionSet *_old_set; |
5059 HeapRegionSet *_old_set; |
5060 |
5060 |
5061 public: |
5061 public: |
5062 TearDownRegionSetsClosure(HeapRegionSet* old_set) : _old_set(old_set) { } |
5062 TearDownRegionSetsClosure(HeapRegionSet* old_set) : _old_set(old_set) { } |
5063 |
5063 |
5064 bool doHeapRegion(HeapRegion* r) { |
5064 bool do_heap_region(HeapRegion* r) { |
5065 if (r->is_old()) { |
5065 if (r->is_old()) { |
5066 _old_set->remove(r); |
5066 _old_set->remove(r); |
5067 } else if(r->is_young()) { |
5067 } else if(r->is_young()) { |
5068 r->uninstall_surv_rate_group(); |
5068 r->uninstall_surv_rate_group(); |
5069 } else { |
5069 } else { |
5127 if (!free_list_only) { |
5127 if (!free_list_only) { |
5128 assert(_old_set->is_empty(), "pre-condition"); |
5128 assert(_old_set->is_empty(), "pre-condition"); |
5129 } |
5129 } |
5130 } |
5130 } |
5131 |
5131 |
5132 bool doHeapRegion(HeapRegion* r) { |
5132 bool do_heap_region(HeapRegion* r) { |
5133 if (r->is_empty()) { |
5133 if (r->is_empty()) { |
5134 // Add free regions to the free list |
5134 // Add free regions to the free list |
5135 r->set_free(); |
5135 r->set_free(); |
5136 r->set_allocation_context(AllocationContext::system()); |
5136 r->set_allocation_context(AllocationContext::system()); |
5137 _hrm->insert_into_free_list(r); |
5137 _hrm->insert_into_free_list(r); |