src/share/vm/gc_implementation/g1/g1RemSet.hpp

changeset 2060
2d160770d2e5
parent 1907
c18cbe5936b8
child 2063
a03ae377b2e8
equal deleted inserted replaced
2059:63f4675ac87d 2060:2d160770d2e5
1 /* 1 /*
2 * Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
81 int worker_num, int claim_val) = 0; 81 int worker_num, int claim_val) = 0;
82 82
83 // Refine the card corresponding to "card_ptr". If "sts" is non-NULL, 83 // Refine the card corresponding to "card_ptr". If "sts" is non-NULL,
84 // join and leave around parts that must be atomic wrt GC. (NULL means 84 // join and leave around parts that must be atomic wrt GC. (NULL means
85 // being done at a safepoint.) 85 // being done at a safepoint.)
86 virtual void concurrentRefineOneCard(jbyte* card_ptr, int worker_i) {} 86 // With some implementations of this routine, when check_for_refs_into_cset
87 // is true, a true result may be returned if the given card contains oops
88 // that have references into the current collection set.
89 virtual bool concurrentRefineOneCard(jbyte* card_ptr, int worker_i,
90 bool check_for_refs_into_cset) {
91 return false;
92 }
87 93
88 // Print any relevant summary info. 94 // Print any relevant summary info.
89 virtual void print_summary_info() {} 95 virtual void print_summary_info() {}
90 96
91 // Prepare remebered set for verification. 97 // Prepare remebered set for verification.
141 147
142 size_t* _cards_scanned; 148 size_t* _cards_scanned;
143 size_t _total_cards_scanned; 149 size_t _total_cards_scanned;
144 150
145 // _par_traversal_in_progress is "true" iff a parallel traversal is in 151 // _par_traversal_in_progress is "true" iff a parallel traversal is in
146 // progress. If so, then cards added to remembered sets should also have 152 // progress.
147 // their references into the collection summarized in "_new_refs".
148 bool _par_traversal_in_progress; 153 bool _par_traversal_in_progress;
149 void set_par_traversal(bool b) { _par_traversal_in_progress = b; } 154 void set_par_traversal(bool b) { _par_traversal_in_progress = b; }
150 GrowableArray<OopOrNarrowOopStar>** _new_refs; 155
151 template <class T> void new_refs_iterate_work(OopClosure* cl); 156 // Used for caching the closure that is responsible for scanning
152 void new_refs_iterate(OopClosure* cl) { 157 // references into the collection set.
153 if (UseCompressedOops) { 158 OopsInHeapRegionClosure** _cset_rs_update_cl;
154 new_refs_iterate_work<narrowOop>(cl);
155 } else {
156 new_refs_iterate_work<oop>(cl);
157 }
158 }
159 159
160 // The routine that performs the actual work of refining a dirty 160 // The routine that performs the actual work of refining a dirty
161 // card. 161 // card.
162 void concurrentRefineOneCard_impl(jbyte* card_ptr, int worker_i); 162 // If check_for_refs_into_refs is true then a true result is returned
163 // if the card contains oops that have references into the current
164 // collection set.
165 bool concurrentRefineOneCard_impl(jbyte* card_ptr, int worker_i,
166 bool check_for_refs_into_cset);
163 167
164 protected: 168 protected:
165 template <class T> void write_ref_nv(HeapRegion* from, T* p); 169 template <class T> void write_ref_nv(HeapRegion* from, T* p);
166 template <class T> void par_write_ref_nv(HeapRegion* from, T* p, int tid); 170 template <class T> void par_write_ref_nv(HeapRegion* from, T* p, int tid);
167 171
186 scanNewRefsRS_work<narrowOop>(oc, worker_i); 190 scanNewRefsRS_work<narrowOop>(oc, worker_i);
187 } else { 191 } else {
188 scanNewRefsRS_work<oop>(oc, worker_i); 192 scanNewRefsRS_work<oop>(oc, worker_i);
189 } 193 }
190 } 194 }
191 void updateRS(int worker_i); 195 void updateRS(DirtyCardQueue* into_cset_dcq, int worker_i);
192 HeapRegion* calculateStartRegion(int i); 196 HeapRegion* calculateStartRegion(int i);
193 197
194 HRInto_G1RemSet* as_HRInto_G1RemSet() { return this; } 198 HRInto_G1RemSet* as_HRInto_G1RemSet() { return this; }
195 199
196 CardTableModRefBS* ct_bs() { return _ct_bs; } 200 CardTableModRefBS* ct_bs() { return _ct_bs; }
217 221
218 void scrub(BitMap* region_bm, BitMap* card_bm); 222 void scrub(BitMap* region_bm, BitMap* card_bm);
219 void scrub_par(BitMap* region_bm, BitMap* card_bm, 223 void scrub_par(BitMap* region_bm, BitMap* card_bm,
220 int worker_num, int claim_val); 224 int worker_num, int claim_val);
221 225
222 virtual void concurrentRefineOneCard(jbyte* card_ptr, int worker_i); 226 // If check_for_refs_into_cset is true then a true result is returned
227 // if the card contains oops that have references into the current
228 // collection set.
229 virtual bool concurrentRefineOneCard(jbyte* card_ptr, int worker_i,
230 bool check_for_refs_into_cset);
223 231
224 virtual void print_summary_info(); 232 virtual void print_summary_info();
225 virtual void prepare_for_verify(); 233 virtual void prepare_for_verify();
226 }; 234 };
227 235
263 271
264 // Override: this closure is idempotent. 272 // Override: this closure is idempotent.
265 // bool idempotent() { return true; } 273 // bool idempotent() { return true; }
266 bool apply_to_weak_ref_discovered_field() { return true; } 274 bool apply_to_weak_ref_discovered_field() { return true; }
267 }; 275 };
276
277 class UpdateRSetImmediate: public OopsInHeapRegionClosure {
278 private:
279 G1RemSet* _g1_rem_set;
280
281 template <class T> void do_oop_work(T* p);
282 public:
283 UpdateRSetImmediate(G1RemSet* rs) :
284 _g1_rem_set(rs) {}
285
286 virtual void do_oop(narrowOop* p) { do_oop_work(p); }
287 virtual void do_oop( oop* p) { do_oop_work(p); }
288 };

mercurial