7141
7142 size_t SweepClosure::do_blk_careful(HeapWord* addr) {
7143 FreeChunk* fc = (FreeChunk*)addr;
7144 size_t res;
7145
7146 // Check if we are done sweeping. Below we check "addr >= _limit" rather
7147 // than "addr == _limit" because although _limit was a block boundary when
7148 // we started the sweep, it may no longer be one because heap expansion
7149 // may have caused us to coalesce the block ending at the address _limit
7150 // with a newly expanded chunk (this happens when _limit was set to the
7151 // previous _end of the space), so we may have stepped past _limit:
7152 // see the following Zeno-like trail of CRs 6977970, 7008136, 7042740.
7153 if (addr >= _limit) { // we have swept up to or past the limit: finish up
7154 assert(_limit >= _sp->bottom() && _limit <= _sp->end(),
7155 "sweep _limit out of bounds");
7156 assert(addr < _sp->end(), "addr out of bounds");
7157 // Flush any free range we might be holding as a single
7158 // coalesced chunk to the appropriate free list.
7159 if (inFreeRange()) {
7160 assert(freeFinger() >= _sp->bottom() && freeFinger() < _limit,
7161 "freeFinger() " PTR_FORMAT " is out-of-bounds", p2i(freeFinger()));
7162 flush_cur_free_chunk(freeFinger(),
7163 pointer_delta(addr, freeFinger()));
7164 log_develop_trace(gc, sweep)("Sweep: last chunk: put_free_blk " PTR_FORMAT " (" SIZE_FORMAT ") [coalesced:%d]",
7165 p2i(freeFinger()), pointer_delta(addr, freeFinger()),
7166 lastFreeRangeCoalesced() ? 1 : 0);
7167 }
7168
7169 // help the iterator loop finish
7170 return pointer_delta(_sp->end(), addr);
7171 }
7172
7173 assert(addr < _limit, "sweep invariant");
7174 // check if we should yield
7175 do_yield_check(addr);
7176 if (fc->is_free()) {
7177 // Chunk that is already free
7178 res = fc->size();
7179 do_already_free_chunk(fc);
7180 debug_only(_sp->verifyFreeLists());
7181 // If we flush the chunk at hand in lookahead_and_flush()
|
7141
7142 size_t SweepClosure::do_blk_careful(HeapWord* addr) {
7143 FreeChunk* fc = (FreeChunk*)addr;
7144 size_t res;
7145
7146 // Check if we are done sweeping. Below we check "addr >= _limit" rather
7147 // than "addr == _limit" because although _limit was a block boundary when
7148 // we started the sweep, it may no longer be one because heap expansion
7149 // may have caused us to coalesce the block ending at the address _limit
7150 // with a newly expanded chunk (this happens when _limit was set to the
7151 // previous _end of the space), so we may have stepped past _limit:
7152 // see the following Zeno-like trail of CRs 6977970, 7008136, 7042740.
7153 if (addr >= _limit) { // we have swept up to or past the limit: finish up
7154 assert(_limit >= _sp->bottom() && _limit <= _sp->end(),
7155 "sweep _limit out of bounds");
7156 assert(addr < _sp->end(), "addr out of bounds");
7157 // Flush any free range we might be holding as a single
7158 // coalesced chunk to the appropriate free list.
7159 if (inFreeRange()) {
7160 assert(freeFinger() >= _sp->bottom() && freeFinger() < _limit,
7161 "freeFinger() " PTR_FORMAT " is out of bounds", p2i(freeFinger()));
7162 flush_cur_free_chunk(freeFinger(),
7163 pointer_delta(addr, freeFinger()));
7164 log_develop_trace(gc, sweep)("Sweep: last chunk: put_free_blk " PTR_FORMAT " (" SIZE_FORMAT ") [coalesced:%d]",
7165 p2i(freeFinger()), pointer_delta(addr, freeFinger()),
7166 lastFreeRangeCoalesced() ? 1 : 0);
7167 }
7168
7169 // help the iterator loop finish
7170 return pointer_delta(_sp->end(), addr);
7171 }
7172
7173 assert(addr < _limit, "sweep invariant");
7174 // check if we should yield
7175 do_yield_check(addr);
7176 if (fc->is_free()) {
7177 // Chunk that is already free
7178 res = fc->size();
7179 do_already_free_chunk(fc);
7180 debug_only(_sp->verifyFreeLists());
7181 // If we flush the chunk at hand in lookahead_and_flush()
|