author | jmasa |
Mon, 24 Aug 2009 10:36:31 -0700 | |
changeset 3690 | dba50b88bd50 |
parent 1605 | 6b43d186eb8d |
child 3696 | 9e5d9b5e1049 |
permissions | -rw-r--r-- |
1 | 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 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
35 |
// Decode the oop and call do_oop on it. |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
36 |
#define DO_OOP_WORK_DEFN \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
37 |
void do_oop(oop obj); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
38 |
template <class T> inline void do_oop_work(T* p) { \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
39 |
T heap_oop = oopDesc::load_heap_oop(p); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
40 |
if (!oopDesc::is_null(heap_oop)) { \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
41 |
oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
42 |
do_oop(obj); \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
43 |
} \ |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
44 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
45 |
|
1 | 46 |
class MarkRefsIntoClosure: public OopsInGenClosure { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
47 |
private: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
48 |
const MemRegion _span; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
49 |
CMSBitMap* _bitMap; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
50 |
const bool _should_do_nmethods; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
51 |
protected: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
52 |
DO_OOP_WORK_DEFN |
1 | 53 |
public: |
54 |
MarkRefsIntoClosure(MemRegion span, CMSBitMap* bitMap, |
|
55 |
bool should_do_nmethods); |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
56 |
virtual void do_oop(oop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
57 |
virtual void do_oop(narrowOop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
58 |
inline void do_oop_nv(oop* p) { MarkRefsIntoClosure::do_oop_work(p); } |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
59 |
inline void do_oop_nv(narrowOop* p) { MarkRefsIntoClosure::do_oop_work(p); } |
1 | 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 { |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
72 |
private: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
73 |
const MemRegion _span; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
74 |
CMSBitMap* _verification_bm; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
75 |
CMSBitMap* _cms_bm; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
76 |
const bool _should_do_nmethods; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
77 |
protected: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
78 |
DO_OOP_WORK_DEFN |
1 | 79 |
public: |
80 |
MarkRefsIntoVerifyClosure(MemRegion span, CMSBitMap* verification_bm, |
|
81 |
CMSBitMap* cms_bm, bool should_do_nmethods); |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
82 |
virtual void do_oop(oop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
83 |
virtual void do_oop(narrowOop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
84 |
inline void do_oop_nv(oop* p) { MarkRefsIntoVerifyClosure::do_oop_work(p); } |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
85 |
inline void do_oop_nv(narrowOop* p) { MarkRefsIntoVerifyClosure::do_oop_work(p); } |
1 | 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 |
||
3690 | 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 |
||
1 | 131 |
// The non-parallel version (the parallel version appears further below). |
3690 | 132 |
class PushAndMarkClosure: public KlassRememberingOopClosure { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
133 |
private: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
134 |
MemRegion _span; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
135 |
CMSBitMap* _bit_map; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
136 |
CMSBitMap* _mod_union_table; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
137 |
CMSMarkStack* _mark_stack; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
138 |
bool _concurrent_precleaning; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
139 |
protected: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
140 |
DO_OOP_WORK_DEFN |
1 | 141 |
public: |
142 |
PushAndMarkClosure(CMSCollector* collector, |
|
143 |
MemRegion span, |
|
144 |
ReferenceProcessor* rp, |
|
145 |
CMSBitMap* bit_map, |
|
146 |
CMSBitMap* mod_union_table, |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
147 |
CMSMarkStack* mark_stack, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
148 |
CMSMarkStack* revisit_stack, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
149 |
bool concurrent_precleaning); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
150 |
virtual void do_oop(oop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
151 |
virtual void do_oop(narrowOop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
152 |
inline void do_oop_nv(oop* p) { PushAndMarkClosure::do_oop_work(p); } |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
153 |
inline void do_oop_nv(narrowOop* p) { PushAndMarkClosure::do_oop_work(p); } |
1 | 154 |
bool do_header() { return true; } |
155 |
Prefetch::style prefetch_style() { |
|
156 |
return Prefetch::do_read; |
|
157 |
} |
|
158 |
}; |
|
159 |
||
160 |
// In the parallel case, the revisit stack, the bit map and the |
|
161 |
// reference processor are currently all shared. Access to |
|
162 |
// these shared mutable structures must use appropriate |
|
163 |
// synchronization (for instance, via CAS). The marking stack |
|
164 |
// used in the non-parallel case above is here replaced with |
|
165 |
// an OopTaskQueue structure to allow efficient work stealing. |
|
3690 | 166 |
class Par_PushAndMarkClosure: public Par_KlassRememberingOopClosure { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
167 |
private: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
168 |
MemRegion _span; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
169 |
CMSBitMap* _bit_map; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
170 |
OopTaskQueue* _work_queue; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
171 |
protected: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
172 |
DO_OOP_WORK_DEFN |
1 | 173 |
public: |
174 |
Par_PushAndMarkClosure(CMSCollector* collector, |
|
175 |
MemRegion span, |
|
176 |
ReferenceProcessor* rp, |
|
177 |
CMSBitMap* bit_map, |
|
178 |
OopTaskQueue* work_queue, |
|
179 |
CMSMarkStack* revisit_stack); |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
180 |
virtual void do_oop(oop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
181 |
virtual void do_oop(narrowOop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
182 |
inline void do_oop_nv(oop* p) { Par_PushAndMarkClosure::do_oop_work(p); } |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
183 |
inline void do_oop_nv(narrowOop* p) { Par_PushAndMarkClosure::do_oop_work(p); } |
1 | 184 |
bool do_header() { return true; } |
185 |
Prefetch::style prefetch_style() { |
|
186 |
return Prefetch::do_read; |
|
187 |
} |
|
188 |
}; |
|
189 |
||
190 |
// The non-parallel version (the parallel version appears further below). |
|
191 |
class MarkRefsIntoAndScanClosure: public OopsInGenClosure { |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
192 |
private: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
193 |
MemRegion _span; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
194 |
CMSBitMap* _bit_map; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
195 |
CMSMarkStack* _mark_stack; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
196 |
PushAndMarkClosure _pushAndMarkClosure; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
197 |
CMSCollector* _collector; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
198 |
Mutex* _freelistLock; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
199 |
bool _yield; |
1 | 200 |
// Whether closure is being used for concurrent precleaning |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
201 |
bool _concurrent_precleaning; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
202 |
protected: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
203 |
DO_OOP_WORK_DEFN |
1 | 204 |
public: |
205 |
MarkRefsIntoAndScanClosure(MemRegion span, |
|
206 |
ReferenceProcessor* rp, |
|
207 |
CMSBitMap* bit_map, |
|
208 |
CMSBitMap* mod_union_table, |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
209 |
CMSMarkStack* mark_stack, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
210 |
CMSMarkStack* revisit_stack, |
1 | 211 |
CMSCollector* collector, |
212 |
bool should_yield, |
|
213 |
bool concurrent_precleaning); |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
214 |
virtual void do_oop(oop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
215 |
virtual void do_oop(narrowOop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
216 |
inline void do_oop_nv(oop* p) { MarkRefsIntoAndScanClosure::do_oop_work(p); } |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
217 |
inline void do_oop_nv(narrowOop* p) { MarkRefsIntoAndScanClosure::do_oop_work(p); } |
1 | 218 |
bool do_header() { return true; } |
219 |
virtual const bool do_nmethods() const { return true; } |
|
220 |
Prefetch::style prefetch_style() { |
|
221 |
return Prefetch::do_read; |
|
222 |
} |
|
223 |
void set_freelistLock(Mutex* m) { |
|
224 |
_freelistLock = m; |
|
225 |
} |
|
3690 | 226 |
virtual const bool should_remember_klasses() const { |
227 |
return _pushAndMarkClosure.should_remember_klasses(); |
|
228 |
} |
|
229 |
virtual void remember_klass(Klass* k) { |
|
230 |
_pushAndMarkClosure.remember_klass(k); |
|
231 |
} |
|
1 | 232 |
|
233 |
private: |
|
234 |
inline void do_yield_check(); |
|
235 |
void do_yield_work(); |
|
236 |
bool take_from_overflow_list(); |
|
237 |
}; |
|
238 |
||
239 |
// Tn this, the parallel avatar of MarkRefsIntoAndScanClosure, the revisit |
|
240 |
// stack and the bitMap are shared, so access needs to be suitably |
|
241 |
// sycnhronized. An OopTaskQueue structure, supporting efficient |
|
242 |
// workstealing, replaces a CMSMarkStack for storing grey objects. |
|
243 |
class Par_MarkRefsIntoAndScanClosure: public OopsInGenClosure { |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
244 |
private: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
245 |
MemRegion _span; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
246 |
CMSBitMap* _bit_map; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
247 |
OopTaskQueue* _work_queue; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
248 |
const uint _low_water_mark; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
249 |
Par_PushAndMarkClosure _par_pushAndMarkClosure; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
250 |
protected: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
251 |
DO_OOP_WORK_DEFN |
1 | 252 |
public: |
253 |
Par_MarkRefsIntoAndScanClosure(CMSCollector* collector, |
|
254 |
MemRegion span, |
|
255 |
ReferenceProcessor* rp, |
|
256 |
CMSBitMap* bit_map, |
|
257 |
OopTaskQueue* work_queue, |
|
258 |
CMSMarkStack* revisit_stack); |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
259 |
virtual void do_oop(oop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
260 |
virtual void do_oop(narrowOop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
261 |
inline void do_oop_nv(oop* p) { Par_MarkRefsIntoAndScanClosure::do_oop_work(p); } |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
262 |
inline void do_oop_nv(narrowOop* p) { Par_MarkRefsIntoAndScanClosure::do_oop_work(p); } |
1 | 263 |
bool do_header() { return true; } |
264 |
virtual const bool do_nmethods() const { return true; } |
|
3690 | 265 |
// When ScanMarkedObjectsAgainClosure is used, |
266 |
// it passes [Par_]MarkRefsIntoAndScanClosure to oop_oop_iterate(), |
|
267 |
// and this delegation is used. |
|
268 |
virtual const bool should_remember_klasses() const { |
|
269 |
return _par_pushAndMarkClosure.should_remember_klasses(); |
|
270 |
} |
|
271 |
// See comment on should_remember_klasses() above. |
|
272 |
virtual void remember_klass(Klass* k) { |
|
273 |
_par_pushAndMarkClosure.remember_klass(k); |
|
274 |
} |
|
1 | 275 |
Prefetch::style prefetch_style() { |
276 |
return Prefetch::do_read; |
|
277 |
} |
|
278 |
void trim_queue(uint size); |
|
279 |
}; |
|
280 |
||
281 |
// This closure is used during the concurrent marking phase |
|
282 |
// following the first checkpoint. Its use is buried in |
|
283 |
// the closure MarkFromRootsClosure. |
|
3690 | 284 |
class PushOrMarkClosure: public KlassRememberingOopClosure { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
285 |
private: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
286 |
MemRegion _span; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
287 |
CMSBitMap* _bitMap; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
288 |
CMSMarkStack* _markStack; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
289 |
HeapWord* const _finger; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
290 |
MarkFromRootsClosure* const |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
291 |
_parent; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
292 |
protected: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
293 |
DO_OOP_WORK_DEFN |
1 | 294 |
public: |
295 |
PushOrMarkClosure(CMSCollector* cms_collector, |
|
296 |
MemRegion span, |
|
297 |
CMSBitMap* bitMap, |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
298 |
CMSMarkStack* markStack, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
299 |
CMSMarkStack* revisitStack, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
300 |
HeapWord* finger, |
1 | 301 |
MarkFromRootsClosure* parent); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
302 |
virtual void do_oop(oop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
303 |
virtual void do_oop(narrowOop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
304 |
inline void do_oop_nv(oop* p) { PushOrMarkClosure::do_oop_work(p); } |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
305 |
inline void do_oop_nv(narrowOop* p) { PushOrMarkClosure::do_oop_work(p); } |
1 | 306 |
// Deal with a stack overflow condition |
307 |
void handle_stack_overflow(HeapWord* lost); |
|
308 |
private: |
|
309 |
inline void do_yield_check(); |
|
310 |
}; |
|
311 |
||
312 |
// A parallel (MT) version of the above. |
|
313 |
// This closure is used during the concurrent marking phase |
|
314 |
// following the first checkpoint. Its use is buried in |
|
315 |
// the closure Par_MarkFromRootsClosure. |
|
3690 | 316 |
class Par_PushOrMarkClosure: public Par_KlassRememberingOopClosure { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
317 |
private: |
1 | 318 |
MemRegion _whole_span; |
319 |
MemRegion _span; // local chunk |
|
320 |
CMSBitMap* _bit_map; |
|
321 |
OopTaskQueue* _work_queue; |
|
322 |
CMSMarkStack* _overflow_stack; |
|
323 |
HeapWord* const _finger; |
|
324 |
HeapWord** const _global_finger_addr; |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
325 |
Par_MarkFromRootsClosure* const |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
326 |
_parent; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
327 |
protected: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
328 |
DO_OOP_WORK_DEFN |
1 | 329 |
public: |
330 |
Par_PushOrMarkClosure(CMSCollector* cms_collector, |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
331 |
MemRegion span, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
332 |
CMSBitMap* bit_map, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
333 |
OopTaskQueue* work_queue, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
334 |
CMSMarkStack* mark_stack, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
335 |
CMSMarkStack* revisit_stack, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
336 |
HeapWord* finger, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
337 |
HeapWord** global_finger_addr, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
338 |
Par_MarkFromRootsClosure* parent); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
339 |
virtual void do_oop(oop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
340 |
virtual void do_oop(narrowOop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
341 |
inline void do_oop_nv(oop* p) { Par_PushOrMarkClosure::do_oop_work(p); } |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
342 |
inline void do_oop_nv(narrowOop* p) { Par_PushOrMarkClosure::do_oop_work(p); } |
1 | 343 |
// Deal with a stack overflow condition |
344 |
void handle_stack_overflow(HeapWord* lost); |
|
345 |
private: |
|
346 |
inline void do_yield_check(); |
|
347 |
}; |
|
348 |
||
349 |
// For objects in CMS generation, this closure marks |
|
350 |
// given objects (transitively) as being reachable/live. |
|
351 |
// This is currently used during the (weak) reference object |
|
1605
6b43d186eb8d
6722113: CMS: Incorrect overflow handling during precleaning of Reference lists
ysr
parents:
390
diff
changeset
|
352 |
// processing phase of the CMS final checkpoint step, as |
6b43d186eb8d
6722113: CMS: Incorrect overflow handling during precleaning of Reference lists
ysr
parents:
390
diff
changeset
|
353 |
// well as during the concurrent precleaning of the discovered |
6b43d186eb8d
6722113: CMS: Incorrect overflow handling during precleaning of Reference lists
ysr
parents:
390
diff
changeset
|
354 |
// reference lists. |
3690 | 355 |
class CMSKeepAliveClosure: public KlassRememberingOopClosure { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
356 |
private: |
390
2e094c1be4af
6662086: 6u4+, 7b11+: CMS never clears referents when -XX:+ParallelRefProcEnabled
ysr
parents:
360
diff
changeset
|
357 |
const MemRegion _span; |
1 | 358 |
CMSMarkStack* _mark_stack; |
359 |
CMSBitMap* _bit_map; |
|
1605
6b43d186eb8d
6722113: CMS: Incorrect overflow handling during precleaning of Reference lists
ysr
parents:
390
diff
changeset
|
360 |
bool _concurrent_precleaning; |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
361 |
protected: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
362 |
DO_OOP_WORK_DEFN |
1 | 363 |
public: |
364 |
CMSKeepAliveClosure(CMSCollector* collector, MemRegion span, |
|
1605
6b43d186eb8d
6722113: CMS: Incorrect overflow handling during precleaning of Reference lists
ysr
parents:
390
diff
changeset
|
365 |
CMSBitMap* bit_map, CMSMarkStack* mark_stack, |
3690 | 366 |
CMSMarkStack* revisit_stack, bool cpc); |
1605
6b43d186eb8d
6722113: CMS: Incorrect overflow handling during precleaning of Reference lists
ysr
parents:
390
diff
changeset
|
367 |
bool concurrent_precleaning() const { return _concurrent_precleaning; } |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
368 |
virtual void do_oop(oop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
369 |
virtual void do_oop(narrowOop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
370 |
inline void do_oop_nv(oop* p) { CMSKeepAliveClosure::do_oop_work(p); } |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
371 |
inline void do_oop_nv(narrowOop* p) { CMSKeepAliveClosure::do_oop_work(p); } |
1 | 372 |
}; |
373 |
||
3690 | 374 |
class CMSInnerParMarkAndPushClosure: public Par_KlassRememberingOopClosure { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
375 |
private: |
1 | 376 |
MemRegion _span; |
377 |
OopTaskQueue* _work_queue; |
|
378 |
CMSBitMap* _bit_map; |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
379 |
protected: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
380 |
DO_OOP_WORK_DEFN |
1 | 381 |
public: |
382 |
CMSInnerParMarkAndPushClosure(CMSCollector* collector, |
|
383 |
MemRegion span, CMSBitMap* bit_map, |
|
3690 | 384 |
CMSMarkStack* revisit_stack, |
385 |
OopTaskQueue* work_queue); |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
386 |
virtual void do_oop(oop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
387 |
virtual void do_oop(narrowOop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
388 |
inline void do_oop_nv(oop* p) { CMSInnerParMarkAndPushClosure::do_oop_work(p); } |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
389 |
inline void do_oop_nv(narrowOop* p) { CMSInnerParMarkAndPushClosure::do_oop_work(p); } |
1 | 390 |
}; |
391 |
||
392 |
// A parallel (MT) version of the above, used when |
|
393 |
// reference processing is parallel; the only difference |
|
394 |
// is in the do_oop method. |
|
3690 | 395 |
class CMSParKeepAliveClosure: public Par_KlassRememberingOopClosure { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
396 |
private: |
1 | 397 |
MemRegion _span; |
398 |
OopTaskQueue* _work_queue; |
|
399 |
CMSBitMap* _bit_map; |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
400 |
CMSInnerParMarkAndPushClosure |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
401 |
_mark_and_push; |
1 | 402 |
const uint _low_water_mark; |
403 |
void trim_queue(uint max); |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
404 |
protected: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
405 |
DO_OOP_WORK_DEFN |
1 | 406 |
public: |
407 |
CMSParKeepAliveClosure(CMSCollector* collector, MemRegion span, |
|
3690 | 408 |
CMSBitMap* bit_map, CMSMarkStack* revisit_stack, |
409 |
OopTaskQueue* work_queue); |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
410 |
virtual void do_oop(oop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
411 |
virtual void do_oop(narrowOop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
412 |
inline void do_oop_nv(oop* p) { CMSParKeepAliveClosure::do_oop_work(p); } |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
413 |
inline void do_oop_nv(narrowOop* p) { CMSParKeepAliveClosure::do_oop_work(p); } |
1 | 414 |
}; |