239 assert(words % MinObjAlignment == 0, "unaligned size"); |
239 assert(words % MinObjAlignment == 0, "unaligned size"); |
240 assert(Universe::heap()->is_in_reserved(start), "not in heap"); |
240 assert(Universe::heap()->is_in_reserved(start), "not in heap"); |
241 assert(Universe::heap()->is_in_reserved(start + words - 1), "not in heap"); |
241 assert(Universe::heap()->is_in_reserved(start + words - 1), "not in heap"); |
242 } |
242 } |
243 |
243 |
244 void CollectedHeap::zap_filler_array(HeapWord* start, size_t words) |
244 void CollectedHeap::zap_filler_array(HeapWord* start, size_t words, bool zap) |
245 { |
245 { |
246 if (ZapFillerObjects) { |
246 if (ZapFillerObjects && zap) { |
247 Copy::fill_to_words(start + filler_array_hdr_size(), |
247 Copy::fill_to_words(start + filler_array_hdr_size(), |
248 words - filler_array_hdr_size(), 0XDEAFBABE); |
248 words - filler_array_hdr_size(), 0XDEAFBABE); |
249 } |
249 } |
250 } |
250 } |
251 #endif // ASSERT |
251 #endif // ASSERT |
252 |
252 |
253 void |
253 void |
254 CollectedHeap::fill_with_array(HeapWord* start, size_t words) |
254 CollectedHeap::fill_with_array(HeapWord* start, size_t words, bool zap) |
255 { |
255 { |
256 assert(words >= filler_array_min_size(), "too small for an array"); |
256 assert(words >= filler_array_min_size(), "too small for an array"); |
257 assert(words <= filler_array_max_size(), "too big for a single object"); |
257 assert(words <= filler_array_max_size(), "too big for a single object"); |
258 |
258 |
259 const size_t payload_size = words - filler_array_hdr_size(); |
259 const size_t payload_size = words - filler_array_hdr_size(); |
260 const size_t len = payload_size * HeapWordSize / sizeof(jint); |
260 const size_t len = payload_size * HeapWordSize / sizeof(jint); |
261 |
261 |
262 // Set the length first for concurrent GC. |
262 // Set the length first for concurrent GC. |
263 ((arrayOop)start)->set_length((int)len); |
263 ((arrayOop)start)->set_length((int)len); |
264 post_allocation_setup_common(Universe::intArrayKlassObj(), start, words); |
264 post_allocation_setup_common(Universe::intArrayKlassObj(), start, words); |
265 DEBUG_ONLY(zap_filler_array(start, words);) |
265 DEBUG_ONLY(zap_filler_array(start, words, zap);) |
266 } |
266 } |
267 |
267 |
268 void |
268 void |
269 CollectedHeap::fill_with_object_impl(HeapWord* start, size_t words) |
269 CollectedHeap::fill_with_object_impl(HeapWord* start, size_t words, bool zap) |
270 { |
270 { |
271 assert(words <= filler_array_max_size(), "too big for a single object"); |
271 assert(words <= filler_array_max_size(), "too big for a single object"); |
272 |
272 |
273 if (words >= filler_array_min_size()) { |
273 if (words >= filler_array_min_size()) { |
274 fill_with_array(start, words); |
274 fill_with_array(start, words, zap); |
275 } else if (words > 0) { |
275 } else if (words > 0) { |
276 assert(words == min_fill_size(), "unaligned size"); |
276 assert(words == min_fill_size(), "unaligned size"); |
277 post_allocation_setup_common(SystemDictionary::Object_klass(), start, |
277 post_allocation_setup_common(SystemDictionary::Object_klass(), start, |
278 words); |
278 words); |
279 } |
279 } |
280 } |
280 } |
281 |
281 |
282 void CollectedHeap::fill_with_object(HeapWord* start, size_t words) |
282 void CollectedHeap::fill_with_object(HeapWord* start, size_t words, bool zap) |
283 { |
283 { |
284 DEBUG_ONLY(fill_args_check(start, words);) |
284 DEBUG_ONLY(fill_args_check(start, words);) |
285 HandleMark hm; // Free handles before leaving. |
285 HandleMark hm; // Free handles before leaving. |
286 fill_with_object_impl(start, words); |
286 fill_with_object_impl(start, words, zap); |
287 } |
287 } |
288 |
288 |
289 void CollectedHeap::fill_with_objects(HeapWord* start, size_t words) |
289 void CollectedHeap::fill_with_objects(HeapWord* start, size_t words, bool zap) |
290 { |
290 { |
291 DEBUG_ONLY(fill_args_check(start, words);) |
291 DEBUG_ONLY(fill_args_check(start, words);) |
292 HandleMark hm; // Free handles before leaving. |
292 HandleMark hm; // Free handles before leaving. |
293 |
293 |
294 #ifdef LP64 |
294 #ifdef LP64 |
297 // fill. The remainder is filled with a single object. |
297 // fill. The remainder is filled with a single object. |
298 const size_t min = min_fill_size(); |
298 const size_t min = min_fill_size(); |
299 const size_t max = filler_array_max_size(); |
299 const size_t max = filler_array_max_size(); |
300 while (words > max) { |
300 while (words > max) { |
301 const size_t cur = words - max >= min ? max : max - min; |
301 const size_t cur = words - max >= min ? max : max - min; |
302 fill_with_array(start, cur); |
302 fill_with_array(start, cur, zap); |
303 start += cur; |
303 start += cur; |
304 words -= cur; |
304 words -= cur; |
305 } |
305 } |
306 #endif |
306 #endif |
307 |
307 |
308 fill_with_object_impl(start, words); |
308 fill_with_object_impl(start, words, zap); |
309 } |
309 } |
310 |
310 |
311 HeapWord* CollectedHeap::allocate_new_tlab(size_t size) { |
311 HeapWord* CollectedHeap::allocate_new_tlab(size_t size) { |
312 guarantee(false, "thread-local allocation buffers not supported"); |
312 guarantee(false, "thread-local allocation buffers not supported"); |
313 return NULL; |
313 return NULL; |