1 /*
2 * Copyright (c) 2001, 2014, 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 *
23 */
24
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1OOPCLOSURES_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1OOPCLOSURES_HPP
27
28 #include "memory/iterator.hpp"
29 #include "oops/markOop.hpp"
30
31 class HeapRegion;
32 class G1CollectedHeap;
33 class G1RemSet;
34 class ConcurrentMark;
35 class DirtyCardToOopClosure;
36 class CMBitMap;
37 class CMMarkStack;
38 class G1ParScanThreadState;
39 class CMTask;
40 class ReferenceProcessor;
41
42 // A class that scans oops in a given heap region (much as OopsInGenClosure
43 // scans oops in a generation.)
44 class OopsInHeapRegionClosure: public ExtendedOopClosure {
45 protected:
46 HeapRegion* _from;
264 uint worker_i = 0);
265
266 void set_from(HeapRegion* from) {
267 assert(from != NULL, "from region must be non-NULL");
268 _from = from;
269 }
270
271 bool self_forwarded(oop obj) {
272 markOop m = obj->mark();
273 bool result = (m->is_marked() && ((oop)m->decode_pointer() == obj));
274 return result;
275 }
276
277 bool apply_to_weak_ref_discovered_field() { return true; }
278
279 template <class T> void do_oop_nv(T* p);
280 virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
281 virtual void do_oop(oop* p) { do_oop_nv(p); }
282 };
283
284 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1OOPCLOSURES_HPP
|
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 *
23 */
24
25 #ifndef SHARE_VM_GC_G1_G1OOPCLOSURES_HPP
26 #define SHARE_VM_GC_G1_G1OOPCLOSURES_HPP
27
28 #include "memory/iterator.hpp"
29 #include "oops/markOop.hpp"
30
31 class HeapRegion;
32 class G1CollectedHeap;
33 class G1RemSet;
34 class ConcurrentMark;
35 class DirtyCardToOopClosure;
36 class CMBitMap;
37 class CMMarkStack;
38 class G1ParScanThreadState;
39 class CMTask;
40 class ReferenceProcessor;
41
42 // A class that scans oops in a given heap region (much as OopsInGenClosure
43 // scans oops in a generation.)
44 class OopsInHeapRegionClosure: public ExtendedOopClosure {
45 protected:
46 HeapRegion* _from;
264 uint worker_i = 0);
265
266 void set_from(HeapRegion* from) {
267 assert(from != NULL, "from region must be non-NULL");
268 _from = from;
269 }
270
271 bool self_forwarded(oop obj) {
272 markOop m = obj->mark();
273 bool result = (m->is_marked() && ((oop)m->decode_pointer() == obj));
274 return result;
275 }
276
277 bool apply_to_weak_ref_discovered_field() { return true; }
278
279 template <class T> void do_oop_nv(T* p);
280 virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
281 virtual void do_oop(oop* p) { do_oop_nv(p); }
282 };
283
284 #endif // SHARE_VM_GC_G1_G1OOPCLOSURES_HPP
|