89 HeapRegion::GrainBytes * (size_t) G1MixedGCLiveThresholdPercent / 100; |
89 HeapRegion::GrainBytes * (size_t) G1MixedGCLiveThresholdPercent / 100; |
90 } |
90 } |
91 |
91 |
92 #ifndef PRODUCT |
92 #ifndef PRODUCT |
93 void CollectionSetChooser::verify() { |
93 void CollectionSetChooser::verify() { |
94 guarantee(_end <= regions_length(), |
94 guarantee(_end <= regions_length(), "_end: %u regions length: %u", _end, regions_length()); |
95 err_msg("_end: %u regions length: %u", _end, regions_length())); |
95 guarantee(_front <= _end, "_front: %u _end: %u", _front, _end); |
96 guarantee(_front <= _end, |
|
97 err_msg("_front: %u _end: %u", _front, _end)); |
|
98 uint index = 0; |
96 uint index = 0; |
99 size_t sum_of_reclaimable_bytes = 0; |
97 size_t sum_of_reclaimable_bytes = 0; |
100 while (index < _front) { |
98 while (index < _front) { |
101 guarantee(regions_at(index) == NULL, |
99 guarantee(regions_at(index) == NULL, |
102 "all entries before _front should be NULL"); |
100 "all entries before _front should be NULL"); |
106 while (index < _end) { |
104 while (index < _end) { |
107 HeapRegion *curr = regions_at(index++); |
105 HeapRegion *curr = regions_at(index++); |
108 guarantee(curr != NULL, "Regions in _regions array cannot be NULL"); |
106 guarantee(curr != NULL, "Regions in _regions array cannot be NULL"); |
109 guarantee(!curr->is_young(), "should not be young!"); |
107 guarantee(!curr->is_young(), "should not be young!"); |
110 guarantee(!curr->is_pinned(), |
108 guarantee(!curr->is_pinned(), |
111 err_msg("Pinned region should not be in collection set (index %u)", curr->hrm_index())); |
109 "Pinned region should not be in collection set (index %u)", curr->hrm_index()); |
112 if (prev != NULL) { |
110 if (prev != NULL) { |
113 guarantee(order_regions(prev, curr) != 1, |
111 guarantee(order_regions(prev, curr) != 1, |
114 err_msg("GC eff prev: %1.4f GC eff curr: %1.4f", |
112 "GC eff prev: %1.4f GC eff curr: %1.4f", |
115 prev->gc_efficiency(), curr->gc_efficiency())); |
113 prev->gc_efficiency(), curr->gc_efficiency()); |
116 } |
114 } |
117 sum_of_reclaimable_bytes += curr->reclaimable_bytes(); |
115 sum_of_reclaimable_bytes += curr->reclaimable_bytes(); |
118 prev = curr; |
116 prev = curr; |
119 } |
117 } |
120 guarantee(sum_of_reclaimable_bytes == _remaining_reclaimable_bytes, |
118 guarantee(sum_of_reclaimable_bytes == _remaining_reclaimable_bytes, |
121 err_msg("reclaimable bytes inconsistent, " |
119 "reclaimable bytes inconsistent, " |
122 "remaining: " SIZE_FORMAT " sum: " SIZE_FORMAT, |
120 "remaining: " SIZE_FORMAT " sum: " SIZE_FORMAT, |
123 _remaining_reclaimable_bytes, sum_of_reclaimable_bytes)); |
121 _remaining_reclaimable_bytes, sum_of_reclaimable_bytes); |
124 } |
122 } |
125 #endif // !PRODUCT |
123 #endif // !PRODUCT |
126 |
124 |
127 void CollectionSetChooser::sort_regions() { |
125 void CollectionSetChooser::sort_regions() { |
128 // First trim any unused portion of the top in the parallel case. |
126 // First trim any unused portion of the top in the parallel case. |
149 } |
147 } |
150 |
148 |
151 |
149 |
152 void CollectionSetChooser::add_region(HeapRegion* hr) { |
150 void CollectionSetChooser::add_region(HeapRegion* hr) { |
153 assert(!hr->is_pinned(), |
151 assert(!hr->is_pinned(), |
154 err_msg("Pinned region shouldn't be added to the collection set (index %u)", hr->hrm_index())); |
152 "Pinned region shouldn't be added to the collection set (index %u)", hr->hrm_index()); |
155 assert(!hr->is_young(), "should not be young!"); |
153 assert(!hr->is_young(), "should not be young!"); |
156 _regions.append(hr); |
154 _regions.append(hr); |
157 _end++; |
155 _end++; |
158 _remaining_reclaimable_bytes += hr->reclaimable_bytes(); |
156 _remaining_reclaimable_bytes += hr->reclaimable_bytes(); |
159 hr->calc_gc_efficiency(); |
157 hr->calc_gc_efficiency(); |