269 thread->tlab().record_slow_allocation(size);
270 return NULL;
271 }
272
273 // Discard tlab and allocate a new one.
274 // To minimize fragmentation, the last TLAB may be smaller than the rest.
275 size_t new_tlab_size = thread->tlab().compute_size(size);
276
277 thread->tlab().clear_before_allocation();
278
279 if (new_tlab_size == 0) {
280 return NULL;
281 }
282
283 // Allocate a new TLAB...
284 HeapWord* obj = Universe::heap()->allocate_new_tlab(new_tlab_size);
285 if (obj == NULL) {
286 return NULL;
287 }
288
289 AllocTracer::send_allocation_in_new_tlab_event(klass, new_tlab_size * HeapWordSize, size * HeapWordSize);
290
291 if (ZeroTLAB) {
292 // ..and clear it.
293 Copy::zero_to_words(obj, new_tlab_size);
294 } else {
295 // ...and zap just allocated object.
296 #ifdef ASSERT
297 // Skip mangling the space corresponding to the object header to
298 // ensure that the returned space is not considered parsable by
299 // any concurrent GC thread.
300 size_t hdr_size = oopDesc::header_size();
301 Copy::fill_to_words(obj + hdr_size, new_tlab_size - hdr_size, badHeapWordVal);
302 #endif // ASSERT
303 }
304 thread->tlab().fill(obj, obj + size, new_tlab_size);
305 return obj;
306 }
307
308 void CollectedHeap::flush_deferred_store_barrier(JavaThread* thread) {
309 MemRegion deferred = thread->deferred_card_mark();
|
269 thread->tlab().record_slow_allocation(size);
270 return NULL;
271 }
272
273 // Discard tlab and allocate a new one.
274 // To minimize fragmentation, the last TLAB may be smaller than the rest.
275 size_t new_tlab_size = thread->tlab().compute_size(size);
276
277 thread->tlab().clear_before_allocation();
278
279 if (new_tlab_size == 0) {
280 return NULL;
281 }
282
283 // Allocate a new TLAB...
284 HeapWord* obj = Universe::heap()->allocate_new_tlab(new_tlab_size);
285 if (obj == NULL) {
286 return NULL;
287 }
288
289 AllocTracer::send_allocation_in_new_tlab_event(klass, obj, new_tlab_size * HeapWordSize, size * HeapWordSize, Thread::current());
290
291 if (ZeroTLAB) {
292 // ..and clear it.
293 Copy::zero_to_words(obj, new_tlab_size);
294 } else {
295 // ...and zap just allocated object.
296 #ifdef ASSERT
297 // Skip mangling the space corresponding to the object header to
298 // ensure that the returned space is not considered parsable by
299 // any concurrent GC thread.
300 size_t hdr_size = oopDesc::header_size();
301 Copy::fill_to_words(obj + hdr_size, new_tlab_size - hdr_size, badHeapWordVal);
302 #endif // ASSERT
303 }
304 thread->tlab().fill(obj, obj + size, new_tlab_size);
305 return obj;
306 }
307
308 void CollectedHeap::flush_deferred_store_barrier(JavaThread* thread) {
309 MemRegion deferred = thread->deferred_card_mark();
|