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_GC_G1_G1FULLGCOOPCLOSURES_HPP
26 #define SHARE_GC_G1_G1FULLGCOOPCLOSURES_HPP
27
28 #include "gc/shared/verifyOption.hpp"
29 #include "memory/iterator.hpp"
30
31 class G1CollectedHeap;
32 class G1FullCollector;
33 class G1CMBitMap;
34 class G1FullGCMarker;
35
36 // Below are closures used by the G1 Full GC.
37 class G1IsAliveClosure : public BoolObjectClosure {
38 G1FullCollector* _collector;
39 G1CMBitMap* _bitmap;
40
41 public:
42 G1IsAliveClosure(G1FullCollector* collector);
43 G1IsAliveClosure(G1FullCollector* collector, G1CMBitMap* bitmap) :
44 _collector(collector), _bitmap(bitmap) { }
45
46 virtual bool do_object_b(oop p);
47 };
48
49 class G1FullKeepAliveClosure: public OopClosure {
50 G1FullGCMarker* _marker;
51 template <class T>
52 inline void do_oop_work(T* p);
53
54 public:
62 G1FullGCMarker* _marker;
63 uint _worker_id;
64
65 public:
66 G1MarkAndPushClosure(uint worker, G1FullGCMarker* marker, ReferenceDiscoverer* ref) :
67 OopIterateClosure(ref),
68 _marker(marker),
69 _worker_id(worker) { }
70
71 template <class T> inline void do_oop_work(T* p);
72 virtual void do_oop(oop* p);
73 virtual void do_oop(narrowOop* p);
74
75 virtual bool do_metadata();
76 virtual void do_klass(Klass* k);
77 virtual void do_cld(ClassLoaderData* cld);
78 };
79
80 class G1AdjustClosure : public BasicOopIterateClosure {
81 G1FullCollector* _collector;
82
83 template <class T> inline void adjust_pointer(T* p);
84 public:
85 G1AdjustClosure(G1FullCollector* collector) : _collector(collector) { }
86 template <class T> void do_oop_work(T* p) { adjust_pointer(p); }
87 virtual void do_oop(oop* p);
88 virtual void do_oop(narrowOop* p);
89
90 virtual ReferenceIterationMode reference_iteration_mode() { return DO_FIELDS; }
91 };
92
93 class G1VerifyOopClosure: public BasicOopIterateClosure {
94 private:
95 G1CollectedHeap* _g1h;
96 bool _failures;
97 oop _containing_obj;
98 VerifyOption _verify_option;
99
100 public:
101 int _cc;
102 G1VerifyOopClosure(VerifyOption option);
103
104 void set_containing_obj(oop obj) {
105 _containing_obj = obj;
|
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_GC_G1_G1FULLGCOOPCLOSURES_HPP
26 #define SHARE_GC_G1_G1FULLGCOOPCLOSURES_HPP
27
28 #include "gc/g1/g1CollectedHeap.hpp"
29 #include "gc/shared/verifyOption.hpp"
30 #include "memory/iterator.hpp"
31
32 class G1CollectedHeap;
33 class G1FullCollector;
34 class G1CMBitMap;
35 class G1FullGCMarker;
36 class SlidingForwarding;
37
38 // Below are closures used by the G1 Full GC.
39 class G1IsAliveClosure : public BoolObjectClosure {
40 G1FullCollector* _collector;
41 G1CMBitMap* _bitmap;
42
43 public:
44 G1IsAliveClosure(G1FullCollector* collector);
45 G1IsAliveClosure(G1FullCollector* collector, G1CMBitMap* bitmap) :
46 _collector(collector), _bitmap(bitmap) { }
47
48 virtual bool do_object_b(oop p);
49 };
50
51 class G1FullKeepAliveClosure: public OopClosure {
52 G1FullGCMarker* _marker;
53 template <class T>
54 inline void do_oop_work(T* p);
55
56 public:
64 G1FullGCMarker* _marker;
65 uint _worker_id;
66
67 public:
68 G1MarkAndPushClosure(uint worker, G1FullGCMarker* marker, ReferenceDiscoverer* ref) :
69 OopIterateClosure(ref),
70 _marker(marker),
71 _worker_id(worker) { }
72
73 template <class T> inline void do_oop_work(T* p);
74 virtual void do_oop(oop* p);
75 virtual void do_oop(narrowOop* p);
76
77 virtual bool do_metadata();
78 virtual void do_klass(Klass* k);
79 virtual void do_cld(ClassLoaderData* cld);
80 };
81
82 class G1AdjustClosure : public BasicOopIterateClosure {
83 G1FullCollector* _collector;
84 const SlidingForwarding* const _forwarding;
85
86 template <class T> inline void adjust_pointer(T* p);
87 public:
88 G1AdjustClosure(G1FullCollector* collector) :
89 _collector(collector),
90 _forwarding(G1CollectedHeap::heap()->forwarding()) { }
91 template <class T> void do_oop_work(T* p) { adjust_pointer(p); }
92 virtual void do_oop(oop* p);
93 virtual void do_oop(narrowOop* p);
94
95 virtual ReferenceIterationMode reference_iteration_mode() { return DO_FIELDS; }
96 };
97
98 class G1VerifyOopClosure: public BasicOopIterateClosure {
99 private:
100 G1CollectedHeap* _g1h;
101 bool _failures;
102 oop _containing_obj;
103 VerifyOption _verify_option;
104
105 public:
106 int _cc;
107 G1VerifyOopClosure(VerifyOption option);
108
109 void set_containing_obj(oop obj) {
110 _containing_obj = obj;
|