236 size_in_bytes = array_length << Klass::layout_helper_log2_element_size(lh); |
236 size_in_bytes = array_length << Klass::layout_helper_log2_element_size(lh); |
237 size_in_bytes += Klass::layout_helper_header_size(lh); |
237 size_in_bytes += Klass::layout_helper_header_size(lh); |
238 |
238 |
239 // This code could be simplified, but by keeping array_header_in_bytes |
239 // This code could be simplified, but by keeping array_header_in_bytes |
240 // in units of bytes and doing it this way we can round up just once, |
240 // in units of bytes and doing it this way we can round up just once, |
241 // skipping the intermediate round to HeapWordSize. Cast the result |
241 // skipping the intermediate round to HeapWordSize. |
242 // of round_to to size_t to guarantee unsigned division == right shift. |
242 s = (int)(align_up(size_in_bytes, MinObjAlignmentInBytes) / HeapWordSize); |
243 s = (int)((size_t)round_to(size_in_bytes, MinObjAlignmentInBytes) / |
|
244 HeapWordSize); |
|
245 |
243 |
246 // ParNew (used by CMS), UseParallelGC and UseG1GC can change the length field |
244 // ParNew (used by CMS), UseParallelGC and UseG1GC can change the length field |
247 // of an "old copy" of an object array in the young gen so it indicates |
245 // of an "old copy" of an object array in the young gen so it indicates |
248 // the grey portion of an already copied array. This will cause the first |
246 // the grey portion of an already copied array. This will cause the first |
249 // disjunct below to fail if the two comparands are computed across such |
247 // disjunct below to fail if the two comparands are computed across such |