215 jbyte* const new_end = byte_after(new_region.last()); |
215 jbyte* const new_end = byte_after(new_region.last()); |
216 HeapWord* new_end_aligned = |
216 HeapWord* new_end_aligned = |
217 (HeapWord*) align_size_up((uintptr_t)new_end, _page_size); |
217 (HeapWord*) align_size_up((uintptr_t)new_end, _page_size); |
218 assert(new_end_aligned >= (HeapWord*) new_end, |
218 assert(new_end_aligned >= (HeapWord*) new_end, |
219 "align up, but less"); |
219 "align up, but less"); |
|
220 // Check the other regions (excludes "ind") to ensure that |
|
221 // the new_end_aligned does not intrude onto the committed |
|
222 // space of another region. |
220 int ri = 0; |
223 int ri = 0; |
221 for (ri = 0; ri < _cur_covered_regions; ri++) { |
224 for (ri = 0; ri < _cur_covered_regions; ri++) { |
222 if (ri != ind) { |
225 if (ri != ind) { |
223 if (_committed[ri].contains(new_end_aligned)) { |
226 if (_committed[ri].contains(new_end_aligned)) { |
224 assert((new_end_aligned >= _committed[ri].start()) && |
227 // The prior check included in the assert |
225 (_committed[ri].start() > _committed[ind].start()), |
228 // (new_end_aligned >= _committed[ri].start()) |
|
229 // is redundant with the "contains" test. |
|
230 // Any region containing the new end |
|
231 // should start at or beyond the region found (ind) |
|
232 // for the new end (committed regions are not expected to |
|
233 // be proper subsets of other committed regions). |
|
234 assert(_committed[ri].start() >= _committed[ind].start(), |
226 "New end of committed region is inconsistent"); |
235 "New end of committed region is inconsistent"); |
227 new_end_aligned = _committed[ri].start(); |
236 new_end_aligned = _committed[ri].start(); |
228 assert(new_end_aligned > _committed[ind].start(), |
237 // new_end_aligned can be equal to the start of its |
|
238 // committed region (i.e., of "ind") if a second |
|
239 // region following "ind" also start at the same location |
|
240 // as "ind". |
|
241 assert(new_end_aligned >= _committed[ind].start(), |
229 "New end of committed region is before start"); |
242 "New end of committed region is before start"); |
230 debug_only(collided = true;) |
243 debug_only(collided = true;) |
231 // Should only collide with 1 region |
244 // Should only collide with 1 region |
232 break; |
245 break; |
233 } |
246 } |