Mercurial > hg > graal-compiler
annotate src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp @ 912:308762b2bf14
6872000: G1: compilation fails on linux/older gcc
Reviewed-by: jcoomes, tonyp
author | apetrusenko |
---|---|
date | Fri, 14 Aug 2009 13:44:15 -0700 |
parents | 00b023ae2d78 |
children | 05f89f00a864 148e5441d916 |
rev | line source |
---|---|
0 | 1 /* |
2 * Copyright (c) 2007 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
20 * CA 95054 USA or visit www.sun.com if you need additional information or | |
21 * have any questions. | |
22 * | |
23 */ | |
24 | |
25 ///////////////////////////////////////////////////////////////// | |
26 // Closures used by ConcurrentMarkSweepGeneration's collector | |
27 ///////////////////////////////////////////////////////////////// | |
28 class ConcurrentMarkSweepGeneration; | |
29 class CMSBitMap; | |
30 class CMSMarkStack; | |
31 class CMSCollector; | |
32 class MarkFromRootsClosure; | |
33 class Par_MarkFromRootsClosure; | |
34 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
35 // Decode the oop and call do_oop on it. |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
36 #define DO_OOP_WORK_DEFN \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
37 void do_oop(oop obj); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
38 template <class T> inline void do_oop_work(T* p) { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
39 T heap_oop = oopDesc::load_heap_oop(p); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
40 if (!oopDesc::is_null(heap_oop)) { \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
41 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
42 do_oop(obj); \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
43 } \ |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
44 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
45 |
0 | 46 class MarkRefsIntoClosure: public OopsInGenClosure { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
47 private: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
48 const MemRegion _span; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
49 CMSBitMap* _bitMap; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
50 const bool _should_do_nmethods; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
51 protected: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
52 DO_OOP_WORK_DEFN |
0 | 53 public: |
54 MarkRefsIntoClosure(MemRegion span, CMSBitMap* bitMap, | |
55 bool should_do_nmethods); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
56 virtual void do_oop(oop* p); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
57 virtual void do_oop(narrowOop* p); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
58 inline void do_oop_nv(oop* p) { MarkRefsIntoClosure::do_oop_work(p); } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
59 inline void do_oop_nv(narrowOop* p) { MarkRefsIntoClosure::do_oop_work(p); } |
0 | 60 bool do_header() { return true; } |
61 virtual const bool do_nmethods() const { | |
62 return _should_do_nmethods; | |
63 } | |
64 Prefetch::style prefetch_style() { | |
65 return Prefetch::do_read; | |
66 } | |
67 }; | |
68 | |
69 // A variant of the above used in certain kinds of CMS | |
70 // marking verification. | |
71 class MarkRefsIntoVerifyClosure: public OopsInGenClosure { | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
72 private: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
73 const MemRegion _span; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
74 CMSBitMap* _verification_bm; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
75 CMSBitMap* _cms_bm; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
76 const bool _should_do_nmethods; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
77 protected: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
78 DO_OOP_WORK_DEFN |
0 | 79 public: |
80 MarkRefsIntoVerifyClosure(MemRegion span, CMSBitMap* verification_bm, | |
81 CMSBitMap* cms_bm, bool should_do_nmethods); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
82 virtual void do_oop(oop* p); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
83 virtual void do_oop(narrowOop* p); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
84 inline void do_oop_nv(oop* p) { MarkRefsIntoVerifyClosure::do_oop_work(p); } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
85 inline void do_oop_nv(narrowOop* p) { MarkRefsIntoVerifyClosure::do_oop_work(p); } |
0 | 86 bool do_header() { return true; } |
87 virtual const bool do_nmethods() const { | |
88 return _should_do_nmethods; | |
89 } | |
90 Prefetch::style prefetch_style() { | |
91 return Prefetch::do_read; | |
92 } | |
93 }; | |
94 | |
95 // The non-parallel version (the parallel version appears further below). | |
96 class PushAndMarkClosure: public OopClosure { | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
97 private: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
98 CMSCollector* _collector; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
99 MemRegion _span; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
100 CMSBitMap* _bit_map; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
101 CMSBitMap* _mod_union_table; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
102 CMSMarkStack* _mark_stack; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
103 CMSMarkStack* _revisit_stack; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
104 bool _concurrent_precleaning; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
105 bool const _should_remember_klasses; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
106 protected: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
107 DO_OOP_WORK_DEFN |
0 | 108 public: |
109 PushAndMarkClosure(CMSCollector* collector, | |
110 MemRegion span, | |
111 ReferenceProcessor* rp, | |
112 CMSBitMap* bit_map, | |
113 CMSBitMap* mod_union_table, | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
114 CMSMarkStack* mark_stack, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
115 CMSMarkStack* revisit_stack, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
116 bool concurrent_precleaning); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
117 virtual void do_oop(oop* p); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
118 virtual void do_oop(narrowOop* p); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
119 inline void do_oop_nv(oop* p) { PushAndMarkClosure::do_oop_work(p); } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
120 inline void do_oop_nv(narrowOop* p) { PushAndMarkClosure::do_oop_work(p); } |
0 | 121 bool do_header() { return true; } |
122 Prefetch::style prefetch_style() { | |
123 return Prefetch::do_read; | |
124 } | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
125 virtual const bool should_remember_klasses() const { |
0 | 126 return _should_remember_klasses; |
127 } | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
128 virtual void remember_klass(Klass* k); |
0 | 129 }; |
130 | |
131 // In the parallel case, the revisit stack, the bit map and the | |
132 // reference processor are currently all shared. Access to | |
133 // these shared mutable structures must use appropriate | |
134 // synchronization (for instance, via CAS). The marking stack | |
135 // used in the non-parallel case above is here replaced with | |
136 // an OopTaskQueue structure to allow efficient work stealing. | |
137 class Par_PushAndMarkClosure: public OopClosure { | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
138 private: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
139 CMSCollector* _collector; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
140 MemRegion _span; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
141 CMSBitMap* _bit_map; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
142 OopTaskQueue* _work_queue; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
143 CMSMarkStack* _revisit_stack; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
144 bool const _should_remember_klasses; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
145 protected: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
146 DO_OOP_WORK_DEFN |
0 | 147 public: |
148 Par_PushAndMarkClosure(CMSCollector* collector, | |
149 MemRegion span, | |
150 ReferenceProcessor* rp, | |
151 CMSBitMap* bit_map, | |
152 OopTaskQueue* work_queue, | |
153 CMSMarkStack* revisit_stack); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
154 virtual void do_oop(oop* p); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
155 virtual void do_oop(narrowOop* p); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
156 inline void do_oop_nv(oop* p) { Par_PushAndMarkClosure::do_oop_work(p); } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
157 inline void do_oop_nv(narrowOop* p) { Par_PushAndMarkClosure::do_oop_work(p); } |
0 | 158 bool do_header() { return true; } |
159 Prefetch::style prefetch_style() { | |
160 return Prefetch::do_read; | |
161 } | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
162 virtual const bool should_remember_klasses() const { |
0 | 163 return _should_remember_klasses; |
164 } | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
165 virtual void remember_klass(Klass* k); |
0 | 166 }; |
167 | |
168 // The non-parallel version (the parallel version appears further below). | |
169 class MarkRefsIntoAndScanClosure: public OopsInGenClosure { | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
170 private: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
171 MemRegion _span; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
172 CMSBitMap* _bit_map; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
173 CMSMarkStack* _mark_stack; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
174 PushAndMarkClosure _pushAndMarkClosure; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
175 CMSCollector* _collector; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
176 Mutex* _freelistLock; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
177 bool _yield; |
0 | 178 // Whether closure is being used for concurrent precleaning |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
179 bool _concurrent_precleaning; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
180 protected: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
181 DO_OOP_WORK_DEFN |
0 | 182 public: |
183 MarkRefsIntoAndScanClosure(MemRegion span, | |
184 ReferenceProcessor* rp, | |
185 CMSBitMap* bit_map, | |
186 CMSBitMap* mod_union_table, | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
187 CMSMarkStack* mark_stack, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
188 CMSMarkStack* revisit_stack, |
0 | 189 CMSCollector* collector, |
190 bool should_yield, | |
191 bool concurrent_precleaning); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
192 virtual void do_oop(oop* p); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
193 virtual void do_oop(narrowOop* p); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
194 inline void do_oop_nv(oop* p) { MarkRefsIntoAndScanClosure::do_oop_work(p); } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
195 inline void do_oop_nv(narrowOop* p) { MarkRefsIntoAndScanClosure::do_oop_work(p); } |
0 | 196 bool do_header() { return true; } |
197 virtual const bool do_nmethods() const { return true; } | |
198 Prefetch::style prefetch_style() { | |
199 return Prefetch::do_read; | |
200 } | |
201 void set_freelistLock(Mutex* m) { | |
202 _freelistLock = m; | |
203 } | |
204 | |
205 private: | |
206 inline void do_yield_check(); | |
207 void do_yield_work(); | |
208 bool take_from_overflow_list(); | |
209 }; | |
210 | |
211 // Tn this, the parallel avatar of MarkRefsIntoAndScanClosure, the revisit | |
212 // stack and the bitMap are shared, so access needs to be suitably | |
213 // sycnhronized. An OopTaskQueue structure, supporting efficient | |
214 // workstealing, replaces a CMSMarkStack for storing grey objects. | |
215 class Par_MarkRefsIntoAndScanClosure: public OopsInGenClosure { | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
216 private: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
217 MemRegion _span; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
218 CMSBitMap* _bit_map; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
219 OopTaskQueue* _work_queue; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
220 const uint _low_water_mark; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
221 Par_PushAndMarkClosure _par_pushAndMarkClosure; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
222 protected: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
223 DO_OOP_WORK_DEFN |
0 | 224 public: |
225 Par_MarkRefsIntoAndScanClosure(CMSCollector* collector, | |
226 MemRegion span, | |
227 ReferenceProcessor* rp, | |
228 CMSBitMap* bit_map, | |
229 OopTaskQueue* work_queue, | |
230 CMSMarkStack* revisit_stack); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
231 virtual void do_oop(oop* p); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
232 virtual void do_oop(narrowOop* p); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
233 inline void do_oop_nv(oop* p) { Par_MarkRefsIntoAndScanClosure::do_oop_work(p); } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
234 inline void do_oop_nv(narrowOop* p) { Par_MarkRefsIntoAndScanClosure::do_oop_work(p); } |
0 | 235 bool do_header() { return true; } |
236 virtual const bool do_nmethods() const { return true; } | |
237 Prefetch::style prefetch_style() { | |
238 return Prefetch::do_read; | |
239 } | |
240 void trim_queue(uint size); | |
241 }; | |
242 | |
243 // This closure is used during the concurrent marking phase | |
244 // following the first checkpoint. Its use is buried in | |
245 // the closure MarkFromRootsClosure. | |
246 class PushOrMarkClosure: public OopClosure { | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
247 private: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
248 CMSCollector* _collector; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
249 MemRegion _span; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
250 CMSBitMap* _bitMap; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
251 CMSMarkStack* _markStack; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
252 CMSMarkStack* _revisitStack; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
253 HeapWord* const _finger; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
254 MarkFromRootsClosure* const |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
255 _parent; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
256 bool const _should_remember_klasses; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
257 protected: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
258 DO_OOP_WORK_DEFN |
0 | 259 public: |
260 PushOrMarkClosure(CMSCollector* cms_collector, | |
261 MemRegion span, | |
262 CMSBitMap* bitMap, | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
263 CMSMarkStack* markStack, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
264 CMSMarkStack* revisitStack, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
265 HeapWord* finger, |
0 | 266 MarkFromRootsClosure* parent); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
267 virtual void do_oop(oop* p); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
268 virtual void do_oop(narrowOop* p); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
269 inline void do_oop_nv(oop* p) { PushOrMarkClosure::do_oop_work(p); } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
270 inline void do_oop_nv(narrowOop* p) { PushOrMarkClosure::do_oop_work(p); } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
271 virtual const bool should_remember_klasses() const { |
0 | 272 return _should_remember_klasses; |
273 } | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
274 virtual void remember_klass(Klass* k); |
0 | 275 // Deal with a stack overflow condition |
276 void handle_stack_overflow(HeapWord* lost); | |
277 private: | |
278 inline void do_yield_check(); | |
279 }; | |
280 | |
281 // A parallel (MT) version of the above. | |
282 // This closure is used during the concurrent marking phase | |
283 // following the first checkpoint. Its use is buried in | |
284 // the closure Par_MarkFromRootsClosure. | |
285 class Par_PushOrMarkClosure: public OopClosure { | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
286 private: |
0 | 287 CMSCollector* _collector; |
288 MemRegion _whole_span; | |
289 MemRegion _span; // local chunk | |
290 CMSBitMap* _bit_map; | |
291 OopTaskQueue* _work_queue; | |
292 CMSMarkStack* _overflow_stack; | |
293 CMSMarkStack* _revisit_stack; | |
294 HeapWord* const _finger; | |
295 HeapWord** const _global_finger_addr; | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
296 Par_MarkFromRootsClosure* const |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
297 _parent; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
298 bool const _should_remember_klasses; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
299 protected: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
300 DO_OOP_WORK_DEFN |
0 | 301 public: |
302 Par_PushOrMarkClosure(CMSCollector* cms_collector, | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
303 MemRegion span, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
304 CMSBitMap* bit_map, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
305 OopTaskQueue* work_queue, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
306 CMSMarkStack* mark_stack, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
307 CMSMarkStack* revisit_stack, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
308 HeapWord* finger, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
309 HeapWord** global_finger_addr, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
310 Par_MarkFromRootsClosure* parent); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
311 virtual void do_oop(oop* p); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
312 virtual void do_oop(narrowOop* p); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
313 inline void do_oop_nv(oop* p) { Par_PushOrMarkClosure::do_oop_work(p); } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
314 inline void do_oop_nv(narrowOop* p) { Par_PushOrMarkClosure::do_oop_work(p); } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
315 virtual const bool should_remember_klasses() const { |
0 | 316 return _should_remember_klasses; |
317 } | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
318 virtual void remember_klass(Klass* k); |
0 | 319 // Deal with a stack overflow condition |
320 void handle_stack_overflow(HeapWord* lost); | |
321 private: | |
322 inline void do_yield_check(); | |
323 }; | |
324 | |
325 // For objects in CMS generation, this closure marks | |
326 // given objects (transitively) as being reachable/live. | |
327 // This is currently used during the (weak) reference object | |
452
00b023ae2d78
6722113: CMS: Incorrect overflow handling during precleaning of Reference lists
ysr
parents:
143
diff
changeset
|
328 // processing phase of the CMS final checkpoint step, as |
00b023ae2d78
6722113: CMS: Incorrect overflow handling during precleaning of Reference lists
ysr
parents:
143
diff
changeset
|
329 // well as during the concurrent precleaning of the discovered |
00b023ae2d78
6722113: CMS: Incorrect overflow handling during precleaning of Reference lists
ysr
parents:
143
diff
changeset
|
330 // reference lists. |
0 | 331 class CMSKeepAliveClosure: public OopClosure { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
332 private: |
0 | 333 CMSCollector* _collector; |
143
b5489bb705c9
6662086: 6u4+, 7b11+: CMS never clears referents when -XX:+ParallelRefProcEnabled
ysr
parents:
113
diff
changeset
|
334 const MemRegion _span; |
0 | 335 CMSMarkStack* _mark_stack; |
336 CMSBitMap* _bit_map; | |
452
00b023ae2d78
6722113: CMS: Incorrect overflow handling during precleaning of Reference lists
ysr
parents:
143
diff
changeset
|
337 bool _concurrent_precleaning; |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
338 protected: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
339 DO_OOP_WORK_DEFN |
0 | 340 public: |
341 CMSKeepAliveClosure(CMSCollector* collector, MemRegion span, | |
452
00b023ae2d78
6722113: CMS: Incorrect overflow handling during precleaning of Reference lists
ysr
parents:
143
diff
changeset
|
342 CMSBitMap* bit_map, CMSMarkStack* mark_stack, |
00b023ae2d78
6722113: CMS: Incorrect overflow handling during precleaning of Reference lists
ysr
parents:
143
diff
changeset
|
343 bool cpc): |
0 | 344 _collector(collector), |
345 _span(span), | |
346 _bit_map(bit_map), | |
452
00b023ae2d78
6722113: CMS: Incorrect overflow handling during precleaning of Reference lists
ysr
parents:
143
diff
changeset
|
347 _mark_stack(mark_stack), |
00b023ae2d78
6722113: CMS: Incorrect overflow handling during precleaning of Reference lists
ysr
parents:
143
diff
changeset
|
348 _concurrent_precleaning(cpc) { |
143
b5489bb705c9
6662086: 6u4+, 7b11+: CMS never clears referents when -XX:+ParallelRefProcEnabled
ysr
parents:
113
diff
changeset
|
349 assert(!_span.is_empty(), "Empty span could spell trouble"); |
b5489bb705c9
6662086: 6u4+, 7b11+: CMS never clears referents when -XX:+ParallelRefProcEnabled
ysr
parents:
113
diff
changeset
|
350 } |
452
00b023ae2d78
6722113: CMS: Incorrect overflow handling during precleaning of Reference lists
ysr
parents:
143
diff
changeset
|
351 bool concurrent_precleaning() const { return _concurrent_precleaning; } |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
352 virtual void do_oop(oop* p); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
353 virtual void do_oop(narrowOop* p); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
354 inline void do_oop_nv(oop* p) { CMSKeepAliveClosure::do_oop_work(p); } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
355 inline void do_oop_nv(narrowOop* p) { CMSKeepAliveClosure::do_oop_work(p); } |
0 | 356 }; |
357 | |
358 class CMSInnerParMarkAndPushClosure: public OopClosure { | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
359 private: |
0 | 360 CMSCollector* _collector; |
361 MemRegion _span; | |
362 OopTaskQueue* _work_queue; | |
363 CMSBitMap* _bit_map; | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
364 protected: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
365 DO_OOP_WORK_DEFN |
0 | 366 public: |
367 CMSInnerParMarkAndPushClosure(CMSCollector* collector, | |
368 MemRegion span, CMSBitMap* bit_map, | |
369 OopTaskQueue* work_queue): | |
370 _collector(collector), | |
371 _span(span), | |
372 _bit_map(bit_map), | |
373 _work_queue(work_queue) { } | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
374 virtual void do_oop(oop* p); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
375 virtual void do_oop(narrowOop* p); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
376 inline void do_oop_nv(oop* p) { CMSInnerParMarkAndPushClosure::do_oop_work(p); } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
377 inline void do_oop_nv(narrowOop* p) { CMSInnerParMarkAndPushClosure::do_oop_work(p); } |
0 | 378 }; |
379 | |
380 // A parallel (MT) version of the above, used when | |
381 // reference processing is parallel; the only difference | |
382 // is in the do_oop method. | |
383 class CMSParKeepAliveClosure: public OopClosure { | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
384 private: |
0 | 385 CMSCollector* _collector; |
386 MemRegion _span; | |
387 OopTaskQueue* _work_queue; | |
388 CMSBitMap* _bit_map; | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
389 CMSInnerParMarkAndPushClosure |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
390 _mark_and_push; |
0 | 391 const uint _low_water_mark; |
392 void trim_queue(uint max); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
393 protected: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
394 DO_OOP_WORK_DEFN |
0 | 395 public: |
396 CMSParKeepAliveClosure(CMSCollector* collector, MemRegion span, | |
397 CMSBitMap* bit_map, OopTaskQueue* work_queue); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
398 virtual void do_oop(oop* p); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
399 virtual void do_oop(narrowOop* p); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
400 inline void do_oop_nv(oop* p) { CMSParKeepAliveClosure::do_oop_work(p); } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
401 inline void do_oop_nv(narrowOop* p) { CMSParKeepAliveClosure::do_oop_work(p); } |
0 | 402 }; |