equal
deleted
inserted
replaced
7346 set_inFreeRange(true); |
7346 set_inFreeRange(true); |
7347 set_lastFreeRangeCoalesced(false); |
7347 set_lastFreeRangeCoalesced(false); |
7348 |
7348 |
7349 set_freeFinger(freeFinger); |
7349 set_freeFinger(freeFinger); |
7350 set_freeRangeInFreeLists(freeRangeInFreeLists); |
7350 set_freeRangeInFreeLists(freeRangeInFreeLists); |
|
7351 if (CMSTestInFreeList) { |
|
7352 if (freeRangeInFreeLists) { |
|
7353 FreeChunk* fc = (FreeChunk*) freeFinger; |
|
7354 assert(fc->is_free(), "A chunk on the free list should be free."); |
|
7355 assert(fc->size() > 0, "Free range should have a size"); |
|
7356 assert(_sp->verify_chunk_in_free_list(fc), "Chunk is not in free lists"); |
|
7357 } |
|
7358 } |
7351 } |
7359 } |
7352 |
7360 |
7353 // Note that the sweeper runs concurrently with mutators. Thus, |
7361 // Note that the sweeper runs concurrently with mutators. Thus, |
7354 // it is possible for direct allocation in this generation to happen |
7362 // it is possible for direct allocation in this generation to happen |
7355 // in the middle of the sweep. Note that the sweeper also coalesces |
7363 // in the middle of the sweep. Note that the sweeper also coalesces |
7498 // to a free list which may be overpopulated. |
7506 // to a free list which may be overpopulated. |
7499 // |
7507 // |
7500 |
7508 |
7501 void SweepClosure::do_already_free_chunk(FreeChunk* fc) { |
7509 void SweepClosure::do_already_free_chunk(FreeChunk* fc) { |
7502 const size_t size = fc->size(); |
7510 const size_t size = fc->size(); |
7503 |
7511 // Chunks that cannot be coalesced are not in the |
|
7512 // free lists. |
|
7513 if (CMSTestInFreeList && !fc->cantCoalesce()) { |
|
7514 assert(_sp->verify_chunk_in_free_list(fc), |
|
7515 "free chunk should be in free lists"); |
|
7516 } |
7504 // a chunk that is already free, should not have been |
7517 // a chunk that is already free, should not have been |
7505 // marked in the bit map |
7518 // marked in the bit map |
7506 HeapWord* const addr = (HeapWord*) fc; |
7519 HeapWord* const addr = (HeapWord*) fc; |
7507 assert(!_bitMap->isMarked(addr), "free chunk should be unmarked"); |
7520 assert(!_bitMap->isMarked(addr), "free chunk should be unmarked"); |
7508 // Verify that the bit map has no bits marked between |
7521 // Verify that the bit map has no bits marked between |
7605 size_t chunkSize) { |
7618 size_t chunkSize) { |
7606 // do_post_free_or_garbage_chunk() should only be called in the case |
7619 // do_post_free_or_garbage_chunk() should only be called in the case |
7607 // of the adaptive free list allocator. |
7620 // of the adaptive free list allocator. |
7608 const bool fcInFreeLists = fc->is_free(); |
7621 const bool fcInFreeLists = fc->is_free(); |
7609 assert((HeapWord*)fc <= _limit, "sweep invariant"); |
7622 assert((HeapWord*)fc <= _limit, "sweep invariant"); |
|
7623 if (CMSTestInFreeList && fcInFreeLists) { |
|
7624 assert(_sp->verify_chunk_in_free_list(fc), "free chunk is not in free lists"); |
|
7625 } |
7610 |
7626 |
7611 if (CMSTraceSweeper) { |
7627 if (CMSTraceSweeper) { |
7612 gclog_or_tty->print_cr(" -- pick up another chunk at " PTR_FORMAT " (" SIZE_FORMAT ")", p2i(fc), chunkSize); |
7628 gclog_or_tty->print_cr(" -- pick up another chunk at " PTR_FORMAT " (" SIZE_FORMAT ")", p2i(fc), chunkSize); |
7613 } |
7629 } |
7614 |
7630 |
7656 // chunk on the right. If either is on a free list, |
7672 // chunk on the right. If either is on a free list, |
7657 // it must be removed from the list and stashed in the closure. |
7673 // it must be removed from the list and stashed in the closure. |
7658 if (freeRangeInFreeLists()) { |
7674 if (freeRangeInFreeLists()) { |
7659 FreeChunk* const ffc = (FreeChunk*)freeFinger(); |
7675 FreeChunk* const ffc = (FreeChunk*)freeFinger(); |
7660 assert(ffc->size() == pointer_delta(fc_addr, freeFinger()), |
7676 assert(ffc->size() == pointer_delta(fc_addr, freeFinger()), |
7661 "Size of free range is inconsistent with chunk size."); |
7677 "Size of free range is inconsistent with chunk size."); |
|
7678 if (CMSTestInFreeList) { |
|
7679 assert(_sp->verify_chunk_in_free_list(ffc), |
|
7680 "Chunk is not in free lists"); |
|
7681 } |
7662 _sp->coalDeath(ffc->size()); |
7682 _sp->coalDeath(ffc->size()); |
7663 _sp->removeFreeChunkFromFreeLists(ffc); |
7683 _sp->removeFreeChunkFromFreeLists(ffc); |
7664 set_freeRangeInFreeLists(false); |
7684 set_freeRangeInFreeLists(false); |
7665 } |
7685 } |
7666 if (fcInFreeLists) { |
7686 if (fcInFreeLists) { |
7725 void SweepClosure::flush_cur_free_chunk(HeapWord* chunk, size_t size) { |
7745 void SweepClosure::flush_cur_free_chunk(HeapWord* chunk, size_t size) { |
7726 assert(inFreeRange(), "Should only be called if currently in a free range."); |
7746 assert(inFreeRange(), "Should only be called if currently in a free range."); |
7727 assert(size > 0, |
7747 assert(size > 0, |
7728 "A zero sized chunk cannot be added to the free lists."); |
7748 "A zero sized chunk cannot be added to the free lists."); |
7729 if (!freeRangeInFreeLists()) { |
7749 if (!freeRangeInFreeLists()) { |
|
7750 if (CMSTestInFreeList) { |
|
7751 FreeChunk* fc = (FreeChunk*) chunk; |
|
7752 fc->set_size(size); |
|
7753 assert(!_sp->verify_chunk_in_free_list(fc), |
|
7754 "chunk should not be in free lists yet"); |
|
7755 } |
7730 if (CMSTraceSweeper) { |
7756 if (CMSTraceSweeper) { |
7731 gclog_or_tty->print_cr(" -- add free block " PTR_FORMAT " (" SIZE_FORMAT ") to free lists", |
7757 gclog_or_tty->print_cr(" -- add free block " PTR_FORMAT " (" SIZE_FORMAT ") to free lists", |
7732 p2i(chunk), size); |
7758 p2i(chunk), size); |
7733 } |
7759 } |
7734 // A new free range is going to be starting. The current |
7760 // A new free range is going to be starting. The current |