< prev index next >

src/share/vm/gc/cms/compactibleFreeListSpace.cpp

Print this page

        

*** 574,584 **** addChunkToFreeListsAtEndRecordingStats(prevEnd, newFcSize); } } } ! class FreeListSpace_DCTOC : public Filtering_DCTOC { CompactibleFreeListSpace* _cfls; CMSCollector* _collector; bool _parallel; protected: // Override. --- 574,584 ---- addChunkToFreeListsAtEndRecordingStats(prevEnd, newFcSize); } } } ! class FreeListSpaceDCTOC : public FilteringDCTOC { CompactibleFreeListSpace* _cfls; CMSCollector* _collector; bool _parallel; protected: // Override.
*** 594,628 **** ClosureType* cl) walk_mem_region_with_cl_DECL(ExtendedOopClosure); walk_mem_region_with_cl_DECL(FilteringClosure); public: ! FreeListSpace_DCTOC(CompactibleFreeListSpace* sp, CMSCollector* collector, ExtendedOopClosure* cl, CardTableModRefBS::PrecisionStyle precision, HeapWord* boundary, bool parallel) : ! Filtering_DCTOC(sp, cl, precision, boundary), _cfls(sp), _collector(collector), _parallel(parallel) {} }; // We de-virtualize the block-related calls below, since we know that our // space is a CompactibleFreeListSpace. ! #define FreeListSpace_DCTOC__walk_mem_region_with_cl_DEFN(ClosureType) \ ! void FreeListSpace_DCTOC::walk_mem_region_with_cl(MemRegion mr, \ HeapWord* bottom, \ HeapWord* top, \ ClosureType* cl) { \ if (_parallel) { \ walk_mem_region_with_cl_par(mr, bottom, top, cl); \ } else { \ walk_mem_region_with_cl_nopar(mr, bottom, top, cl); \ } \ } \ ! void FreeListSpace_DCTOC::walk_mem_region_with_cl_par(MemRegion mr, \ HeapWord* bottom, \ HeapWord* top, \ ClosureType* cl) { \ /* Skip parts that are before "mr", in case "block_start" sent us \ back too far. */ \ --- 594,628 ---- ClosureType* cl) walk_mem_region_with_cl_DECL(ExtendedOopClosure); walk_mem_region_with_cl_DECL(FilteringClosure); public: ! FreeListSpaceDCTOC(CompactibleFreeListSpace* sp, CMSCollector* collector, ExtendedOopClosure* cl, CardTableModRefBS::PrecisionStyle precision, HeapWord* boundary, bool parallel) : ! FilteringDCTOC(sp, cl, precision, boundary), _cfls(sp), _collector(collector), _parallel(parallel) {} }; // We de-virtualize the block-related calls below, since we know that our // space is a CompactibleFreeListSpace. ! #define FreeListSpaceDCTOC__walk_mem_region_with_cl_DEFN(ClosureType) \ ! void FreeListSpaceDCTOC::walk_mem_region_with_cl(MemRegion mr, \ HeapWord* bottom, \ HeapWord* top, \ ClosureType* cl) { \ if (_parallel) { \ walk_mem_region_with_cl_par(mr, bottom, top, cl); \ } else { \ walk_mem_region_with_cl_nopar(mr, bottom, top, cl); \ } \ } \ ! void FreeListSpaceDCTOC::walk_mem_region_with_cl_par(MemRegion mr, \ HeapWord* bottom, \ HeapWord* top, \ ClosureType* cl) { \ /* Skip parts that are before "mr", in case "block_start" sent us \ back too far. */ \
*** 645,655 **** } else { \ bottom += _cfls->CompactibleFreeListSpace::block_size(bottom); \ } \ } \ } \ ! void FreeListSpace_DCTOC::walk_mem_region_with_cl_nopar(MemRegion mr, \ HeapWord* bottom, \ HeapWord* top, \ ClosureType* cl) { \ /* Skip parts that are before "mr", in case "block_start" sent us \ back too far. */ \ --- 645,655 ---- } else { \ bottom += _cfls->CompactibleFreeListSpace::block_size(bottom); \ } \ } \ } \ ! void FreeListSpaceDCTOC::walk_mem_region_with_cl_nopar(MemRegion mr, \ HeapWord* bottom, \ HeapWord* top, \ ClosureType* cl) { \ /* Skip parts that are before "mr", in case "block_start" sent us \ back too far. */ \
*** 676,694 **** } // (There are only two of these, rather than N, because the split is due // only to the introduction of the FilteringClosure, a local part of the // impl of this abstraction.) ! FreeListSpace_DCTOC__walk_mem_region_with_cl_DEFN(ExtendedOopClosure) ! FreeListSpace_DCTOC__walk_mem_region_with_cl_DEFN(FilteringClosure) DirtyCardToOopClosure* CompactibleFreeListSpace::new_dcto_cl(ExtendedOopClosure* cl, CardTableModRefBS::PrecisionStyle precision, HeapWord* boundary, bool parallel) { ! return new FreeListSpace_DCTOC(this, _collector, cl, precision, boundary, parallel); } // Note on locking for the space iteration functions: // since the collector's iteration activities are concurrent with --- 676,694 ---- } // (There are only two of these, rather than N, because the split is due // only to the introduction of the FilteringClosure, a local part of the // impl of this abstraction.) ! FreeListSpaceDCTOC__walk_mem_region_with_cl_DEFN(ExtendedOopClosure) ! FreeListSpaceDCTOC__walk_mem_region_with_cl_DEFN(FilteringClosure) DirtyCardToOopClosure* CompactibleFreeListSpace::new_dcto_cl(ExtendedOopClosure* cl, CardTableModRefBS::PrecisionStyle precision, HeapWord* boundary, bool parallel) { ! return new FreeListSpaceDCTOC(this, _collector, cl, precision, boundary, parallel); } // Note on locking for the space iteration functions: // since the collector's iteration activities are concurrent with
*** 2411,2421 **** (double)(total.desired() - total.count())/(total.desired() != 0 ? (double)total.desired() : 1.0)); _dictionary->print_dict_census(out); } /////////////////////////////////////////////////////////////////////////// ! // CFLS_LAB /////////////////////////////////////////////////////////////////////////// #define VECTOR_257(x) \ /* 1 2 3 4 5 6 7 8 9 1x 11 12 13 14 15 16 17 18 19 2x 21 22 23 24 25 26 27 28 29 3x 31 32 */ \ { x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, \ --- 2411,2421 ---- (double)(total.desired() - total.count())/(total.desired() != 0 ? (double)total.desired() : 1.0)); _dictionary->print_dict_census(out); } /////////////////////////////////////////////////////////////////////////// ! // CompactibleFreeListSpaceLAB /////////////////////////////////////////////////////////////////////////// #define VECTOR_257(x) \ /* 1 2 3 4 5 6 7 8 9 1x 11 12 13 14 15 16 17 18 19 2x 21 22 23 24 25 26 27 28 29 3x 31 32 */ \ { x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, \
*** 2430,2445 **** // Initialize with default setting for CMS, _not_ // generic OldPLABSize, whose static default is different; if overridden at the // command-line, this will get reinitialized via a call to // modify_initialization() below. ! AdaptiveWeightedAverage CFLS_LAB::_blocks_to_claim[] = ! VECTOR_257(AdaptiveWeightedAverage(OldPLABWeight, (float)CFLS_LAB::_default_dynamic_old_plab_size)); ! size_t CFLS_LAB::_global_num_blocks[] = VECTOR_257(0); ! uint CFLS_LAB::_global_num_workers[] = VECTOR_257(0); ! CFLS_LAB::CFLS_LAB(CompactibleFreeListSpace* cfls) : _cfls(cfls) { assert(CompactibleFreeListSpace::IndexSetSize == 257, "Modify VECTOR_257() macro above"); for (size_t i = CompactibleFreeListSpace::IndexSetStart; i < CompactibleFreeListSpace::IndexSetSize; --- 2430,2445 ---- // Initialize with default setting for CMS, _not_ // generic OldPLABSize, whose static default is different; if overridden at the // command-line, this will get reinitialized via a call to // modify_initialization() below. ! AdaptiveWeightedAverage CompactibleFreeListSpaceLAB::_blocks_to_claim[] = ! VECTOR_257(AdaptiveWeightedAverage(OldPLABWeight, (float)CompactibleFreeListSpaceLAB::_default_dynamic_old_plab_size)); ! size_t CompactibleFreeListSpaceLAB::_global_num_blocks[] = VECTOR_257(0); ! uint CompactibleFreeListSpaceLAB::_global_num_workers[] = VECTOR_257(0); ! CompactibleFreeListSpaceLAB::CompactibleFreeListSpaceLAB(CompactibleFreeListSpace* cfls) : _cfls(cfls) { assert(CompactibleFreeListSpace::IndexSetSize == 257, "Modify VECTOR_257() macro above"); for (size_t i = CompactibleFreeListSpace::IndexSetStart; i < CompactibleFreeListSpace::IndexSetSize;
*** 2449,2469 **** } } static bool _CFLS_LAB_modified = false; ! void CFLS_LAB::modify_initialization(size_t n, unsigned wt) { assert(!_CFLS_LAB_modified, "Call only once"); _CFLS_LAB_modified = true; for (size_t i = CompactibleFreeListSpace::IndexSetStart; i < CompactibleFreeListSpace::IndexSetSize; i += CompactibleFreeListSpace::IndexSetStride) { _blocks_to_claim[i].modify(n, wt, true /* force */); } } ! HeapWord* CFLS_LAB::alloc(size_t word_sz) { FreeChunk* res; assert(word_sz == _cfls->adjustObjectSize(word_sz), "Error"); if (word_sz >= CompactibleFreeListSpace::IndexSetSize) { // This locking manages sync with other large object allocations. MutexLockerEx x(_cfls->parDictionaryAllocLock(), --- 2449,2469 ---- } } static bool _CFLS_LAB_modified = false; ! void CompactibleFreeListSpaceLAB::modify_initialization(size_t n, unsigned wt) { assert(!_CFLS_LAB_modified, "Call only once"); _CFLS_LAB_modified = true; for (size_t i = CompactibleFreeListSpace::IndexSetStart; i < CompactibleFreeListSpace::IndexSetSize; i += CompactibleFreeListSpace::IndexSetStride) { _blocks_to_claim[i].modify(n, wt, true /* force */); } } ! HeapWord* CompactibleFreeListSpaceLAB::alloc(size_t word_sz) { FreeChunk* res; assert(word_sz == _cfls->adjustObjectSize(word_sz), "Error"); if (word_sz >= CompactibleFreeListSpace::IndexSetSize) { // This locking manages sync with other large object allocations. MutexLockerEx x(_cfls->parDictionaryAllocLock(),
*** 2489,2499 **** return (HeapWord*)res; } // Get a chunk of blocks of the right size and update related // book-keeping stats ! void CFLS_LAB::get_from_global_pool(size_t word_sz, AdaptiveFreeList<FreeChunk>* fl) { // Get the #blocks we want to claim size_t n_blks = (size_t)_blocks_to_claim[word_sz].average(); assert(n_blks > 0, "Error"); assert(ResizeOldPLAB || n_blks == OldPLABSize, "Error"); // In some cases, when the application has a phase change, --- 2489,2499 ---- return (HeapWord*)res; } // Get a chunk of blocks of the right size and update related // book-keeping stats ! void CompactibleFreeListSpaceLAB::get_from_global_pool(size_t word_sz, AdaptiveFreeList<FreeChunk>* fl) { // Get the #blocks we want to claim size_t n_blks = (size_t)_blocks_to_claim[word_sz].average(); assert(n_blks > 0, "Error"); assert(ResizeOldPLAB || n_blks == OldPLABSize, "Error"); // In some cases, when the application has a phase change,
*** 2523,2533 **** _cfls->par_get_chunk_of_blocks(word_sz, n_blks, fl); // Update stats table entry for this block size _num_blocks[word_sz] += fl->count(); } ! void CFLS_LAB::compute_desired_plab_size() { for (size_t i = CompactibleFreeListSpace::IndexSetStart; i < CompactibleFreeListSpace::IndexSetSize; i += CompactibleFreeListSpace::IndexSetStride) { assert((_global_num_workers[i] == 0) == (_global_num_blocks[i] == 0), "Counter inconsistency"); --- 2523,2533 ---- _cfls->par_get_chunk_of_blocks(word_sz, n_blks, fl); // Update stats table entry for this block size _num_blocks[word_sz] += fl->count(); } ! void CompactibleFreeListSpaceLAB::compute_desired_plab_size() { for (size_t i = CompactibleFreeListSpace::IndexSetStart; i < CompactibleFreeListSpace::IndexSetSize; i += CompactibleFreeListSpace::IndexSetStride) { assert((_global_num_workers[i] == 0) == (_global_num_blocks[i] == 0), "Counter inconsistency");
*** 2549,2559 **** // If this is changed in the future to allow parallel // access, one would need to take the FL locks and, // depending on how it is used, stagger access from // parallel threads to reduce contention. ! void CFLS_LAB::retire(int tid) { // We run this single threaded with the world stopped; // so no need for locks and such. NOT_PRODUCT(Thread* t = Thread::current();) assert(Thread::current()->is_VM_thread(), "Error"); for (size_t i = CompactibleFreeListSpace::IndexSetStart; --- 2549,2559 ---- // If this is changed in the future to allow parallel // access, one would need to take the FL locks and, // depending on how it is used, stagger access from // parallel threads to reduce contention. ! void CompactibleFreeListSpaceLAB::retire(int tid) { // We run this single threaded with the world stopped; // so no need for locks and such. NOT_PRODUCT(Thread* t = Thread::current();) assert(Thread::current()->is_VM_thread(), "Error"); for (size_t i = CompactibleFreeListSpace::IndexSetStart;
< prev index next >