Tue, 08 Aug 2017 15:57:29 +0800
merge
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. |
aoqi@0 | 8 | * |
aoqi@0 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 13 | * accompanied this code). |
aoqi@0 | 14 | * |
aoqi@0 | 15 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 18 | * |
aoqi@0 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 20 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 21 | * questions. |
aoqi@0 | 22 | * |
aoqi@0 | 23 | */ |
aoqi@0 | 24 | |
aoqi@0 | 25 | #include "precompiled.hpp" |
aoqi@0 | 26 | #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp" |
aoqi@0 | 27 | #include "gc_implementation/concurrentMarkSweep/promotionInfo.hpp" |
aoqi@0 | 28 | #include "oops/markOop.inline.hpp" |
aoqi@0 | 29 | #include "oops/oop.inline.hpp" |
aoqi@0 | 30 | |
aoqi@0 | 31 | PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC |
aoqi@0 | 32 | |
aoqi@0 | 33 | ///////////////////////////////////////////////////////////////////////// |
aoqi@0 | 34 | //// PromotionInfo |
aoqi@0 | 35 | ///////////////////////////////////////////////////////////////////////// |
aoqi@0 | 36 | |
aoqi@0 | 37 | |
aoqi@0 | 38 | ////////////////////////////////////////////////////////////////////////////// |
aoqi@0 | 39 | // We go over the list of promoted objects, removing each from the list, |
aoqi@0 | 40 | // and applying the closure (this may, in turn, add more elements to |
aoqi@0 | 41 | // the tail of the promoted list, and these newly added objects will |
aoqi@0 | 42 | // also be processed) until the list is empty. |
aoqi@0 | 43 | // To aid verification and debugging, in the non-product builds |
aoqi@0 | 44 | // we actually forward _promoHead each time we process a promoted oop. |
aoqi@0 | 45 | // Note that this is not necessary in general (i.e. when we don't need to |
aoqi@0 | 46 | // call PromotionInfo::verify()) because oop_iterate can only add to the |
aoqi@0 | 47 | // end of _promoTail, and never needs to look at _promoHead. |
aoqi@0 | 48 | |
aoqi@0 | 49 | #define PROMOTED_OOPS_ITERATE_DEFN(OopClosureType, nv_suffix) \ |
aoqi@0 | 50 | \ |
aoqi@0 | 51 | void PromotionInfo::promoted_oops_iterate##nv_suffix(OopClosureType* cl) { \ |
aoqi@0 | 52 | NOT_PRODUCT(verify()); \ |
aoqi@0 | 53 | PromotedObject *curObj, *nextObj; \ |
aoqi@0 | 54 | for (curObj = _promoHead; curObj != NULL; curObj = nextObj) { \ |
aoqi@0 | 55 | if ((nextObj = curObj->next()) == NULL) { \ |
aoqi@0 | 56 | /* protect ourselves against additions due to closure application \ |
aoqi@0 | 57 | below by resetting the list. */ \ |
aoqi@0 | 58 | assert(_promoTail == curObj, "Should have been the tail"); \ |
aoqi@0 | 59 | _promoHead = _promoTail = NULL; \ |
aoqi@0 | 60 | } \ |
aoqi@0 | 61 | if (curObj->hasDisplacedMark()) { \ |
aoqi@0 | 62 | /* restore displaced header */ \ |
aoqi@0 | 63 | oop(curObj)->set_mark(nextDisplacedHeader()); \ |
aoqi@0 | 64 | } else { \ |
aoqi@0 | 65 | /* restore prototypical header */ \ |
aoqi@0 | 66 | oop(curObj)->init_mark(); \ |
aoqi@0 | 67 | } \ |
aoqi@0 | 68 | /* The "promoted_mark" should now not be set */ \ |
aoqi@0 | 69 | assert(!curObj->hasPromotedMark(), \ |
aoqi@0 | 70 | "Should have been cleared by restoring displaced mark-word"); \ |
aoqi@0 | 71 | NOT_PRODUCT(_promoHead = nextObj); \ |
aoqi@0 | 72 | if (cl != NULL) oop(curObj)->oop_iterate(cl); \ |
aoqi@0 | 73 | if (nextObj == NULL) { /* start at head of list reset above */ \ |
aoqi@0 | 74 | nextObj = _promoHead; \ |
aoqi@0 | 75 | } \ |
aoqi@0 | 76 | } \ |
aoqi@0 | 77 | assert(noPromotions(), "post-condition violation"); \ |
aoqi@0 | 78 | assert(_promoHead == NULL && _promoTail == NULL, "emptied promoted list");\ |
aoqi@0 | 79 | assert(_spoolHead == _spoolTail, "emptied spooling buffers"); \ |
aoqi@0 | 80 | assert(_firstIndex == _nextIndex, "empty buffer"); \ |
aoqi@0 | 81 | } |
aoqi@0 | 82 | |
aoqi@0 | 83 | // This should have been ALL_SINCE_...() just like the others, |
aoqi@0 | 84 | // but, because the body of the method above is somehwat longer, |
aoqi@0 | 85 | // the MSVC compiler cannot cope; as a workaround, we split the |
aoqi@0 | 86 | // macro into its 3 constituent parts below (see original macro |
aoqi@0 | 87 | // definition in specializedOopClosures.hpp). |
aoqi@0 | 88 | SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG(PROMOTED_OOPS_ITERATE_DEFN) |
aoqi@0 | 89 | PROMOTED_OOPS_ITERATE_DEFN(OopsInGenClosure,_v) |
aoqi@0 | 90 | |
aoqi@0 | 91 | |
aoqi@0 | 92 | // Return the next displaced header, incrementing the pointer and |
aoqi@0 | 93 | // recycling spool area as necessary. |
aoqi@0 | 94 | markOop PromotionInfo::nextDisplacedHeader() { |
aoqi@0 | 95 | assert(_spoolHead != NULL, "promotionInfo inconsistency"); |
aoqi@0 | 96 | assert(_spoolHead != _spoolTail || _firstIndex < _nextIndex, |
aoqi@0 | 97 | "Empty spool space: no displaced header can be fetched"); |
aoqi@0 | 98 | assert(_spoolHead->bufferSize > _firstIndex, "Off by one error at head?"); |
aoqi@0 | 99 | markOop hdr = _spoolHead->displacedHdr[_firstIndex]; |
aoqi@0 | 100 | // Spool forward |
aoqi@0 | 101 | if (++_firstIndex == _spoolHead->bufferSize) { // last location in this block |
aoqi@0 | 102 | // forward to next block, recycling this block into spare spool buffer |
aoqi@0 | 103 | SpoolBlock* tmp = _spoolHead->nextSpoolBlock; |
aoqi@0 | 104 | assert(_spoolHead != _spoolTail, "Spooling storage mix-up"); |
aoqi@0 | 105 | _spoolHead->nextSpoolBlock = _spareSpool; |
aoqi@0 | 106 | _spareSpool = _spoolHead; |
aoqi@0 | 107 | _spoolHead = tmp; |
aoqi@0 | 108 | _firstIndex = 1; |
aoqi@0 | 109 | NOT_PRODUCT( |
aoqi@0 | 110 | if (_spoolHead == NULL) { // all buffers fully consumed |
aoqi@0 | 111 | assert(_spoolTail == NULL && _nextIndex == 1, |
aoqi@0 | 112 | "spool buffers processing inconsistency"); |
aoqi@0 | 113 | } |
aoqi@0 | 114 | ) |
aoqi@0 | 115 | } |
aoqi@0 | 116 | return hdr; |
aoqi@0 | 117 | } |
aoqi@0 | 118 | |
aoqi@0 | 119 | void PromotionInfo::track(PromotedObject* trackOop) { |
aoqi@0 | 120 | track(trackOop, oop(trackOop)->klass()); |
aoqi@0 | 121 | } |
aoqi@0 | 122 | |
aoqi@0 | 123 | void PromotionInfo::track(PromotedObject* trackOop, Klass* klassOfOop) { |
aoqi@0 | 124 | // make a copy of header as it may need to be spooled |
aoqi@0 | 125 | markOop mark = oop(trackOop)->mark(); |
aoqi@0 | 126 | trackOop->clear_next(); |
aoqi@0 | 127 | if (mark->must_be_preserved_for_cms_scavenge(klassOfOop)) { |
aoqi@0 | 128 | // save non-prototypical header, and mark oop |
aoqi@0 | 129 | saveDisplacedHeader(mark); |
aoqi@0 | 130 | trackOop->setDisplacedMark(); |
aoqi@0 | 131 | } else { |
aoqi@0 | 132 | // we'd like to assert something like the following: |
aoqi@0 | 133 | // assert(mark == markOopDesc::prototype(), "consistency check"); |
aoqi@0 | 134 | // ... but the above won't work because the age bits have not (yet) been |
aoqi@0 | 135 | // cleared. The remainder of the check would be identical to the |
aoqi@0 | 136 | // condition checked in must_be_preserved() above, so we don't really |
aoqi@0 | 137 | // have anything useful to check here! |
aoqi@0 | 138 | } |
aoqi@0 | 139 | if (_promoTail != NULL) { |
aoqi@0 | 140 | assert(_promoHead != NULL, "List consistency"); |
aoqi@0 | 141 | _promoTail->setNext(trackOop); |
aoqi@0 | 142 | _promoTail = trackOop; |
aoqi@0 | 143 | } else { |
aoqi@0 | 144 | assert(_promoHead == NULL, "List consistency"); |
aoqi@0 | 145 | _promoHead = _promoTail = trackOop; |
aoqi@0 | 146 | } |
aoqi@0 | 147 | // Mask as newly promoted, so we can skip over such objects |
aoqi@0 | 148 | // when scanning dirty cards |
aoqi@0 | 149 | assert(!trackOop->hasPromotedMark(), "Should not have been marked"); |
aoqi@0 | 150 | trackOop->setPromotedMark(); |
aoqi@0 | 151 | } |
aoqi@0 | 152 | |
aoqi@0 | 153 | // Save the given displaced header, incrementing the pointer and |
aoqi@0 | 154 | // obtaining more spool area as necessary. |
aoqi@0 | 155 | void PromotionInfo::saveDisplacedHeader(markOop hdr) { |
aoqi@0 | 156 | assert(_spoolHead != NULL && _spoolTail != NULL, |
aoqi@0 | 157 | "promotionInfo inconsistency"); |
aoqi@0 | 158 | assert(_spoolTail->bufferSize > _nextIndex, "Off by one error at tail?"); |
aoqi@0 | 159 | _spoolTail->displacedHdr[_nextIndex] = hdr; |
aoqi@0 | 160 | // Spool forward |
aoqi@0 | 161 | if (++_nextIndex == _spoolTail->bufferSize) { // last location in this block |
aoqi@0 | 162 | // get a new spooling block |
aoqi@0 | 163 | assert(_spoolTail->nextSpoolBlock == NULL, "tail should terminate spool list"); |
aoqi@0 | 164 | _splice_point = _spoolTail; // save for splicing |
aoqi@0 | 165 | _spoolTail->nextSpoolBlock = getSpoolBlock(); // might fail |
aoqi@0 | 166 | _spoolTail = _spoolTail->nextSpoolBlock; // might become NULL ... |
aoqi@0 | 167 | // ... but will attempt filling before next promotion attempt |
aoqi@0 | 168 | _nextIndex = 1; |
aoqi@0 | 169 | } |
aoqi@0 | 170 | } |
aoqi@0 | 171 | |
aoqi@0 | 172 | // Ensure that spooling space exists. Return false if spooling space |
aoqi@0 | 173 | // could not be obtained. |
aoqi@0 | 174 | bool PromotionInfo::ensure_spooling_space_work() { |
aoqi@0 | 175 | assert(!has_spooling_space(), "Only call when there is no spooling space"); |
aoqi@0 | 176 | // Try and obtain more spooling space |
aoqi@0 | 177 | SpoolBlock* newSpool = getSpoolBlock(); |
aoqi@0 | 178 | assert(newSpool == NULL || |
aoqi@0 | 179 | (newSpool->bufferSize != 0 && newSpool->nextSpoolBlock == NULL), |
aoqi@0 | 180 | "getSpoolBlock() sanity check"); |
aoqi@0 | 181 | if (newSpool == NULL) { |
aoqi@0 | 182 | return false; |
aoqi@0 | 183 | } |
aoqi@0 | 184 | _nextIndex = 1; |
aoqi@0 | 185 | if (_spoolTail == NULL) { |
aoqi@0 | 186 | _spoolTail = newSpool; |
aoqi@0 | 187 | if (_spoolHead == NULL) { |
aoqi@0 | 188 | _spoolHead = newSpool; |
aoqi@0 | 189 | _firstIndex = 1; |
aoqi@0 | 190 | } else { |
aoqi@0 | 191 | assert(_splice_point != NULL && _splice_point->nextSpoolBlock == NULL, |
aoqi@0 | 192 | "Splice point invariant"); |
aoqi@0 | 193 | // Extra check that _splice_point is connected to list |
aoqi@0 | 194 | #ifdef ASSERT |
aoqi@0 | 195 | { |
aoqi@0 | 196 | SpoolBlock* blk = _spoolHead; |
aoqi@0 | 197 | for (; blk->nextSpoolBlock != NULL; |
aoqi@0 | 198 | blk = blk->nextSpoolBlock); |
aoqi@0 | 199 | assert(blk != NULL && blk == _splice_point, |
aoqi@0 | 200 | "Splice point incorrect"); |
aoqi@0 | 201 | } |
aoqi@0 | 202 | #endif // ASSERT |
aoqi@0 | 203 | _splice_point->nextSpoolBlock = newSpool; |
aoqi@0 | 204 | } |
aoqi@0 | 205 | } else { |
aoqi@0 | 206 | assert(_spoolHead != NULL, "spool list consistency"); |
aoqi@0 | 207 | _spoolTail->nextSpoolBlock = newSpool; |
aoqi@0 | 208 | _spoolTail = newSpool; |
aoqi@0 | 209 | } |
aoqi@0 | 210 | return true; |
aoqi@0 | 211 | } |
aoqi@0 | 212 | |
aoqi@0 | 213 | // Get a free spool buffer from the free pool, getting a new block |
aoqi@0 | 214 | // from the heap if necessary. |
aoqi@0 | 215 | SpoolBlock* PromotionInfo::getSpoolBlock() { |
aoqi@0 | 216 | SpoolBlock* res; |
aoqi@0 | 217 | if ((res = _spareSpool) != NULL) { |
aoqi@0 | 218 | _spareSpool = _spareSpool->nextSpoolBlock; |
aoqi@0 | 219 | res->nextSpoolBlock = NULL; |
aoqi@0 | 220 | } else { // spare spool exhausted, get some from heap |
aoqi@0 | 221 | res = (SpoolBlock*)(space()->allocateScratch(refillSize())); |
aoqi@0 | 222 | if (res != NULL) { |
aoqi@0 | 223 | res->init(); |
aoqi@0 | 224 | } |
aoqi@0 | 225 | } |
aoqi@0 | 226 | assert(res == NULL || res->nextSpoolBlock == NULL, "postcondition"); |
aoqi@0 | 227 | return res; |
aoqi@0 | 228 | } |
aoqi@0 | 229 | |
aoqi@0 | 230 | void PromotionInfo::startTrackingPromotions() { |
aoqi@0 | 231 | assert(_spoolHead == _spoolTail && _firstIndex == _nextIndex, |
aoqi@0 | 232 | "spooling inconsistency?"); |
aoqi@0 | 233 | _firstIndex = _nextIndex = 1; |
aoqi@0 | 234 | _tracking = true; |
aoqi@0 | 235 | } |
aoqi@0 | 236 | |
aoqi@0 | 237 | #define CMSPrintPromoBlockInfo 1 |
aoqi@0 | 238 | |
aoqi@0 | 239 | void PromotionInfo::stopTrackingPromotions(uint worker_id) { |
aoqi@0 | 240 | assert(_spoolHead == _spoolTail && _firstIndex == _nextIndex, |
aoqi@0 | 241 | "spooling inconsistency?"); |
aoqi@0 | 242 | _firstIndex = _nextIndex = 1; |
aoqi@0 | 243 | _tracking = false; |
aoqi@0 | 244 | if (CMSPrintPromoBlockInfo > 1) { |
aoqi@0 | 245 | print_statistics(worker_id); |
aoqi@0 | 246 | } |
aoqi@0 | 247 | } |
aoqi@0 | 248 | |
aoqi@0 | 249 | void PromotionInfo::print_statistics(uint worker_id) const { |
aoqi@0 | 250 | assert(_spoolHead == _spoolTail && _firstIndex == _nextIndex, |
aoqi@0 | 251 | "Else will undercount"); |
aoqi@0 | 252 | assert(CMSPrintPromoBlockInfo > 0, "Else unnecessary call"); |
aoqi@0 | 253 | // Count the number of blocks and slots in the free pool |
aoqi@0 | 254 | size_t slots = 0; |
aoqi@0 | 255 | size_t blocks = 0; |
aoqi@0 | 256 | for (SpoolBlock* cur_spool = _spareSpool; |
aoqi@0 | 257 | cur_spool != NULL; |
aoqi@0 | 258 | cur_spool = cur_spool->nextSpoolBlock) { |
aoqi@0 | 259 | // the first entry is just a self-pointer; indices 1 through |
aoqi@0 | 260 | // bufferSize - 1 are occupied (thus, bufferSize - 1 slots). |
aoqi@0 | 261 | assert((void*)cur_spool->displacedHdr == (void*)&cur_spool->displacedHdr, |
aoqi@0 | 262 | "first entry of displacedHdr should be self-referential"); |
aoqi@0 | 263 | slots += cur_spool->bufferSize - 1; |
aoqi@0 | 264 | blocks++; |
aoqi@0 | 265 | } |
aoqi@0 | 266 | if (_spoolHead != NULL) { |
aoqi@0 | 267 | slots += _spoolHead->bufferSize - 1; |
aoqi@0 | 268 | blocks++; |
aoqi@0 | 269 | } |
aoqi@0 | 270 | gclog_or_tty->print_cr(" [worker %d] promo_blocks = %d, promo_slots = %d ", |
aoqi@0 | 271 | worker_id, blocks, slots); |
aoqi@0 | 272 | } |
aoqi@0 | 273 | |
aoqi@0 | 274 | // When _spoolTail is not NULL, then the slot <_spoolTail, _nextIndex> |
aoqi@0 | 275 | // points to the next slot available for filling. |
aoqi@0 | 276 | // The set of slots holding displaced headers are then all those in the |
aoqi@0 | 277 | // right-open interval denoted by: |
aoqi@0 | 278 | // |
aoqi@0 | 279 | // [ <_spoolHead, _firstIndex>, <_spoolTail, _nextIndex> ) |
aoqi@0 | 280 | // |
aoqi@0 | 281 | // When _spoolTail is NULL, then the set of slots with displaced headers |
aoqi@0 | 282 | // is all those starting at the slot <_spoolHead, _firstIndex> and |
aoqi@0 | 283 | // going up to the last slot of last block in the linked list. |
aoqi@0 | 284 | // In this lartter case, _splice_point points to the tail block of |
aoqi@0 | 285 | // this linked list of blocks holding displaced headers. |
aoqi@0 | 286 | void PromotionInfo::verify() const { |
aoqi@0 | 287 | // Verify the following: |
aoqi@0 | 288 | // 1. the number of displaced headers matches the number of promoted |
aoqi@0 | 289 | // objects that have displaced headers |
aoqi@0 | 290 | // 2. each promoted object lies in this space |
aoqi@0 | 291 | debug_only( |
aoqi@0 | 292 | PromotedObject* junk = NULL; |
aoqi@0 | 293 | assert(junk->next_addr() == (void*)(oop(junk)->mark_addr()), |
aoqi@0 | 294 | "Offset of PromotedObject::_next is expected to align with " |
aoqi@0 | 295 | " the OopDesc::_mark within OopDesc"); |
aoqi@0 | 296 | ) |
aoqi@0 | 297 | // FIXME: guarantee???? |
aoqi@0 | 298 | guarantee(_spoolHead == NULL || _spoolTail != NULL || |
aoqi@0 | 299 | _splice_point != NULL, "list consistency"); |
aoqi@0 | 300 | guarantee(_promoHead == NULL || _promoTail != NULL, "list consistency"); |
aoqi@0 | 301 | // count the number of objects with displaced headers |
aoqi@0 | 302 | size_t numObjsWithDisplacedHdrs = 0; |
aoqi@0 | 303 | for (PromotedObject* curObj = _promoHead; curObj != NULL; curObj = curObj->next()) { |
aoqi@0 | 304 | guarantee(space()->is_in_reserved((HeapWord*)curObj), "Containment"); |
aoqi@0 | 305 | // the last promoted object may fail the mark() != NULL test of is_oop(). |
aoqi@0 | 306 | guarantee(curObj->next() == NULL || oop(curObj)->is_oop(), "must be an oop"); |
aoqi@0 | 307 | if (curObj->hasDisplacedMark()) { |
aoqi@0 | 308 | numObjsWithDisplacedHdrs++; |
aoqi@0 | 309 | } |
aoqi@0 | 310 | } |
aoqi@0 | 311 | // Count the number of displaced headers |
aoqi@0 | 312 | size_t numDisplacedHdrs = 0; |
aoqi@0 | 313 | for (SpoolBlock* curSpool = _spoolHead; |
aoqi@0 | 314 | curSpool != _spoolTail && curSpool != NULL; |
aoqi@0 | 315 | curSpool = curSpool->nextSpoolBlock) { |
aoqi@0 | 316 | // the first entry is just a self-pointer; indices 1 through |
aoqi@0 | 317 | // bufferSize - 1 are occupied (thus, bufferSize - 1 slots). |
aoqi@0 | 318 | guarantee((void*)curSpool->displacedHdr == (void*)&curSpool->displacedHdr, |
aoqi@0 | 319 | "first entry of displacedHdr should be self-referential"); |
aoqi@0 | 320 | numDisplacedHdrs += curSpool->bufferSize - 1; |
aoqi@0 | 321 | } |
aoqi@0 | 322 | guarantee((_spoolHead == _spoolTail) == (numDisplacedHdrs == 0), |
aoqi@0 | 323 | "internal consistency"); |
aoqi@0 | 324 | guarantee(_spoolTail != NULL || _nextIndex == 1, |
aoqi@0 | 325 | "Inconsistency between _spoolTail and _nextIndex"); |
aoqi@0 | 326 | // We overcounted (_firstIndex-1) worth of slots in block |
aoqi@0 | 327 | // _spoolHead and we undercounted (_nextIndex-1) worth of |
aoqi@0 | 328 | // slots in block _spoolTail. We make an appropriate |
aoqi@0 | 329 | // adjustment by subtracting the first and adding the |
aoqi@0 | 330 | // second: - (_firstIndex - 1) + (_nextIndex - 1) |
aoqi@0 | 331 | numDisplacedHdrs += (_nextIndex - _firstIndex); |
aoqi@0 | 332 | guarantee(numDisplacedHdrs == numObjsWithDisplacedHdrs, "Displaced hdr count"); |
aoqi@0 | 333 | } |
aoqi@0 | 334 | |
aoqi@0 | 335 | void PromotionInfo::print_on(outputStream* st) const { |
aoqi@0 | 336 | SpoolBlock* curSpool = NULL; |
aoqi@0 | 337 | size_t i = 0; |
aoqi@0 | 338 | st->print_cr(" start & end indices: [" SIZE_FORMAT ", " SIZE_FORMAT ")", |
aoqi@0 | 339 | _firstIndex, _nextIndex); |
aoqi@0 | 340 | for (curSpool = _spoolHead; curSpool != _spoolTail && curSpool != NULL; |
aoqi@0 | 341 | curSpool = curSpool->nextSpoolBlock) { |
aoqi@0 | 342 | curSpool->print_on(st); |
aoqi@0 | 343 | st->print_cr(" active "); |
aoqi@0 | 344 | i++; |
aoqi@0 | 345 | } |
aoqi@0 | 346 | for (curSpool = _spoolTail; curSpool != NULL; |
aoqi@0 | 347 | curSpool = curSpool->nextSpoolBlock) { |
aoqi@0 | 348 | curSpool->print_on(st); |
aoqi@0 | 349 | st->print_cr(" inactive "); |
aoqi@0 | 350 | i++; |
aoqi@0 | 351 | } |
aoqi@0 | 352 | for (curSpool = _spareSpool; curSpool != NULL; |
aoqi@0 | 353 | curSpool = curSpool->nextSpoolBlock) { |
aoqi@0 | 354 | curSpool->print_on(st); |
aoqi@0 | 355 | st->print_cr(" free "); |
aoqi@0 | 356 | i++; |
aoqi@0 | 357 | } |
aoqi@0 | 358 | st->print_cr(" " SIZE_FORMAT " header spooling blocks", i); |
aoqi@0 | 359 | } |
aoqi@0 | 360 | |
aoqi@0 | 361 | void SpoolBlock::print_on(outputStream* st) const { |
aoqi@0 | 362 | st->print("[" PTR_FORMAT "," PTR_FORMAT "), " SIZE_FORMAT " HeapWords -> " PTR_FORMAT, |
aoqi@0 | 363 | this, (HeapWord*)displacedHdr + bufferSize, |
aoqi@0 | 364 | bufferSize, nextSpoolBlock); |
aoqi@0 | 365 | } |