< prev index next >
src/share/vm/gc/g1/g1ConcurrentMark.hpp
Print this page
rev 10546 : [mq]: 8077144-concurrent-mark-thread-init-fix
rev 10547 : imported patch 8077144-mikael-review
*** 264,274 ****
class ConcurrentMarkThread;
class G1ConcurrentMark: public CHeapObj<mtGC> {
friend class ConcurrentMarkThread;
friend class G1ParNoteEndTask;
! friend class CalcLiveObjectsClosure;
friend class G1CMRefProcTaskProxy;
friend class G1CMRefProcTaskExecutor;
friend class G1CMKeepAliveAndDrainClosure;
friend class G1CMDrainMarkingStackClosure;
friend class G1CMBitMapClosure;
--- 264,274 ----
class ConcurrentMarkThread;
class G1ConcurrentMark: public CHeapObj<mtGC> {
friend class ConcurrentMarkThread;
friend class G1ParNoteEndTask;
! friend class G1VerifyLiveDataClosure;
friend class G1CMRefProcTaskProxy;
friend class G1CMRefProcTaskExecutor;
friend class G1CMKeepAliveAndDrainClosure;
friend class G1CMDrainMarkingStackClosure;
friend class G1CMBitMapClosure;
*** 296,307 ****
G1CMBitMap _markBitMap1;
G1CMBitMap _markBitMap2;
G1CMBitMapRO* _prevMarkBitMap; // Completed mark bitmap
G1CMBitMap* _nextMarkBitMap; // Under-construction mark bitmap
! BitMap _region_bm;
! BitMap _card_bm;
// Heap bounds
HeapWord* _heap_start;
HeapWord* _heap_end;
--- 296,313 ----
G1CMBitMap _markBitMap1;
G1CMBitMap _markBitMap2;
G1CMBitMapRO* _prevMarkBitMap; // Completed mark bitmap
G1CMBitMap* _nextMarkBitMap; // Under-construction mark bitmap
! // Liveness count data. After marking G1 iterates over the recently gathered mark
! // bitmap and records rough information about liveness on card and region basis.
! // This information can be used for e.g. remembered set scrubbing.
!
! // A set bit indicates whether the given region contains any live object.
! BitMap _region_live_bm;
! // A set bit indicates that the given card contains a live object.
! BitMap _card_live_bm;
// Heap bounds
HeapWord* _heap_start;
HeapWord* _heap_end;
*** 371,380 ****
--- 377,394 ----
void weakRefsWorkParallelPart(BoolObjectClosure* is_alive, bool purged_classes);
void weakRefsWork(bool clear_all_soft_refs);
void swapMarkBitMaps();
+ // Allocates and returns a zero-ed out "large" bitmap of the given size in bits.
+ // It is always allocated using virtual memory.
+ BitMap allocate_large_bitmap(BitMap::idx_t size_in_bits);
+ // Allocates the memory for all bitmaps used by the concurrent marking.
+ void allocate_internal_bitmaps();
+ // Pre-touches the internal bitmaps.
+ void pretouch_internal_bitmaps();
+
// It resets the global marking data structures, as well as the
// task local ones; should be called during initial mark.
void reset();
// Resets all the marking data structures. Called when we have to restart
*** 459,485 ****
// Methods to enter the two overflow sync barriers
void enter_first_sync_barrier(uint worker_id);
void enter_second_sync_barrier(uint worker_id);
- // Live Data Counting data structures...
- // These data structures are initialized at the start of
- // marking. They are written to while marking is active.
- // They are aggregated during remark; the aggregated values
- // are then used to populate the _region_bm, _card_bm, and
- // the total live bytes, which are then subsequently updated
- // during cleanup.
-
- // An array of bitmaps (one bit map per task). Each bitmap
- // is used to record the cards spanned by the live objects
- // marked by that task/worker.
- BitMap* _count_card_bitmaps;
-
- // Used to record the number of marked live bytes
- // (for each region, by worker thread).
- size_t** _count_marked_bytes;
-
// Card index of the bottom of the G1 heap. Used for biasing indices into
// the card bitmaps.
intptr_t _heap_bottom_card_num;
// Set to true when initialization is complete
--- 473,482 ----
*** 561,582 ****
// The following three are interaction between CM and
// G1CollectedHeap
// This notifies CM that a root during initial-mark needs to be
! // grayed. It is MT-safe. word_size is the size of the object in
! // words. It is passed explicitly as sometimes we cannot calculate
! // it from the given object because it might be in an inconsistent
! // state (e.g., in to-space and being copied). So the caller is
! // responsible for dealing with this issue (e.g., get the size from
! // the from-space image when the to-space image might be
! // inconsistent) and always passing the size. hr is the region that
// contains the object and it's passed optionally from callers who
// might already have it (no point in recalculating it).
inline void grayRoot(oop obj,
- size_t word_size,
- uint worker_id,
HeapRegion* hr = NULL);
// Prepare internal data structures for the next mark cycle. This includes clearing
// the next mark bitmap and some internal data structures. This method is intended
// to be called concurrently to the mutator. It will yield to safepoint requests.
--- 558,571 ----
// The following three are interaction between CM and
// G1CollectedHeap
// This notifies CM that a root during initial-mark needs to be
! // grayed. It is MT-safe. hr is the region that
// contains the object and it's passed optionally from callers who
// might already have it (no point in recalculating it).
inline void grayRoot(oop obj,
HeapRegion* hr = NULL);
// Prepare internal data structures for the next mark cycle. This includes clearing
// the next mark bitmap and some internal data structures. This method is intended
// to be called concurrently to the mutator. It will yield to safepoint requests.
*** 639,750 ****
inline bool isPrevMarked(oop p) const;
inline bool do_yield_check(uint worker_i = 0);
! // Called to abort the marking cycle after a Full GC takes place.
void abort();
bool has_aborted() { return _has_aborted; }
void print_summary_info();
void print_worker_threads_on(outputStream* st) const;
void print_on_error(outputStream* st) const;
! // Liveness counting
!
! // Utility routine to set an exclusive range of cards on the given
! // card liveness bitmap
! inline void set_card_bitmap_range(BitMap* card_bm,
! BitMap::idx_t start_idx,
! BitMap::idx_t end_idx,
! bool is_par);
!
! // Returns the card number of the bottom of the G1 heap.
! // Used in biasing indices into accounting card bitmaps.
! intptr_t heap_bottom_card_num() const {
! return _heap_bottom_card_num;
! }
!
! // Returns the card bitmap for a given task or worker id.
! BitMap* count_card_bitmap_for(uint worker_id) {
! assert(worker_id < _max_worker_id, "oob");
! assert(_count_card_bitmaps != NULL, "uninitialized");
! BitMap* task_card_bm = &_count_card_bitmaps[worker_id];
! assert(task_card_bm->size() == _card_bm.size(), "size mismatch");
! return task_card_bm;
! }
!
! // Returns the array containing the marked bytes for each region,
! // for the given worker or task id.
! size_t* count_marked_bytes_array_for(uint worker_id) {
! assert(worker_id < _max_worker_id, "oob");
! assert(_count_marked_bytes != NULL, "uninitialized");
! size_t* marked_bytes_array = _count_marked_bytes[worker_id];
! assert(marked_bytes_array != NULL, "uninitialized");
! return marked_bytes_array;
! }
!
! // Returns the index in the liveness accounting card table bitmap
! // for the given address
! inline BitMap::idx_t card_bitmap_index_for(HeapWord* addr);
!
! // Counts the size of the given memory region in the the given
! // marked_bytes array slot for the given HeapRegion.
! // Sets the bits in the given card bitmap that are associated with the
! // cards that are spanned by the memory region.
! inline void count_region(MemRegion mr,
! HeapRegion* hr,
! size_t* marked_bytes_array,
! BitMap* task_card_bm);
!
! // Counts the given object in the given task/worker counting
! // data structures.
! inline void count_object(oop obj,
! HeapRegion* hr,
! size_t* marked_bytes_array,
! BitMap* task_card_bm,
! size_t word_size);
!
! // Attempts to mark the given object and, if successful, counts
! // the object in the given task/worker counting structures.
! inline bool par_mark_and_count(oop obj,
! HeapRegion* hr,
! size_t* marked_bytes_array,
! BitMap* task_card_bm);
!
! // Attempts to mark the given object and, if successful, counts
! // the object in the task/worker counting structures for the
! // given worker id.
! inline bool par_mark_and_count(oop obj,
! size_t word_size,
! HeapRegion* hr,
! uint worker_id);
// Returns true if initialization was successfully completed.
bool completed_initialization() const {
return _completed_initialization;
}
ConcurrentGCTimer* gc_timer_cm() const { return _gc_timer_cm; }
G1OldTracer* gc_tracer_cm() const { return _gc_tracer_cm; }
! protected:
! // Clear all the per-task bitmaps and arrays used to store the
! // counting data.
! void clear_all_count_data();
!
! // Aggregates the counting data for each worker/task
! // that was constructed while marking. Also sets
! // the amount of marked bytes for each region and
! // the top at concurrent mark count.
! void aggregate_count_data();
// Verification routine
! void verify_count_data();
};
// A class representing a marking task.
class G1CMTask : public TerminatorTerminator {
private:
--- 628,672 ----
inline bool isPrevMarked(oop p) const;
inline bool do_yield_check(uint worker_i = 0);
! // Abandon current marking iteration due to a Full GC.
void abort();
bool has_aborted() { return _has_aborted; }
void print_summary_info();
void print_worker_threads_on(outputStream* st) const;
void print_on_error(outputStream* st) const;
! // Attempts to mark the given object on the next mark bitmap.
! inline bool par_mark(oop obj);
// Returns true if initialization was successfully completed.
bool completed_initialization() const {
return _completed_initialization;
}
ConcurrentGCTimer* gc_timer_cm() const { return _gc_timer_cm; }
G1OldTracer* gc_tracer_cm() const { return _gc_tracer_cm; }
! private:
! // Clear (Reset) all liveness count data.
! void clear_all_live_data(WorkGang* workers);
!
! // Verify all of the above data structures that they are in initial state.
! void verify_all_live_data();
!
! // Aggregates the per-card liveness data based on the current marking. Also sets
! // the amount of marked bytes for each region.
! void create_live_data();
// Verification routine
! void verify_live_data();
};
// A class representing a marking task.
class G1CMTask : public TerminatorTerminator {
private:
*** 842,857 ****
// phase, i.e. SATB buffer availability...)
bool _concurrent;
TruncatedSeq _marking_step_diffs_ms;
- // Counting data structures. Embedding the task's marked_bytes_array
- // and card bitmap into the actual task saves having to go through
- // the ConcurrentMark object.
- size_t* _marked_bytes_array;
- BitMap* _card_bm;
-
// it updates the local fields after this task has claimed
// a new region to scan
void setup_for_region(HeapRegion* hr);
// it brings up-to-date the limit of the region
void update_region_limit();
--- 764,773 ----
*** 934,946 ****
// Increment the number of references this task has visited.
void increment_refs_reached() { ++_refs_reached; }
// Grey the object by marking it. If not already marked, push it on
// the local queue if below the finger.
- // Precondition: obj is in region.
// Precondition: obj is below region's NTAMS.
! inline void make_reference_grey(oop obj, HeapRegion* region);
// Grey the object (by calling make_grey_reference) if required,
// e.g. obj is below its containing region's NTAMS.
// Precondition: obj is a valid heap object.
inline void deal_with_reference(oop obj);
--- 850,861 ----
// Increment the number of references this task has visited.
void increment_refs_reached() { ++_refs_reached; }
// Grey the object by marking it. If not already marked, push it on
// the local queue if below the finger.
// Precondition: obj is below region's NTAMS.
! inline void make_reference_grey(oop obj);
// Grey the object (by calling make_grey_reference) if required,
// e.g. obj is below its containing region's NTAMS.
// Precondition: obj is a valid heap object.
inline void deal_with_reference(oop obj);
*** 974,985 ****
_finger = new_finger;
}
G1CMTask(uint worker_id,
G1ConcurrentMark *cm,
- size_t* marked_bytes,
- BitMap* card_bm,
G1CMTaskQueue* task_queue,
G1CMTaskQueueSet* task_queues);
// it prints statistics associated with this task
void print_stats();
--- 889,898 ----
< prev index next >