72 // && _regions.at(i) is contiguous with its predecessor, if any |
72 // && _regions.at(i) is contiguous with its predecessor, if any |
73 // && sumSizes is the sum of the sizes of the regions in the interval |
73 // && sumSizes is the sum of the sizes of the regions in the interval |
74 // [first, cur) |
74 // [first, cur) |
75 HeapRegion* curhr = _regions.at(cur); |
75 HeapRegion* curhr = _regions.at(cur); |
76 if (curhr->is_empty() |
76 if (curhr->is_empty() |
77 && !curhr->is_reserved() |
|
78 && (first == cur |
77 && (first == cur |
79 || (_regions.at(cur-1)->end() == |
78 || (_regions.at(cur-1)->end() == |
80 curhr->bottom()))) { |
79 curhr->bottom()))) { |
81 sumSizes += curhr->capacity() / HeapWordSize; |
80 sumSizes += curhr->capacity() / HeapWordSize; |
82 } else { |
81 } else { |
119 // If we started from the beginning, we want to know why we can't alloc. |
118 // If we started from the beginning, we want to know why we can't alloc. |
120 return NULL; |
119 return NULL; |
121 } |
120 } |
122 } |
121 } |
123 |
122 |
124 void HeapRegionSeq::print_empty_runs(bool reserved_are_empty) { |
123 void HeapRegionSeq::print_empty_runs() { |
125 int empty_run = 0; |
124 int empty_run = 0; |
126 int n_empty = 0; |
125 int n_empty = 0; |
127 bool at_least_one_reserved = false; |
|
128 int empty_run_start; |
126 int empty_run_start; |
129 for (int i = 0; i < _regions.length(); i++) { |
127 for (int i = 0; i < _regions.length(); i++) { |
130 HeapRegion* r = _regions.at(i); |
128 HeapRegion* r = _regions.at(i); |
131 if (r->continuesHumongous()) continue; |
129 if (r->continuesHumongous()) continue; |
132 if (r->is_empty() && (reserved_are_empty || !r->is_reserved())) { |
130 if (r->is_empty()) { |
133 assert(!r->isHumongous(), "H regions should not be empty."); |
131 assert(!r->isHumongous(), "H regions should not be empty."); |
134 if (empty_run == 0) empty_run_start = i; |
132 if (empty_run == 0) empty_run_start = i; |
135 empty_run++; |
133 empty_run++; |
136 n_empty++; |
134 n_empty++; |
137 if (r->is_reserved()) { |
|
138 at_least_one_reserved = true; |
|
139 } |
|
140 } else { |
135 } else { |
141 if (empty_run > 0) { |
136 if (empty_run > 0) { |
142 gclog_or_tty->print(" %d:%d", empty_run_start, empty_run); |
137 gclog_or_tty->print(" %d:%d", empty_run_start, empty_run); |
143 if (reserved_are_empty && at_least_one_reserved) |
|
144 gclog_or_tty->print("(R)"); |
|
145 empty_run = 0; |
138 empty_run = 0; |
146 at_least_one_reserved = false; |
|
147 } |
139 } |
148 } |
140 } |
149 } |
141 } |
150 if (empty_run > 0) { |
142 if (empty_run > 0) { |
151 gclog_or_tty->print(" %d:%d", empty_run_start, empty_run); |
143 gclog_or_tty->print(" %d:%d", empty_run_start, empty_run); |
152 if (reserved_are_empty && at_least_one_reserved) gclog_or_tty->print("(R)"); |
|
153 } |
144 } |
154 gclog_or_tty->print_cr(" [tot = %d]", n_empty); |
145 gclog_or_tty->print_cr(" [tot = %d]", n_empty); |
155 } |
146 } |
156 |
147 |
157 int HeapRegionSeq::find(HeapRegion* hr) { |
148 int HeapRegionSeq::find(HeapRegion* hr) { |