hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
changeset 30274 0942042b7d7c
parent 30261 faa43d41b739
child 30275 41fef3a62cc8
equal deleted inserted replaced
30271:97a537c6526e 30274:0942042b7d7c
    32 #include "gc_implementation/shared/copyFailedInfo.hpp"
    32 #include "gc_implementation/shared/copyFailedInfo.hpp"
    33 #include "gc_implementation/shared/gcHeapSummary.hpp"
    33 #include "gc_implementation/shared/gcHeapSummary.hpp"
    34 #include "gc_implementation/shared/gcTimer.hpp"
    34 #include "gc_implementation/shared/gcTimer.hpp"
    35 #include "gc_implementation/shared/gcTrace.hpp"
    35 #include "gc_implementation/shared/gcTrace.hpp"
    36 #include "gc_implementation/shared/gcTraceTime.hpp"
    36 #include "gc_implementation/shared/gcTraceTime.hpp"
    37 #include "gc_implementation/shared/plab.inline.hpp"
    37 #include "gc_implementation/shared/parGCAllocBuffer.inline.hpp"
    38 #include "gc_implementation/shared/spaceDecorator.hpp"
    38 #include "gc_implementation/shared/spaceDecorator.hpp"
    39 #include "memory/defNewGeneration.inline.hpp"
    39 #include "memory/defNewGeneration.inline.hpp"
    40 #include "memory/genCollectedHeap.hpp"
    40 #include "memory/genCollectedHeap.hpp"
    41 #include "memory/genOopClosures.inline.hpp"
    41 #include "memory/genOopClosures.inline.hpp"
    42 #include "memory/generation.hpp"
    42 #include "memory/generation.hpp"
   224 
   224 
   225   // Otherwise, if the object is small enough, try to reallocate the
   225   // Otherwise, if the object is small enough, try to reallocate the
   226   // buffer.
   226   // buffer.
   227   HeapWord* obj = NULL;
   227   HeapWord* obj = NULL;
   228   if (!_to_space_full) {
   228   if (!_to_space_full) {
   229     PLAB* const plab = to_space_alloc_buffer();
   229     ParGCAllocBuffer* const plab = to_space_alloc_buffer();
   230     Space*            const sp   = to_space();
   230     Space*            const sp   = to_space();
   231     if (word_sz * 100 <
   231     if (word_sz * 100 <
   232         ParallelGCBufferWastePct * plab->word_sz()) {
   232         ParallelGCBufferWastePct * plab->word_sz()) {
   233       // Is small enough; abandon this buffer and start a new one.
   233       // Is small enough; abandon this buffer and start a new one.
   234       plab->retire();
   234       plab->retire();
   235       size_t buf_size = plab->word_sz();
   235       size_t buf_size = plab->word_sz();
   236       HeapWord* buf_space = sp->par_allocate(buf_size);
   236       HeapWord* buf_space = sp->par_allocate(buf_size);
   237       if (buf_space == NULL) {
   237       if (buf_space == NULL) {
   238         const size_t min_bytes =
   238         const size_t min_bytes =
   239           PLAB::min_size() << LogHeapWordSize;
   239           ParGCAllocBuffer::min_size() << LogHeapWordSize;
   240         size_t free_bytes = sp->free();
   240         size_t free_bytes = sp->free();
   241         while(buf_space == NULL && free_bytes >= min_bytes) {
   241         while(buf_space == NULL && free_bytes >= min_bytes) {
   242           buf_size = free_bytes >> LogHeapWordSize;
   242           buf_size = free_bytes >> LogHeapWordSize;
   243           assert(buf_size == (size_t)align_object_size(buf_size),
   243           assert(buf_size == (size_t)align_object_size(buf_size),
   244                  "Invariant");
   244                  "Invariant");
   250         plab->set_word_size(buf_size);
   250         plab->set_word_size(buf_size);
   251         plab->set_buf(buf_space);
   251         plab->set_buf(buf_space);
   252         record_survivor_plab(buf_space, buf_size);
   252         record_survivor_plab(buf_space, buf_size);
   253         obj = plab->allocate_aligned(word_sz, SurvivorAlignmentInBytes);
   253         obj = plab->allocate_aligned(word_sz, SurvivorAlignmentInBytes);
   254         // Note that we cannot compare buf_size < word_sz below
   254         // Note that we cannot compare buf_size < word_sz below
   255         // because of AlignmentReserve (see PLAB::allocate()).
   255         // because of AlignmentReserve (see ParGCAllocBuffer::allocate()).
   256         assert(obj != NULL || plab->words_remaining() < word_sz,
   256         assert(obj != NULL || plab->words_remaining() < word_sz,
   257                "Else should have been able to allocate");
   257                "Else should have been able to allocate");
   258         // It's conceivable that we may be able to use the
   258         // It's conceivable that we may be able to use the
   259         // buffer we just grabbed for subsequent small requests
   259         // buffer we just grabbed for subsequent small requests
   260         // even if not for this one.
   260         // even if not for this one.