1 /*
2 * Copyright (c) 2001, 2008, 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 class Generation;
26 class HeapWord;
27 class CardTableRS;
28 class CardTableModRefBS;
29 class DefNewGeneration;
30
31 template<class E, unsigned int N> class GenericTaskQueue;
32 typedef GenericTaskQueue<oop, TASKQUEUE_SIZE> OopTaskQueue;
33 template<class T> class GenericTaskQueueSet;
34 typedef GenericTaskQueueSet<OopTaskQueue> OopTaskQueueSet;
35
36 // Closure for iterating roots from a particular generation
37 // Note: all classes deriving from this MUST call this do_barrier
38 // method at the end of their own do_oop method!
39 // Note: no do_oop defined, this is an abstract class.
40
41 class OopsInGenClosure : public OopClosure {
42 private:
43 Generation* _orig_gen; // generation originally set in ctor
44 Generation* _gen; // generation being scanned
159 template <class T> inline void do_oop_work(T* p);
160 public:
161 ScanWeakRefClosure(DefNewGeneration* g);
162 virtual void do_oop(oop* p);
163 virtual void do_oop(narrowOop* p);
164 inline void do_oop_nv(oop* p);
165 inline void do_oop_nv(narrowOop* p);
166 };
167
168 class VerifyOopClosure: public OopClosure {
169 protected:
170 template <class T> inline void do_oop_work(T* p) {
171 oop obj = oopDesc::load_decode_heap_oop(p);
172 guarantee(obj->is_oop_or_null(), "invalid oop");
173 }
174 public:
175 virtual void do_oop(oop* p);
176 virtual void do_oop(narrowOop* p);
177 static VerifyOopClosure verify_oop;
178 };
|
1 /*
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.
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_MEMORY_GENOOPCLOSURES_HPP
26 #define SHARE_VM_MEMORY_GENOOPCLOSURES_HPP
27
28 #include "memory/iterator.hpp"
29 #include "oops/oop.hpp"
30
31 class Generation;
32 class HeapWord;
33 class CardTableRS;
34 class CardTableModRefBS;
35 class DefNewGeneration;
36
37 template<class E, unsigned int N> class GenericTaskQueue;
38 typedef GenericTaskQueue<oop, TASKQUEUE_SIZE> OopTaskQueue;
39 template<class T> class GenericTaskQueueSet;
40 typedef GenericTaskQueueSet<OopTaskQueue> OopTaskQueueSet;
41
42 // Closure for iterating roots from a particular generation
43 // Note: all classes deriving from this MUST call this do_barrier
44 // method at the end of their own do_oop method!
45 // Note: no do_oop defined, this is an abstract class.
46
47 class OopsInGenClosure : public OopClosure {
48 private:
49 Generation* _orig_gen; // generation originally set in ctor
50 Generation* _gen; // generation being scanned
165 template <class T> inline void do_oop_work(T* p);
166 public:
167 ScanWeakRefClosure(DefNewGeneration* g);
168 virtual void do_oop(oop* p);
169 virtual void do_oop(narrowOop* p);
170 inline void do_oop_nv(oop* p);
171 inline void do_oop_nv(narrowOop* p);
172 };
173
174 class VerifyOopClosure: public OopClosure {
175 protected:
176 template <class T> inline void do_oop_work(T* p) {
177 oop obj = oopDesc::load_decode_heap_oop(p);
178 guarantee(obj->is_oop_or_null(), "invalid oop");
179 }
180 public:
181 virtual void do_oop(oop* p);
182 virtual void do_oop(narrowOop* p);
183 static VerifyOopClosure verify_oop;
184 };
185
186 #endif // SHARE_VM_MEMORY_GENOOPCLOSURES_HPP
|