< prev index next >
src/share/vm/gc/g1/concurrentMark.hpp
Print this page
*** 26,35 ****
--- 26,36 ----
#define SHARE_VM_GC_G1_CONCURRENTMARK_HPP
#include "classfile/javaClasses.hpp"
#include "gc/g1/g1RegionToSpaceMapper.hpp"
#include "gc/g1/heapRegionSet.hpp"
+ #include "gc/shared/cmBitMap.inline.hpp"
#include "gc/shared/gcId.hpp"
#include "gc/shared/taskqueue.hpp"
class G1CollectedHeap;
class CMBitMap;
*** 50,127 ****
G1CMIsAliveClosure(G1CollectedHeap* g1) : _g1(g1) { }
bool do_object_b(oop obj);
};
- // A generic CM bit map. This is essentially a wrapper around the BitMap
- // class, with one bit per (1<<_shifter) HeapWords.
-
- class CMBitMapRO VALUE_OBJ_CLASS_SPEC {
- protected:
- HeapWord* _bmStartWord; // base address of range covered by map
- size_t _bmWordSize; // map size (in #HeapWords covered)
- const int _shifter; // map to char or bit
- BitMap _bm; // the bit map itself
-
- public:
- // constructor
- CMBitMapRO(int shifter);
-
- enum { do_yield = true };
-
- // inquiries
- HeapWord* startWord() const { return _bmStartWord; }
- size_t sizeInWords() const { return _bmWordSize; }
- // the following is one past the last word in space
- HeapWord* endWord() const { return _bmStartWord + _bmWordSize; }
-
- // read marks
-
- bool isMarked(HeapWord* addr) const {
- assert(_bmStartWord <= addr && addr < (_bmStartWord + _bmWordSize),
- "outside underlying space?");
- return _bm.at(heapWordToOffset(addr));
- }
-
- // iteration
- inline bool iterate(BitMapClosure* cl, MemRegion mr);
- inline bool iterate(BitMapClosure* cl);
-
- // Return the address corresponding to the next marked bit at or after
- // "addr", and before "limit", if "limit" is non-NULL. If there is no
- // such bit, returns "limit" if that is non-NULL, or else "endWord()".
- HeapWord* getNextMarkedWordAddress(const HeapWord* addr,
- const HeapWord* limit = NULL) const;
- // Return the address corresponding to the next unmarked bit at or after
- // "addr", and before "limit", if "limit" is non-NULL. If there is no
- // such bit, returns "limit" if that is non-NULL, or else "endWord()".
- HeapWord* getNextUnmarkedWordAddress(const HeapWord* addr,
- const HeapWord* limit = NULL) const;
-
- // conversion utilities
- HeapWord* offsetToHeapWord(size_t offset) const {
- return _bmStartWord + (offset << _shifter);
- }
- size_t heapWordToOffset(const HeapWord* addr) const {
- return pointer_delta(addr, _bmStartWord) >> _shifter;
- }
- int heapWordDiffToOffsetDiff(size_t diff) const;
-
- // The argument addr should be the start address of a valid object
- HeapWord* nextObject(HeapWord* addr) {
- oop obj = (oop) addr;
- HeapWord* res = addr + obj->size();
- assert(offsetToHeapWord(heapWordToOffset(res)) == res, "sanity");
- return res;
- }
-
- void print_on_error(outputStream* st, const char* prefix) const;
-
- // debugging
- NOT_PRODUCT(bool covers(MemRegion rs) const;)
- };
-
class CMBitMapMappingChangedListener : public G1MappingChangedListener {
private:
CMBitMap* _bm;
public:
CMBitMapMappingChangedListener() : _bm(NULL) {}
--- 51,60 ----
*** 129,175 ****
void set_bitmap(CMBitMap* bm) { _bm = bm; }
virtual void on_commit(uint start_idx, size_t num_regions, bool zero_filled);
};
! class CMBitMap : public CMBitMapRO {
private:
CMBitMapMappingChangedListener _listener;
public:
static size_t compute_size(size_t heap_size);
// Returns the amount of bytes on the heap between two marks in the bitmap.
static size_t mark_distance();
// Returns how many bytes (or bits) of the heap a single byte (or bit) of the
// mark bitmap corresponds to. This is the same as the mark distance above.
static size_t heap_map_factor() {
return mark_distance();
}
- CMBitMap() : CMBitMapRO(LogMinObjAlignment), _listener() { _listener.set_bitmap(this); }
-
// Initializes the underlying BitMap to cover the given area.
void initialize(MemRegion heap, G1RegionToSpaceMapper* storage);
- // Write marks.
- inline void mark(HeapWord* addr);
- inline void clear(HeapWord* addr);
- inline bool parMark(HeapWord* addr);
- inline bool parClear(HeapWord* addr);
-
- void markRange(MemRegion mr);
- void clearRange(MemRegion mr);
-
- // Starting at the bit corresponding to "addr" (inclusive), find the next
- // "1" bit, if any. This bit starts some run of consecutive "1"'s; find
- // the end of this run (stopping at "end_addr"). Return the MemRegion
- // covering from the start of the region corresponding to the first bit
- // of the run to the end of the region corresponding to the last bit of
- // the run. If there is no "1" bit at or after "addr", return an empty
- // MemRegion.
- MemRegion getAndClearMarkedRegion(HeapWord* addr, HeapWord* end_addr);
-
// Clear the whole mark bitmap.
void clearAll();
};
// Represents a marking stack used by ConcurrentMarking in the G1 collector.
--- 62,89 ----
void set_bitmap(CMBitMap* bm) { _bm = bm; }
virtual void on_commit(uint start_idx, size_t num_regions, bool zero_filled);
};
! class G1CMBitMap : public CMBitMap {
private:
CMBitMapMappingChangedListener _listener;
public:
+ G1CMBitMap() : CMBitMap(), _listener() { _listener.set_bitmap(this); }
static size_t compute_size(size_t heap_size);
// Returns the amount of bytes on the heap between two marks in the bitmap.
static size_t mark_distance();
// Returns how many bytes (or bits) of the heap a single byte (or bit) of the
// mark bitmap corresponds to. This is the same as the mark distance above.
static size_t heap_map_factor() {
return mark_distance();
}
// Initializes the underlying BitMap to cover the given area.
void initialize(MemRegion heap, G1RegionToSpaceMapper* storage);
// Clear the whole mark bitmap.
void clearAll();
};
// Represents a marking stack used by ConcurrentMarking in the G1 collector.
*** 376,387 ****
double _cleanup_task_overhead;
FreeRegionList _cleanup_list;
// Concurrent marking support structures
! CMBitMap _markBitMap1;
! CMBitMap _markBitMap2;
CMBitMapRO* _prevMarkBitMap; // Completed mark bitmap
CMBitMap* _nextMarkBitMap; // Under-construction mark bitmap
BitMap _region_bm;
BitMap _card_bm;
--- 290,301 ----
double _cleanup_task_overhead;
FreeRegionList _cleanup_list;
// Concurrent marking support structures
! G1CMBitMap _markBitMap1;
! G1CMBitMap _markBitMap2;
CMBitMapRO* _prevMarkBitMap; // Completed mark bitmap
CMBitMap* _nextMarkBitMap; // Under-construction mark bitmap
BitMap _region_bm;
BitMap _card_bm;
< prev index next >