251 assert(!_committed[ri].contains(new_end_aligned), |
251 assert(!_committed[ri].contains(new_end_aligned), |
252 "New end of committed region is in a second committed region"); |
252 "New end of committed region is in a second committed region"); |
253 } |
253 } |
254 #endif |
254 #endif |
255 // The guard page is always committed and should not be committed over. |
255 // The guard page is always committed and should not be committed over. |
256 HeapWord* const new_end_for_commit = MIN2(new_end_aligned, |
256 // "guarded" is used for assertion checking below and recalls the fact |
257 _guard_region.start()); |
257 // that the would-be end of the new committed region would have |
|
258 // penetrated the guard page. |
|
259 HeapWord* new_end_for_commit = new_end_aligned; |
|
260 |
|
261 DEBUG_ONLY(bool guarded = false;) |
|
262 if (new_end_for_commit > _guard_region.start()) { |
|
263 new_end_for_commit = _guard_region.start(); |
|
264 DEBUG_ONLY(guarded = true;) |
|
265 } |
258 |
266 |
259 if (new_end_for_commit > cur_committed.end()) { |
267 if (new_end_for_commit > cur_committed.end()) { |
260 // Must commit new pages. |
268 // Must commit new pages. |
261 MemRegion const new_committed = |
269 MemRegion const new_committed = |
262 MemRegion(cur_committed.end(), new_end_for_commit); |
270 MemRegion(cur_committed.end(), new_end_for_commit); |
300 "The guard card will be overwritten"); |
308 "The guard card will be overwritten"); |
301 // This line commented out cleans the newly expanded region and |
309 // This line commented out cleans the newly expanded region and |
302 // not the aligned up expanded region. |
310 // not the aligned up expanded region. |
303 // jbyte* const end = byte_after(new_region.last()); |
311 // jbyte* const end = byte_after(new_region.last()); |
304 jbyte* const end = (jbyte*) new_end_for_commit; |
312 jbyte* const end = (jbyte*) new_end_for_commit; |
305 assert((end >= byte_after(new_region.last())) || collided, |
313 assert((end >= byte_after(new_region.last())) || collided || guarded, |
306 "Expect to be beyond new region unless impacting another region"); |
314 "Expect to be beyond new region unless impacting another region"); |
307 // do nothing if we resized downward. |
315 // do nothing if we resized downward. |
308 #ifdef ASSERT |
316 #ifdef ASSERT |
309 for (int ri = 0; ri < _cur_covered_regions; ri++) { |
317 for (int ri = 0; ri < _cur_covered_regions; ri++) { |
310 if (ri != ind) { |
318 if (ri != ind) { |