42 class G1CollectedHeap;
43 class G1HotCardCache;
44 class G1RemSetScanState;
45 class G1ParScanThreadState;
46 class G1Policy;
47 class G1SATBCardTableModRefBS;
48 class G1ScanObjsDuringScanRSClosure;
49 class G1ScanObjsDuringUpdateRSClosure;
50 class HeapRegionClaimer;
51
52 // A G1RemSet in which each heap region has a rem set that records the
53 // external heap references into it. Uses a mod ref bs to track updates,
54 // so that they can be used to update the individual region remsets.
55 class G1RemSet: public CHeapObj<mtGC> {
56 private:
57 G1RemSetScanState* _scan_state;
58 G1CardLiveData _card_live_data;
59
60 G1RemSetSummary _prev_period_summary;
61
62 // A DirtyCardQueueSet that is used to hold cards that contain
63 // references into the current collection set. This is used to
64 // update the remembered sets of the regions in the collection
65 // set in the event of an evacuation failure.
66 DirtyCardQueueSet _into_cset_dirty_card_queue_set;
67
68 // Scan all remembered sets of the collection set for references into the collection
69 // set.
70 void scan_rem_set(G1ParScanThreadState* pss,
71 CodeBlobClosure* heap_region_codeblobs,
72 uint worker_i);
73
74 // Flush remaining refinement buffers for cross-region references to either evacuate references
75 // into the collection set or update the remembered set.
76 void update_rem_set(DirtyCardQueue* into_cset_dcq, G1ParScanThreadState* pss, uint worker_i);
77
78 protected:
79 G1CollectedHeap* _g1;
80 size_t _conc_refine_cards;
81 uint n_workers();
82
83 protected:
84 CardTableModRefBS* _ct_bs;
85 G1Policy* _g1p;
86 G1HotCardCache* _hot_card_cache;
87
88 public:
89 // Gives an approximation on how many threads can be expected to add records to
90 // a remembered set in parallel. This can be used for sizing data structures to
91 // decrease performance losses due to data structure sharing.
92 // Examples for quantities that influence this value are the maximum number of
93 // mutator threads, maximum number of concurrent refinement or GC threads.
94 static uint num_par_rem_sets();
95
96 // Initialize data that depends on the heap size being known.
119 // call. Must call each of these once before and after (in sequential
120 // code) any thread calls oops_into_collection_set_do.
121 void prepare_for_oops_into_collection_set_do();
122 void cleanup_after_oops_into_collection_set_do();
123
124 G1RemSetScanState* scan_state() const { return _scan_state; }
125
126 // Record, if necessary, the fact that *p (where "p" is in region "from",
127 // which is required to be non-NULL) has changed to a new non-NULL value.
128 template <class T> void par_write_ref(HeapRegion* from, T* p, uint tid);
129
130 // Eliminates any remembered set entries that correspond to dead heap ranges.
131 void scrub(uint worker_num, HeapRegionClaimer* hrclaimer);
132
133 // Refine the card corresponding to "card_ptr". Safe to be called concurrently
134 // to the mutator.
135 void refine_card_concurrently(jbyte* card_ptr,
136 uint worker_i);
137
138 // Refine the card corresponding to "card_ptr", applying the given closure to
139 // all references found. Returns "true" if the given card contains
140 // oops that have references into the current collection set. Must only be
141 // called during gc.
142 bool refine_card_during_gc(jbyte* card_ptr,
143 G1ScanObjsDuringUpdateRSClosure* update_rs_cl);
144
145 // Print accumulated summary info from the start of the VM.
146 void print_summary_info();
147
148 // Print accumulated summary info from the last time called.
149 void print_periodic_summary_info(const char* header, uint period_count);
150
151 size_t conc_refine_cards() const { return _conc_refine_cards; }
152
153 void create_card_live_data(WorkGang* workers, G1CMBitMap* mark_bitmap);
154 void finalize_card_live_data(WorkGang* workers, G1CMBitMap* mark_bitmap);
155
156 // Verify that the liveness count data created concurrently matches one created
157 // during this safepoint.
158 void verify_card_live_data(WorkGang* workers, G1CMBitMap* actual_bitmap);
159
160 void clear_card_live_data(WorkGang* workers);
161
162 #ifdef ASSERT
163 void verify_card_live_data_is_clear();
|
42 class G1CollectedHeap;
43 class G1HotCardCache;
44 class G1RemSetScanState;
45 class G1ParScanThreadState;
46 class G1Policy;
47 class G1SATBCardTableModRefBS;
48 class G1ScanObjsDuringScanRSClosure;
49 class G1ScanObjsDuringUpdateRSClosure;
50 class HeapRegionClaimer;
51
52 // A G1RemSet in which each heap region has a rem set that records the
53 // external heap references into it. Uses a mod ref bs to track updates,
54 // so that they can be used to update the individual region remsets.
55 class G1RemSet: public CHeapObj<mtGC> {
56 private:
57 G1RemSetScanState* _scan_state;
58 G1CardLiveData _card_live_data;
59
60 G1RemSetSummary _prev_period_summary;
61
62 // Scan all remembered sets of the collection set for references into the collection
63 // set.
64 void scan_rem_set(G1ParScanThreadState* pss,
65 CodeBlobClosure* heap_region_codeblobs,
66 uint worker_i);
67
68 // Flush remaining refinement buffers for cross-region references to either evacuate references
69 // into the collection set or update the remembered set.
70 void update_rem_set(G1ParScanThreadState* pss, uint worker_i);
71
72 protected:
73 G1CollectedHeap* _g1;
74 size_t _conc_refine_cards;
75 uint n_workers();
76
77 protected:
78 CardTableModRefBS* _ct_bs;
79 G1Policy* _g1p;
80 G1HotCardCache* _hot_card_cache;
81
82 public:
83 // Gives an approximation on how many threads can be expected to add records to
84 // a remembered set in parallel. This can be used for sizing data structures to
85 // decrease performance losses due to data structure sharing.
86 // Examples for quantities that influence this value are the maximum number of
87 // mutator threads, maximum number of concurrent refinement or GC threads.
88 static uint num_par_rem_sets();
89
90 // Initialize data that depends on the heap size being known.
113 // call. Must call each of these once before and after (in sequential
114 // code) any thread calls oops_into_collection_set_do.
115 void prepare_for_oops_into_collection_set_do();
116 void cleanup_after_oops_into_collection_set_do();
117
118 G1RemSetScanState* scan_state() const { return _scan_state; }
119
120 // Record, if necessary, the fact that *p (where "p" is in region "from",
121 // which is required to be non-NULL) has changed to a new non-NULL value.
122 template <class T> void par_write_ref(HeapRegion* from, T* p, uint tid);
123
124 // Eliminates any remembered set entries that correspond to dead heap ranges.
125 void scrub(uint worker_num, HeapRegionClaimer* hrclaimer);
126
127 // Refine the card corresponding to "card_ptr". Safe to be called concurrently
128 // to the mutator.
129 void refine_card_concurrently(jbyte* card_ptr,
130 uint worker_i);
131
132 // Refine the card corresponding to "card_ptr", applying the given closure to
133 // all references found.Must only be called during gc.
134 void refine_card_during_gc(jbyte* card_ptr, G1ScanObjsDuringUpdateRSClosure* update_rs_cl);
135
136 // Print accumulated summary info from the start of the VM.
137 void print_summary_info();
138
139 // Print accumulated summary info from the last time called.
140 void print_periodic_summary_info(const char* header, uint period_count);
141
142 size_t conc_refine_cards() const { return _conc_refine_cards; }
143
144 void create_card_live_data(WorkGang* workers, G1CMBitMap* mark_bitmap);
145 void finalize_card_live_data(WorkGang* workers, G1CMBitMap* mark_bitmap);
146
147 // Verify that the liveness count data created concurrently matches one created
148 // during this safepoint.
149 void verify_card_live_data(WorkGang* workers, G1CMBitMap* actual_bitmap);
150
151 void clear_card_live_data(WorkGang* workers);
152
153 #ifdef ASSERT
154 void verify_card_live_data_is_clear();
|