Mercurial > hg > truffle
annotate src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp @ 975:83c29a26f67c
6879572: SA fails _is_marked_dependent not found
Reviewed-by: kamg, dcubed
author | acorn |
---|---|
date | Wed, 16 Sep 2009 15:42:46 -0400 |
parents | 8b46c4d82093 |
children | 54b3b351d6f9 |
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 | |
935 | 95 // KlassRememberingOopClosure is used when marking of the permanent generation |
96 // is being done. It adds fields to support revisiting of klasses | |
97 // for class unloading. _should_remember_klasses should be set to | |
98 // indicate if klasses should be remembered. Currently that is whenever | |
99 // CMS class unloading is turned on. The _revisit_stack is used | |
100 // to save the klasses for later processing. | |
101 class KlassRememberingOopClosure : public OopClosure { | |
102 protected: | |
103 CMSCollector* _collector; | |
104 CMSMarkStack* _revisit_stack; | |
105 bool const _should_remember_klasses; | |
106 public: | |
107 void check_remember_klasses() const PRODUCT_RETURN; | |
108 virtual const bool should_remember_klasses() const { | |
109 check_remember_klasses(); | |
110 return _should_remember_klasses; | |
111 } | |
112 virtual void remember_klass(Klass* k); | |
113 | |
114 KlassRememberingOopClosure(CMSCollector* collector, | |
115 ReferenceProcessor* rp, | |
116 CMSMarkStack* revisit_stack); | |
117 }; | |
118 | |
119 // Similar to KlassRememberingOopClosure for use when multiple | |
120 // GC threads will execute the closure. | |
121 | |
122 class Par_KlassRememberingOopClosure : public KlassRememberingOopClosure { | |
123 public: | |
124 Par_KlassRememberingOopClosure(CMSCollector* collector, | |
125 ReferenceProcessor* rp, | |
126 CMSMarkStack* revisit_stack): | |
127 KlassRememberingOopClosure(collector, rp, revisit_stack) {} | |
128 virtual void remember_klass(Klass* k); | |
129 }; | |
130 | |
0 | 131 // The non-parallel version (the parallel version appears further below). |
935 | 132 class PushAndMarkClosure: public KlassRememberingOopClosure { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
133 private: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
134 MemRegion _span; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
135 CMSBitMap* _bit_map; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
136 CMSBitMap* _mod_union_table; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
137 CMSMarkStack* _mark_stack; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
138 bool _concurrent_precleaning; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
139 protected: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
140 DO_OOP_WORK_DEFN |
0 | 141 public: |
142 PushAndMarkClosure(CMSCollector* collector, | |
143 MemRegion span, | |
144 ReferenceProcessor* rp, | |
145 CMSBitMap* bit_map, | |
146 CMSBitMap* mod_union_table, | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
147 CMSMarkStack* mark_stack, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
148 CMSMarkStack* revisit_stack, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
149 bool concurrent_precleaning); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
150 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
|
151 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
|
152 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
|
153 inline void do_oop_nv(narrowOop* p) { PushAndMarkClosure::do_oop_work(p); } |
0 | 154 bool do_header() { return true; } |
155 Prefetch::style prefetch_style() { | |
156 return Prefetch::do_read; | |
157 } | |
941 | 158 // In support of class unloading |
159 virtual const bool should_remember_mdo() const { | |
160 return false; | |
161 // return _should_remember_klasses; | |
162 } | |
163 virtual void remember_mdo(DataLayout* v); | |
0 | 164 }; |
165 | |
166 // In the parallel case, the revisit stack, the bit map and the | |
167 // reference processor are currently all shared. Access to | |
168 // these shared mutable structures must use appropriate | |
169 // synchronization (for instance, via CAS). The marking stack | |
170 // used in the non-parallel case above is here replaced with | |
171 // an OopTaskQueue structure to allow efficient work stealing. | |
935 | 172 class Par_PushAndMarkClosure: public Par_KlassRememberingOopClosure { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
173 private: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
174 MemRegion _span; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
175 CMSBitMap* _bit_map; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
176 OopTaskQueue* _work_queue; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
177 protected: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
178 DO_OOP_WORK_DEFN |
0 | 179 public: |
180 Par_PushAndMarkClosure(CMSCollector* collector, | |
181 MemRegion span, | |
182 ReferenceProcessor* rp, | |
183 CMSBitMap* bit_map, | |
184 OopTaskQueue* work_queue, | |
185 CMSMarkStack* revisit_stack); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
186 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
|
187 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
|
188 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
|
189 inline void do_oop_nv(narrowOop* p) { Par_PushAndMarkClosure::do_oop_work(p); } |
0 | 190 bool do_header() { return true; } |
191 Prefetch::style prefetch_style() { | |
192 return Prefetch::do_read; | |
193 } | |
941 | 194 // In support of class unloading |
195 virtual const bool should_remember_mdo() const { | |
196 return false; | |
197 // return _should_remember_klasses; | |
198 } | |
199 virtual void remember_mdo(DataLayout* v); | |
0 | 200 }; |
201 | |
202 // The non-parallel version (the parallel version appears further below). | |
203 class MarkRefsIntoAndScanClosure: public OopsInGenClosure { | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
204 private: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
205 MemRegion _span; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
206 CMSBitMap* _bit_map; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
207 CMSMarkStack* _mark_stack; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
208 PushAndMarkClosure _pushAndMarkClosure; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
209 CMSCollector* _collector; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
210 Mutex* _freelistLock; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
211 bool _yield; |
0 | 212 // 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
|
213 bool _concurrent_precleaning; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
214 protected: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
215 DO_OOP_WORK_DEFN |
0 | 216 public: |
217 MarkRefsIntoAndScanClosure(MemRegion span, | |
218 ReferenceProcessor* rp, | |
219 CMSBitMap* bit_map, | |
220 CMSBitMap* mod_union_table, | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
221 CMSMarkStack* mark_stack, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
222 CMSMarkStack* revisit_stack, |
0 | 223 CMSCollector* collector, |
224 bool should_yield, | |
225 bool concurrent_precleaning); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
226 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
|
227 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
|
228 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
|
229 inline void do_oop_nv(narrowOop* p) { MarkRefsIntoAndScanClosure::do_oop_work(p); } |
0 | 230 bool do_header() { return true; } |
231 virtual const bool do_nmethods() const { return true; } | |
232 Prefetch::style prefetch_style() { | |
233 return Prefetch::do_read; | |
234 } | |
235 void set_freelistLock(Mutex* m) { | |
236 _freelistLock = m; | |
237 } | |
935 | 238 virtual const bool should_remember_klasses() const { |
239 return _pushAndMarkClosure.should_remember_klasses(); | |
240 } | |
241 virtual void remember_klass(Klass* k) { | |
242 _pushAndMarkClosure.remember_klass(k); | |
243 } | |
0 | 244 |
245 private: | |
246 inline void do_yield_check(); | |
247 void do_yield_work(); | |
248 bool take_from_overflow_list(); | |
249 }; | |
250 | |
251 // Tn this, the parallel avatar of MarkRefsIntoAndScanClosure, the revisit | |
252 // stack and the bitMap are shared, so access needs to be suitably | |
253 // sycnhronized. An OopTaskQueue structure, supporting efficient | |
254 // workstealing, replaces a CMSMarkStack for storing grey objects. | |
255 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
|
256 private: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
257 MemRegion _span; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
258 CMSBitMap* _bit_map; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
259 OopTaskQueue* _work_queue; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
260 const uint _low_water_mark; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
261 Par_PushAndMarkClosure _par_pushAndMarkClosure; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
262 protected: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
263 DO_OOP_WORK_DEFN |
0 | 264 public: |
265 Par_MarkRefsIntoAndScanClosure(CMSCollector* collector, | |
266 MemRegion span, | |
267 ReferenceProcessor* rp, | |
268 CMSBitMap* bit_map, | |
269 OopTaskQueue* work_queue, | |
270 CMSMarkStack* revisit_stack); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
271 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
|
272 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
|
273 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
|
274 inline void do_oop_nv(narrowOop* p) { Par_MarkRefsIntoAndScanClosure::do_oop_work(p); } |
0 | 275 bool do_header() { return true; } |
276 virtual const bool do_nmethods() const { return true; } | |
935 | 277 // When ScanMarkedObjectsAgainClosure is used, |
278 // it passes [Par_]MarkRefsIntoAndScanClosure to oop_oop_iterate(), | |
279 // and this delegation is used. | |
280 virtual const bool should_remember_klasses() const { | |
281 return _par_pushAndMarkClosure.should_remember_klasses(); | |
282 } | |
283 // See comment on should_remember_klasses() above. | |
284 virtual void remember_klass(Klass* k) { | |
285 _par_pushAndMarkClosure.remember_klass(k); | |
286 } | |
0 | 287 Prefetch::style prefetch_style() { |
288 return Prefetch::do_read; | |
289 } | |
290 void trim_queue(uint size); | |
291 }; | |
292 | |
293 // This closure is used during the concurrent marking phase | |
294 // following the first checkpoint. Its use is buried in | |
295 // the closure MarkFromRootsClosure. | |
935 | 296 class PushOrMarkClosure: public KlassRememberingOopClosure { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
297 private: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
298 MemRegion _span; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
299 CMSBitMap* _bitMap; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
300 CMSMarkStack* _markStack; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
301 HeapWord* const _finger; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
302 MarkFromRootsClosure* const |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
303 _parent; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
304 protected: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
305 DO_OOP_WORK_DEFN |
0 | 306 public: |
307 PushOrMarkClosure(CMSCollector* cms_collector, | |
308 MemRegion span, | |
309 CMSBitMap* bitMap, | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
310 CMSMarkStack* markStack, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
311 CMSMarkStack* revisitStack, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
312 HeapWord* finger, |
0 | 313 MarkFromRootsClosure* parent); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
314 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
|
315 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
|
316 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
|
317 inline void do_oop_nv(narrowOop* p) { PushOrMarkClosure::do_oop_work(p); } |
941 | 318 // In support of class unloading |
319 virtual const bool should_remember_mdo() const { | |
320 return false; | |
321 // return _should_remember_klasses; | |
322 } | |
323 virtual void remember_mdo(DataLayout* v); | |
324 | |
0 | 325 // Deal with a stack overflow condition |
326 void handle_stack_overflow(HeapWord* lost); | |
327 private: | |
328 inline void do_yield_check(); | |
329 }; | |
330 | |
331 // A parallel (MT) version of the above. | |
332 // This closure is used during the concurrent marking phase | |
333 // following the first checkpoint. Its use is buried in | |
334 // the closure Par_MarkFromRootsClosure. | |
935 | 335 class Par_PushOrMarkClosure: public Par_KlassRememberingOopClosure { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
336 private: |
0 | 337 MemRegion _whole_span; |
338 MemRegion _span; // local chunk | |
339 CMSBitMap* _bit_map; | |
340 OopTaskQueue* _work_queue; | |
341 CMSMarkStack* _overflow_stack; | |
342 HeapWord* const _finger; | |
343 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
|
344 Par_MarkFromRootsClosure* const |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
345 _parent; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
346 protected: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
347 DO_OOP_WORK_DEFN |
0 | 348 public: |
349 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
|
350 MemRegion span, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
351 CMSBitMap* bit_map, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
352 OopTaskQueue* work_queue, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
353 CMSMarkStack* mark_stack, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
354 CMSMarkStack* revisit_stack, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
355 HeapWord* finger, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
356 HeapWord** global_finger_addr, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
357 Par_MarkFromRootsClosure* parent); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
358 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
|
359 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
|
360 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
|
361 inline void do_oop_nv(narrowOop* p) { Par_PushOrMarkClosure::do_oop_work(p); } |
941 | 362 // In support of class unloading |
363 virtual const bool should_remember_mdo() const { | |
364 return false; | |
365 // return _should_remember_klasses; | |
366 } | |
367 virtual void remember_mdo(DataLayout* v); | |
368 | |
0 | 369 // Deal with a stack overflow condition |
370 void handle_stack_overflow(HeapWord* lost); | |
371 private: | |
372 inline void do_yield_check(); | |
373 }; | |
374 | |
375 // For objects in CMS generation, this closure marks | |
376 // given objects (transitively) as being reachable/live. | |
377 // 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
|
378 // 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
|
379 // 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
|
380 // reference lists. |
935 | 381 class CMSKeepAliveClosure: public KlassRememberingOopClosure { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
382 private: |
143
b5489bb705c9
6662086: 6u4+, 7b11+: CMS never clears referents when -XX:+ParallelRefProcEnabled
ysr
parents:
113
diff
changeset
|
383 const MemRegion _span; |
0 | 384 CMSMarkStack* _mark_stack; |
385 CMSBitMap* _bit_map; | |
452
00b023ae2d78
6722113: CMS: Incorrect overflow handling during precleaning of Reference lists
ysr
parents:
143
diff
changeset
|
386 bool _concurrent_precleaning; |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
387 protected: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
388 DO_OOP_WORK_DEFN |
0 | 389 public: |
390 CMSKeepAliveClosure(CMSCollector* collector, MemRegion span, | |
452
00b023ae2d78
6722113: CMS: Incorrect overflow handling during precleaning of Reference lists
ysr
parents:
143
diff
changeset
|
391 CMSBitMap* bit_map, CMSMarkStack* mark_stack, |
935 | 392 CMSMarkStack* revisit_stack, bool cpc); |
452
00b023ae2d78
6722113: CMS: Incorrect overflow handling during precleaning of Reference lists
ysr
parents:
143
diff
changeset
|
393 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
|
394 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
|
395 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
|
396 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
|
397 inline void do_oop_nv(narrowOop* p) { CMSKeepAliveClosure::do_oop_work(p); } |
0 | 398 }; |
399 | |
935 | 400 class CMSInnerParMarkAndPushClosure: public Par_KlassRememberingOopClosure { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
401 private: |
0 | 402 MemRegion _span; |
403 OopTaskQueue* _work_queue; | |
404 CMSBitMap* _bit_map; | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
405 protected: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
406 DO_OOP_WORK_DEFN |
0 | 407 public: |
408 CMSInnerParMarkAndPushClosure(CMSCollector* collector, | |
409 MemRegion span, CMSBitMap* bit_map, | |
935 | 410 CMSMarkStack* revisit_stack, |
411 OopTaskQueue* work_queue); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
412 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
|
413 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
|
414 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
|
415 inline void do_oop_nv(narrowOop* p) { CMSInnerParMarkAndPushClosure::do_oop_work(p); } |
0 | 416 }; |
417 | |
418 // A parallel (MT) version of the above, used when | |
419 // reference processing is parallel; the only difference | |
420 // is in the do_oop method. | |
935 | 421 class CMSParKeepAliveClosure: public Par_KlassRememberingOopClosure { |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
422 private: |
0 | 423 MemRegion _span; |
424 OopTaskQueue* _work_queue; | |
425 CMSBitMap* _bit_map; | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
426 CMSInnerParMarkAndPushClosure |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
427 _mark_and_push; |
0 | 428 const uint _low_water_mark; |
429 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
|
430 protected: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
431 DO_OOP_WORK_DEFN |
0 | 432 public: |
433 CMSParKeepAliveClosure(CMSCollector* collector, MemRegion span, | |
935 | 434 CMSBitMap* bit_map, CMSMarkStack* revisit_stack, |
435 OopTaskQueue* work_queue); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
436 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
|
437 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
|
438 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
|
439 inline void do_oop_nv(narrowOop* p) { CMSParKeepAliveClosure::do_oop_work(p); } |
0 | 440 }; |