1 /*
2 * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
189 uint _worker_id;
190 public:
191 G1RootRegionScanClosure(G1CollectedHeap* g1h, ConcurrentMark* cm,
192 uint worker_id) :
193 _g1h(g1h), _cm(cm), _worker_id(worker_id) { }
194 template <class T> void do_oop_nv(T* p);
195 virtual void do_oop( oop* p) { do_oop_nv(p); }
196 virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
197 };
198
199 // Closure that applies the given two closures in sequence.
200 // Used by the RSet refinement code (when updating RSets
201 // during an evacuation pause) to record cards containing
202 // pointers into the collection set.
203
204 class G1Mux2Closure : public OopClosure {
205 OopClosure* _c1;
206 OopClosure* _c2;
207 public:
208 G1Mux2Closure(OopClosure *c1, OopClosure *c2);
209 template <class T> void do_oop_work(T* p);
210 virtual void do_oop(oop* p) { do_oop_work(p); }
211 virtual void do_oop(narrowOop* p) { do_oop_work(p); }
212 };
213
214 // A closure that returns true if it is actually applied
215 // to a reference
216
217 class G1TriggerClosure : public OopClosure {
218 bool _triggered;
219 public:
220 G1TriggerClosure();
221 bool triggered() const { return _triggered; }
222 template <class T> void do_oop_work(T* p);
223 virtual void do_oop(oop* p) { do_oop_work(p); }
224 virtual void do_oop(narrowOop* p) { do_oop_work(p); }
225 };
226
227 // A closure which uses a triggering closure to determine
228 // whether to apply an oop closure.
229
230 class G1InvokeIfNotTriggeredClosure: public OopClosure {
231 G1TriggerClosure* _trigger_cl;
232 OopClosure* _oop_cl;
233 public:
234 G1InvokeIfNotTriggeredClosure(G1TriggerClosure* t, OopClosure* oc);
235 template <class T> void do_oop_work(T* p);
236 virtual void do_oop(oop* p) { do_oop_work(p); }
237 virtual void do_oop(narrowOop* p) { do_oop_work(p); }
238 };
239
240 class G1UpdateRSOrPushRefOopClosure: public OopClosure {
241 G1CollectedHeap* _g1;
242 G1RemSet* _g1_rem_set;
243 HeapRegion* _from;
244 G1ParPushHeapRSClosure* _push_ref_cl;
245 bool _record_refs_into_cset;
246 uint _worker_i;
247
248 public:
249 G1UpdateRSOrPushRefOopClosure(G1CollectedHeap* g1h,
250 G1RemSet* rs,
251 G1ParPushHeapRSClosure* push_ref_cl,
252 bool record_refs_into_cset,
253 uint worker_i = 0);
254
255 void set_from(HeapRegion* from) {
256 assert(from != NULL, "from region must be non-NULL");
257 _from = from;
258 }
259
260 bool self_forwarded(oop obj) {
261 markOop m = obj->mark();
262 bool result = (m->is_marked() && ((oop)m->decode_pointer() == obj));
263 return result;
264 }
265
266 template <class T> void do_oop_work(T* p);
267 virtual void do_oop(narrowOop* p) { do_oop_work(p); }
268 virtual void do_oop(oop* p) { do_oop_work(p); }
269 };
270
271 #endif // SHARE_VM_GC_G1_G1OOPCLOSURES_HPP
|
1 /*
2 * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
189 uint _worker_id;
190 public:
191 G1RootRegionScanClosure(G1CollectedHeap* g1h, ConcurrentMark* cm,
192 uint worker_id) :
193 _g1h(g1h), _cm(cm), _worker_id(worker_id) { }
194 template <class T> void do_oop_nv(T* p);
195 virtual void do_oop( oop* p) { do_oop_nv(p); }
196 virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
197 };
198
199 // Closure that applies the given two closures in sequence.
200 // Used by the RSet refinement code (when updating RSets
201 // during an evacuation pause) to record cards containing
202 // pointers into the collection set.
203
204 class G1Mux2Closure : public OopClosure {
205 OopClosure* _c1;
206 OopClosure* _c2;
207 public:
208 G1Mux2Closure(OopClosure *c1, OopClosure *c2);
209 template <class T> inline void do_oop_work(T* p);
210 virtual inline void do_oop(oop* p);
211 virtual inline void do_oop(narrowOop* p);
212 };
213
214 // A closure that returns true if it is actually applied
215 // to a reference
216
217 class G1TriggerClosure : public OopClosure {
218 bool _triggered;
219 public:
220 G1TriggerClosure();
221 bool triggered() const { return _triggered; }
222 template <class T> inline void do_oop_work(T* p);
223 virtual inline void do_oop(oop* p);
224 virtual inline void do_oop(narrowOop* p);
225 };
226
227 // A closure which uses a triggering closure to determine
228 // whether to apply an oop closure.
229
230 class G1InvokeIfNotTriggeredClosure: public OopClosure {
231 G1TriggerClosure* _trigger_cl;
232 OopClosure* _oop_cl;
233 public:
234 G1InvokeIfNotTriggeredClosure(G1TriggerClosure* t, OopClosure* oc);
235 template <class T> inline void do_oop_work(T* p);
236 virtual inline void do_oop(oop* p);
237 virtual inline void do_oop(narrowOop* p);
238 };
239
240 class G1UpdateRSOrPushRefOopClosure: public OopClosure {
241 G1CollectedHeap* _g1;
242 G1RemSet* _g1_rem_set;
243 HeapRegion* _from;
244 G1ParPushHeapRSClosure* _push_ref_cl;
245 bool _record_refs_into_cset;
246 uint _worker_i;
247
248 public:
249 G1UpdateRSOrPushRefOopClosure(G1CollectedHeap* g1h,
250 G1RemSet* rs,
251 G1ParPushHeapRSClosure* push_ref_cl,
252 bool record_refs_into_cset,
253 uint worker_i = 0);
254
255 void set_from(HeapRegion* from) {
256 assert(from != NULL, "from region must be non-NULL");
257 _from = from;
258 }
259
260 bool self_forwarded(oop obj) {
261 markOop m = obj->mark();
262 bool result = (m->is_marked() && ((oop)m->decode_pointer() == obj));
263 return result;
264 }
265
266 template <class T> inline void do_oop_work(T* p);
267 virtual inline void do_oop(narrowOop* p);
268 virtual inline void do_oop(oop* p);
269 };
270
271 #endif // SHARE_VM_GC_G1_G1OOPCLOSURES_HPP
|