--- old/src/hotspot/share/gc/shared/collectedHeap.cpp 2018-04-23 13:45:35.160567870 +0200 +++ new/src/hotspot/share/gc/shared/collectedHeap.cpp 2018-04-23 13:45:34.800553668 +0200 @@ -368,17 +368,22 @@ return NULL; } - // Allocate a new TLAB... - HeapWord* obj = Universe::heap()->allocate_new_tlab(new_tlab_size); + // Allocate a new TLAB requesting new_tlab_size. Any size + // between minimal and new_tlab_size is accepted. + size_t actual_tlab_size = 0; + size_t minimal_tlab_size = MAX2(ThreadLocalAllocBuffer::compute_min_size(size), MinTLABSize); + HeapWord* obj = Universe::heap()->allocate_new_tlab(minimal_tlab_size, new_tlab_size, &actual_tlab_size); if (obj == NULL) { return NULL; } + assert(actual_tlab_size != 0, "Allocation succeeded but actual size not updated. obj at: " PTR_FORMAT " min: " SIZE_FORMAT ", desired: " SIZE_FORMAT, + p2i(obj), minimal_tlab_size, new_tlab_size); - AllocTracer::send_allocation_in_new_tlab(klass, obj, new_tlab_size * HeapWordSize, size * HeapWordSize, thread); + AllocTracer::send_allocation_in_new_tlab(klass, obj, actual_tlab_size * HeapWordSize, size * HeapWordSize, thread); if (ZeroTLAB) { // ..and clear it. - Copy::zero_to_words(obj, new_tlab_size); + Copy::zero_to_words(obj, actual_tlab_size); } else { // ...and zap just allocated object. #ifdef ASSERT @@ -386,10 +391,10 @@ // ensure that the returned space is not considered parsable by // any concurrent GC thread. size_t hdr_size = oopDesc::header_size(); - Copy::fill_to_words(obj + hdr_size, new_tlab_size - hdr_size, badHeapWordVal); + Copy::fill_to_words(obj + hdr_size, actual_tlab_size - hdr_size, badHeapWordVal); #endif // ASSERT } - thread->tlab().fill(obj, obj + size, new_tlab_size); + thread->tlab().fill(obj, obj + size, actual_tlab_size); return obj; } @@ -490,7 +495,9 @@ fill_with_object_impl(start, words, zap); } -HeapWord* CollectedHeap::allocate_new_tlab(size_t size) { +HeapWord* CollectedHeap::allocate_new_tlab(size_t min_word_size, + size_t desired_word_size, + size_t* actual_word_size) { guarantee(false, "thread-local allocation buffers not supported"); return NULL; }