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