/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "memory/memRegion.hpp"
#include "gc_implementation/parallelScavenge/psVirtualspace.hpp"
#include "utilities/bitMap.inline.hpp"
class oopDesc;
class ParMarkBitMapClosure;
{
public:
// Values returned by the iterate() methods.
inline ParMarkBitMap();
// Atomically mark an object as live.
// Return whether the specified begin or end bit is set.
// Traditional interface for testing whether an object is marked or not (these
// test only the begin bits).
// Convert sizes from bits to HeapWords and back. An object that is n bits
// long will be bits_to_words(n) words long. An object that is m words long
// will take up words_to_bits(m) bits in the bitmap.
// Return the size in words of an object given a begin bit and an end bit, or
// the equivalent beg_addr and end_addr.
// Return the size in words of the object (a search is done for the end bit).
// Synonyms for the above.
// Apply live_closure to each live object that lies completely within the
// range [live_range_beg, live_range_end). This is used to iterate over the
// compacted region of the heap. Return values:
//
// incomplete The iteration is not complete. The last object that
// begins in the range does not end in the range;
// closure->source() is set to the start of that object.
//
// complete The iteration is complete. All objects in the range
// were processed and the closure is not full;
// closure->source() is set one past the end of the range.
//
// full The closure is full; closure->source() is set to one
// past the end of the last object processed.
//
// would_overflow The next object in the range would overflow the closure;
// closure->source() is set to the start of that object.
// Apply live closure as above and additionally apply dead_closure to all dead
// space in the range [range_beg, dead_range_end). Note that dead_range_end
// must be >= range_end. This is used to iterate over the dense prefix.
//
// This method assumes that if the first bit in the range (range_beg) is not
// marked, then dead space begins at that point and the dead_closure is
// applied. Thus callers must ensure that range_beg is not in the middle of a
// live object.
idx_t dead_range_end) const;
HeapWord* dead_range_end) const;
// Return the number of live words in the range [beg_addr, end_addr) due to
// objects that start in the range. If a live object extends onto the range,
// the caller must detect and account for any live words due to that object.
// If a live object extends beyond the end of the range, only the words within
// the range are included in the result.
// Same as the above, except the end of the range must be a live object, which
// is the case when updating pointers. This allows a branch to be removed
// from inside the loop.
inline HeapWord* region_start() const;
inline HeapWord* region_end() const;
inline size_t region_size() const;
// Return the bit index of the first marked object that begins (or ends,
// respectively) in the range [beg, end). If no object is found, return end.
// Clear a range of bits or the entire bitmap (both begin and end bits are
// cleared).
// Return the number of bits required to represent the specified number of
// HeapWords, or the specified region.
#ifndef PRODUCT
// CAS statistics.
void reset_counters();
#endif // #ifndef PRODUCT
#ifdef ASSERT
void verify_clear() const;
#endif // #ifdef ASSERT
private:
// Each bit in the bitmap represents one unit of 'object granularity.' Objects
// are double-word aligned in 32-bit VMs, but not in 64-bit VMs, so the 32-bit
// granularity is 2, 64-bit is 1.
#ifndef PRODUCT
#endif // #ifndef PRODUCT
};
_beg_bits(),
{
_region_start = 0;
_virtual_space = 0;
_reserved_byte_size = 0;
}
_beg_bits(),
{
}
{
}
inline ParMarkBitMap::idx_t
{
// Need two bits (one begin bit, one end bit) for each unit of 'object
// granularity' in the heap.
}
inline ParMarkBitMap::idx_t
{
}
inline ParMarkBitMap::idx_t
{
}
inline HeapWord*
{
return _region_start;
}
inline HeapWord*
{
return region_start() + region_size();
}
inline size_t
{
return _region_size;
}
inline size_t
{
}
{
}
{
}
{
return is_obj_beg(bit);
}
{
}
{
}
{
}
{
}
{
}
inline size_t
{
return bits << obj_granularity_shift();
}
inline ParMarkBitMap::idx_t
{
return words >> obj_granularity_shift();
}
{
}
inline size_t
{
}
{
}
{
}
{
}
inline ParMarkBitMap::IterationStatus
{
}
inline ParMarkBitMap::IterationStatus
HeapWord* dead_range_end) const
{
}
inline bool
{
}
{
}
inline HeapWord*
{
}
inline ParMarkBitMap::idx_t
{
}
inline ParMarkBitMap::idx_t
{
}
inline HeapWord*
{
return bit_to_addr(res_bit);
}
inline HeapWord*
{
return bit_to_addr(res_bit);
}
#ifdef ASSERT
// Allow one past the last valid bit; useful for loop bounds.
}
// Allow one past the last valid address; useful for loop bounds.
}
#endif // #ifdef ASSERT
#endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARMARKBITMAP_HPP