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