181
182 void report_promotion_event(InCSetState const dest_state,
183 oop const old, size_t word_sz, uint age,
184 HeapWord * const obj_ptr, const AllocationContext_t context) const;
185 public:
186
187 oop copy_to_survivor_space(InCSetState const state, oop const obj, markOop const old_mark);
188
189 void trim_queue();
190
191 inline void steal_and_trim_queue(RefToScanQueueSet *task_queues);
192
193 // An attempt to evacuate "obj" has failed; take necessary steps.
194 oop handle_evacuation_failure_par(oop obj, markOop m);
195 };
196
197 class G1ParScanThreadStateSet : public StackObj {
198 G1CollectedHeap* _g1h;
199 G1ParScanThreadState** _states;
200 size_t* _surviving_young_words_total;
201 size_t* _cards_scanned;
202 size_t _total_cards_scanned;
203 size_t _young_cset_length;
204 uint _n_workers;
205 bool _flushed;
206
207 public:
208 G1ParScanThreadStateSet(G1CollectedHeap* g1h, uint n_workers, size_t young_cset_length) :
209 _g1h(g1h),
210 _states(NEW_C_HEAP_ARRAY(G1ParScanThreadState*, n_workers, mtGC)),
211 _surviving_young_words_total(NEW_C_HEAP_ARRAY(size_t, young_cset_length, mtGC)),
212 _cards_scanned(NEW_C_HEAP_ARRAY(size_t, n_workers, mtGC)),
213 _total_cards_scanned(0),
214 _young_cset_length(young_cset_length),
215 _n_workers(n_workers),
216 _flushed(false) {
217 for (uint i = 0; i < n_workers; ++i) {
218 _states[i] = NULL;
219 }
220 memset(_surviving_young_words_total, 0, young_cset_length * sizeof(size_t));
221 memset(_cards_scanned, 0, n_workers * sizeof(size_t));
222 }
223
224 ~G1ParScanThreadStateSet() {
225 assert(_flushed, "thread local state from the per thread states should have been flushed");
226 FREE_C_HEAP_ARRAY(G1ParScanThreadState*, _states);
227 FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_total);
228 FREE_C_HEAP_ARRAY(size_t, _cards_scanned);
229 }
230
231 void flush();
232
233 G1ParScanThreadState* state_for_worker(uint worker_id);
234
235 void add_cards_scanned(uint worker_id, size_t cards_scanned);
236 size_t total_cards_scanned() const;
237 const size_t* surviving_young_words() const;
238
239 private:
240 G1ParScanThreadState* new_par_scan_state(uint worker_id, size_t young_cset_length);
241 };
242
243 #endif // SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_HPP
|
181
182 void report_promotion_event(InCSetState const dest_state,
183 oop const old, size_t word_sz, uint age,
184 HeapWord * const obj_ptr, const AllocationContext_t context) const;
185 public:
186
187 oop copy_to_survivor_space(InCSetState const state, oop const obj, markOop const old_mark);
188
189 void trim_queue();
190
191 inline void steal_and_trim_queue(RefToScanQueueSet *task_queues);
192
193 // An attempt to evacuate "obj" has failed; take necessary steps.
194 oop handle_evacuation_failure_par(oop obj, markOop m);
195 };
196
197 class G1ParScanThreadStateSet : public StackObj {
198 G1CollectedHeap* _g1h;
199 G1ParScanThreadState** _states;
200 size_t* _surviving_young_words_total;
201 size_t _young_cset_length;
202 uint _n_workers;
203 bool _flushed;
204
205 public:
206 G1ParScanThreadStateSet(G1CollectedHeap* g1h, uint n_workers, size_t young_cset_length) :
207 _g1h(g1h),
208 _states(NEW_C_HEAP_ARRAY(G1ParScanThreadState*, n_workers, mtGC)),
209 _surviving_young_words_total(NEW_C_HEAP_ARRAY(size_t, young_cset_length, mtGC)),
210 _young_cset_length(young_cset_length),
211 _n_workers(n_workers),
212 _flushed(false) {
213 for (uint i = 0; i < n_workers; ++i) {
214 _states[i] = NULL;
215 }
216 memset(_surviving_young_words_total, 0, young_cset_length * sizeof(size_t));
217 }
218
219 ~G1ParScanThreadStateSet() {
220 assert(_flushed, "thread local state from the per thread states should have been flushed");
221 FREE_C_HEAP_ARRAY(G1ParScanThreadState*, _states);
222 FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_total);
223 }
224
225 void flush();
226
227 G1ParScanThreadState* state_for_worker(uint worker_id);
228
229 const size_t* surviving_young_words() const;
230
231 private:
232 G1ParScanThreadState* new_par_scan_state(uint worker_id, size_t young_cset_length);
233 };
234
235 #endif // SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_HPP
|