27 #include "gc/g1/g1CollectorPolicy.hpp" |
27 #include "gc/g1/g1CollectorPolicy.hpp" |
28 #include "gc/g1/heapRegion.hpp" |
28 #include "gc/g1/heapRegion.hpp" |
29 #include "gc/g1/heapRegion.inline.hpp" |
29 #include "gc/g1/heapRegion.inline.hpp" |
30 #include "gc/g1/heapRegionRemSet.hpp" |
30 #include "gc/g1/heapRegionRemSet.hpp" |
31 #include "gc/g1/youngList.hpp" |
31 #include "gc/g1/youngList.hpp" |
|
32 #include "logging/log.hpp" |
32 #include "utilities/ostream.hpp" |
33 #include "utilities/ostream.hpp" |
33 |
34 |
34 YoungList::YoungList(G1CollectedHeap* g1h) : |
35 YoungList::YoungList(G1CollectedHeap* g1h) : |
35 _g1h(g1h), _head(NULL), _length(0), _last_sampled_rs_lengths(0), |
36 _g1h(g1h), _head(NULL), _length(0), _last_sampled_rs_lengths(0), |
36 _survivor_head(NULL), _survivor_tail(NULL), _survivor_length(0) { |
37 _survivor_head(NULL), _survivor_tail(NULL), _survivor_length(0) { |
96 uint length = 0; |
97 uint length = 0; |
97 HeapRegion* curr = _head; |
98 HeapRegion* curr = _head; |
98 HeapRegion* last = NULL; |
99 HeapRegion* last = NULL; |
99 while (curr != NULL) { |
100 while (curr != NULL) { |
100 if (!curr->is_young()) { |
101 if (!curr->is_young()) { |
101 gclog_or_tty->print_cr("### YOUNG REGION " PTR_FORMAT "-" PTR_FORMAT " " |
102 log_info(gc, verify)("### YOUNG REGION " PTR_FORMAT "-" PTR_FORMAT " " |
102 "incorrectly tagged (y: %d, surv: %d)", |
103 "incorrectly tagged (y: %d, surv: %d)", |
103 p2i(curr->bottom()), p2i(curr->end()), |
104 p2i(curr->bottom()), p2i(curr->end()), |
104 curr->is_young(), curr->is_survivor()); |
105 curr->is_young(), curr->is_survivor()); |
105 ret = false; |
106 ret = false; |
106 } |
107 } |
107 ++length; |
108 ++length; |
108 last = curr; |
109 last = curr; |
109 curr = curr->get_next_young_region(); |
110 curr = curr->get_next_young_region(); |
110 } |
111 } |
111 ret = ret && (length == _length); |
112 ret = ret && (length == _length); |
112 |
113 |
113 if (!ret) { |
114 if (!ret) { |
114 gclog_or_tty->print_cr("### YOUNG LIST seems not well formed!"); |
115 log_info(gc, verify)("### YOUNG LIST seems not well formed!"); |
115 gclog_or_tty->print_cr("### list has %u entries, _length is %u", |
116 log_info(gc, verify)("### list has %u entries, _length is %u", length, _length); |
116 length, _length); |
|
117 } |
117 } |
118 |
118 |
119 return ret; |
119 return ret; |
120 } |
120 } |
121 |
121 |
122 bool YoungList::check_list_empty(bool check_sample) { |
122 bool YoungList::check_list_empty(bool check_sample) { |
123 bool ret = true; |
123 bool ret = true; |
124 |
124 |
125 if (_length != 0) { |
125 if (_length != 0) { |
126 gclog_or_tty->print_cr("### YOUNG LIST should have 0 length, not %u", |
126 log_info(gc, verify)("### YOUNG LIST should have 0 length, not %u", _length); |
127 _length); |
|
128 ret = false; |
127 ret = false; |
129 } |
128 } |
130 if (check_sample && _last_sampled_rs_lengths != 0) { |
129 if (check_sample && _last_sampled_rs_lengths != 0) { |
131 gclog_or_tty->print_cr("### YOUNG LIST has non-zero last sampled RS lengths"); |
130 log_info(gc, verify)("### YOUNG LIST has non-zero last sampled RS lengths"); |
132 ret = false; |
131 ret = false; |
133 } |
132 } |
134 if (_head != NULL) { |
133 if (_head != NULL) { |
135 gclog_or_tty->print_cr("### YOUNG LIST does not have a NULL head"); |
134 log_info(gc, verify)("### YOUNG LIST does not have a NULL head"); |
136 ret = false; |
135 ret = false; |
137 } |
136 } |
138 if (!ret) { |
137 if (!ret) { |
139 gclog_or_tty->print_cr("### YOUNG LIST does not seem empty"); |
138 log_info(gc, verify)("### YOUNG LIST does not seem empty"); |
140 } |
139 } |
141 |
140 |
142 return ret; |
141 return ret; |
143 } |
142 } |
144 |
143 |
220 void YoungList::print() { |
218 void YoungList::print() { |
221 HeapRegion* lists[] = {_head, _survivor_head}; |
219 HeapRegion* lists[] = {_head, _survivor_head}; |
222 const char* names[] = {"YOUNG", "SURVIVOR"}; |
220 const char* names[] = {"YOUNG", "SURVIVOR"}; |
223 |
221 |
224 for (uint list = 0; list < ARRAY_SIZE(lists); ++list) { |
222 for (uint list = 0; list < ARRAY_SIZE(lists); ++list) { |
225 gclog_or_tty->print_cr("%s LIST CONTENTS", names[list]); |
223 tty->print_cr("%s LIST CONTENTS", names[list]); |
226 HeapRegion *curr = lists[list]; |
224 HeapRegion *curr = lists[list]; |
227 if (curr == NULL) { |
225 if (curr == NULL) { |
228 gclog_or_tty->print_cr(" empty"); |
226 tty->print_cr(" empty"); |
229 } |
227 } |
230 while (curr != NULL) { |
228 while (curr != NULL) { |
231 gclog_or_tty->print_cr(" " HR_FORMAT ", P: " PTR_FORMAT ", N: " PTR_FORMAT ", age: %4d", |
229 tty->print_cr(" " HR_FORMAT ", P: " PTR_FORMAT ", N: " PTR_FORMAT ", age: %4d", |
232 HR_FORMAT_PARAMS(curr), |
230 HR_FORMAT_PARAMS(curr), |
233 p2i(curr->prev_top_at_mark_start()), |
231 p2i(curr->prev_top_at_mark_start()), |
234 p2i(curr->next_top_at_mark_start()), |
232 p2i(curr->next_top_at_mark_start()), |
235 curr->age_in_surv_rate_group_cond()); |
233 curr->age_in_surv_rate_group_cond()); |
236 curr = curr->get_next_young_region(); |
234 curr = curr->get_next_young_region(); |
237 } |
235 } |
238 } |
236 } |
239 |
237 |
240 gclog_or_tty->cr(); |
238 tty->cr(); |
241 } |
239 } |