< prev index next >

src/share/vm/gc_implementation/g1/g1Allocator.cpp

Print this page
rev 7471 : 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
Summary: Evaluate and improve object copy time by micro-optimizations and splitting out slow and fast paths aggressively.
Reviewed-by:
Contributed-by: Tony Printezis <tprintezis@twitter.com>, Thomas Schatzl <thomas.schatzl@oracle.com>
rev 7472 : [mq]: 8060025-mikael-review1


 133     HeapWord* const obj = alloc_buf->allocate(word_sz);
 134     assert(obj != NULL, "buffer was definitely big enough...");
 135     return obj;
 136   } else {
 137     return _g1h->par_allocate_during_gc(dest, word_sz, context);
 138   }
 139 }
 140 
 141 G1DefaultParGCAllocator::G1DefaultParGCAllocator(G1CollectedHeap* g1h) :
 142   G1ParGCAllocator(g1h),
 143   _surviving_alloc_buffer(g1h->desired_plab_sz(InCSetState::Young)),
 144   _tenured_alloc_buffer(g1h->desired_plab_sz(InCSetState::Old)) {
 145   for (uint i = 0; i < InCSetState::Num; i += 1) {
 146     _alloc_buffers[i] = NULL;
 147   }
 148   _alloc_buffers[InCSetState::Young] = &_surviving_alloc_buffer;
 149   _alloc_buffers[InCSetState::Old]  = &_tenured_alloc_buffer;
 150 }
 151 
 152 void G1DefaultParGCAllocator::retire_alloc_buffers() {
 153   for (uint i = 0; i < InCSetState::Num; i += 1) {
 154     G1ParGCAllocBuffer* const buf = _alloc_buffers[i];
 155     if (buf != NULL) {
 156       add_to_alloc_buffer_waste(buf->words_remaining());
 157       buf->flush_stats_and_retire(_g1h->alloc_buffer_stats(i),
 158                                   true /* end_of_gc */,
 159                                   false /* retain */);
 160     }
 161   }
 162 }


 133     HeapWord* const obj = alloc_buf->allocate(word_sz);
 134     assert(obj != NULL, "buffer was definitely big enough...");
 135     return obj;
 136   } else {
 137     return _g1h->par_allocate_during_gc(dest, word_sz, context);
 138   }
 139 }
 140 
 141 G1DefaultParGCAllocator::G1DefaultParGCAllocator(G1CollectedHeap* g1h) :
 142   G1ParGCAllocator(g1h),
 143   _surviving_alloc_buffer(g1h->desired_plab_sz(InCSetState::Young)),
 144   _tenured_alloc_buffer(g1h->desired_plab_sz(InCSetState::Old)) {
 145   for (uint i = 0; i < InCSetState::Num; i += 1) {
 146     _alloc_buffers[i] = NULL;
 147   }
 148   _alloc_buffers[InCSetState::Young] = &_surviving_alloc_buffer;
 149   _alloc_buffers[InCSetState::Old]  = &_tenured_alloc_buffer;
 150 }
 151 
 152 void G1DefaultParGCAllocator::retire_alloc_buffers() {
 153   for (uint state = 0; state < InCSetState::Num; state += 1) {
 154     G1ParGCAllocBuffer* const buf = _alloc_buffers[state];
 155     if (buf != NULL) {
 156       add_to_alloc_buffer_waste(buf->words_remaining());
 157       buf->flush_stats_and_retire(_g1h->alloc_buffer_stats(state),
 158                                   true /* end_of_gc */,
 159                                   false /* retain */);
 160     }
 161   }
 162 }
< prev index next >