1472N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 1441N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1441N/A * This code is free software; you can redistribute it and/or modify it 1441N/A * under the terms of the GNU General Public License version 2 only, as 1441N/A * published by the Free Software Foundation. 1441N/A * This code is distributed in the hope that it will be useful, but WITHOUT 1441N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1441N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1441N/A * version 2 for more details (a copy is included in the LICENSE file that 1441N/A * You should have received a copy of the GNU General Public License version 1441N/A * 2 along with this work; if not, write to the Free Software Foundation, 1441N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1441N/A///////////////////////////////////////////////////////////////////////// 1441N/A///////////////////////////////////////////////////////////////////////// 1441N/A////////////////////////////////////////////////////////////////////////////// 1441N/A// We go over the list of promoted objects, removing each from the list, 1441N/A// and applying the closure (this may, in turn, add more elements to 1441N/A// the tail of the promoted list, and these newly added objects will 1441N/A// also be processed) until the list is empty. 1441N/A// To aid verification and debugging, in the non-product builds 1441N/A// we actually forward _promoHead each time we process a promoted oop. 1441N/A// Note that this is not necessary in general (i.e. when we don't need to 1441N/A// call PromotionInfo::verify()) because oop_iterate can only add to the 1441N/A// end of _promoTail, and never needs to look at _promoHead. 1441N/A /* protect ourselves against additions due to closure application \ 1441N/A below by resetting the list. */ \
1441N/A /* restore displaced header */ \
1441N/A /* restore prototypical header */ \
1441N/A /* The "promoted_mark" should now not be set */ \
1441N/A "Should have been cleared by restoring displaced mark-word"); \
1441N/A// This should have been ALL_SINCE_...() just like the others, 1441N/A// but, because the body of the method above is somehwat longer, 1441N/A// the MSVC compiler cannot cope; as a workaround, we split the 1441N/A// macro into its 3 constituent parts below (see original macro 1441N/A// Return the next displaced header, incrementing the pointer and 1441N/A// recycling spool area as necessary. 1441N/A "Empty spool space: no displaced header can be fetched");
1441N/A // forward to next block, recycling this block into spare spool buffer 1441N/A "spool buffers processing inconsistency");
1441N/A // make a copy of header as it may need to be spooled 1441N/A // save non-prototypical header, and mark oop 1441N/A // we'd like to assert something like the following: 1441N/A // assert(mark == markOopDesc::prototype(), "consistency check"); 1441N/A // ... but the above won't work because the age bits have not (yet) been 1441N/A // cleared. The remainder of the check would be identical to the 1441N/A // condition checked in must_be_preserved() above, so we don't really 1441N/A // have anything useful to check here! 1441N/A // Mask as newly promoted, so we can skip over such objects 1441N/A // when scanning dirty cards 1441N/A// Save the given displaced header, incrementing the pointer and 1441N/A// obtaining more spool area as necessary. 1441N/A "promotionInfo inconsistency");
1441N/A // get a new spooling block 1441N/A // ... but will attempt filling before next promotion attempt 1441N/A// Ensure that spooling space exists. Return false if spooling space 1441N/A // Try and obtain more spooling space 1441N/A "getSpoolBlock() sanity check");
1441N/A // Extra check that _splice_point is connected to list 1441N/A// Get a free spool buffer from the free pool, getting a new block 1441N/A// from the heap if necessary. 1441N/A }
else {
// spare spool exhausted, get some from heap 1441N/A "spooling inconsistency?");
1441N/A "spooling inconsistency?");
1441N/A // Count the number of blocks and slots in the free pool 1441N/A // the first entry is just a self-pointer; indices 1 through 1441N/A // bufferSize - 1 are occupied (thus, bufferSize - 1 slots). 1697N/A "first entry of displacedHdr should be self-referential");
1441N/A// When _spoolTail is not NULL, then the slot <_spoolTail, _nextIndex> 1441N/A// points to the next slot available for filling. 1441N/A// The set of slots holding displaced headers are then all those in the 1441N/A// right-open interval denoted by: 1441N/A// [ <_spoolHead, _firstIndex>, <_spoolTail, _nextIndex> ) 1441N/A// When _spoolTail is NULL, then the set of slots with displaced headers 1441N/A// is all those starting at the slot <_spoolHead, _firstIndex> and 1441N/A// going up to the last slot of last block in the linked list. 1441N/A// In this lartter case, _splice_point points to the tail block of 1441N/A// this linked list of blocks holding displaced headers. 1441N/A // 1. the number of displaced headers matches the number of promoted 1441N/A // objects that have displaced headers 1441N/A // 2. each promoted object lies in this space 1441N/A "Offset of PromotedObject::_next is expected to align with " 1441N/A " the OopDesc::_mark within OopDesc");
1441N/A // count the number of objects with displaced headers 1441N/A // the last promoted object may fail the mark() != NULL test of is_oop(). 1441N/A // Count the number of displaced headers 1441N/A // the first entry is just a self-pointer; indices 1 through 1441N/A // bufferSize - 1 are occupied (thus, bufferSize - 1 slots). 1441N/A "first entry of displacedHdr should be self-referential");
1441N/A "Inconsistency between _spoolTail and _nextIndex");
1441N/A // We overcounted (_firstIndex-1) worth of slots in block 1441N/A // _spoolHead and we undercounted (_nextIndex-1) worth of 1441N/A // slots in block _spoolTail. We make an appropriate 1441N/A // adjustment by subtracting the first and adding the 1441N/A // second: - (_firstIndex - 1) + (_nextIndex - 1)