author | trims |
Thu, 27 May 2010 19:08:38 -0700 | |
changeset 5547 | f4b087cbb361 |
parent 4738 | 25586a89c1c3 |
child 7397 | 5b173b4ca846 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4738
diff
changeset
|
2 |
* Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4738
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4738
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4738
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
25 |
// The following classes are C++ `closures` for iterating over objects, roots and spaces |
|
26 |
||
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
27 |
class CodeBlob; |
3913
e049e6b81e11
6885169: merge of 4957990 and 6863023 causes conflict on do_nmethods
jrose
parents:
3912
diff
changeset
|
28 |
class nmethod; |
1 | 29 |
class ReferenceProcessor; |
3696 | 30 |
class DataLayout; |
1 | 31 |
|
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
32 |
// Closure provides abortability. |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
33 |
|
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
34 |
class Closure : public StackObj { |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
35 |
protected: |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
36 |
bool _abort; |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
37 |
void set_abort() { _abort = true; } |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
38 |
public: |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
39 |
Closure() : _abort(false) {} |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
40 |
// A subtype can use this mechanism to indicate to some iterator mapping |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
41 |
// functions that the iteration should cease. |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
42 |
bool abort() { return _abort; } |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
43 |
void clear_abort() { _abort = false; } |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
44 |
}; |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
45 |
|
1 | 46 |
// OopClosure is used for iterating through roots (oop*) |
47 |
||
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
48 |
class OopClosure : public Closure { |
1 | 49 |
public: |
50 |
ReferenceProcessor* _ref_processor; |
|
51 |
OopClosure(ReferenceProcessor* rp) : _ref_processor(rp) { } |
|
52 |
OopClosure() : _ref_processor(NULL) { } |
|
53 |
virtual void do_oop(oop* o) = 0; |
|
54 |
virtual void do_oop_v(oop* o) { do_oop(o); } |
|
360
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* o) = 0; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
56 |
virtual void do_oop_v(narrowOop* o) { do_oop(o); } |
1 | 57 |
|
58 |
// In support of post-processing of weak links of KlassKlass objects; |
|
59 |
// see KlassKlass::oop_oop_iterate(). |
|
3690 | 60 |
|
61 |
virtual const bool should_remember_klasses() const { |
|
62 |
assert(!must_remember_klasses(), "Should have overriden this method."); |
|
63 |
return false; |
|
64 |
} |
|
65 |
||
1 | 66 |
virtual void remember_klass(Klass* k) { /* do nothing */ } |
67 |
||
3696 | 68 |
// In support of post-processing of weak references in |
69 |
// ProfileData (MethodDataOop) objects; see, for example, |
|
70 |
// VirtualCallData::oop_iterate(). |
|
71 |
virtual const bool should_remember_mdo() const { return false; } |
|
72 |
virtual void remember_mdo(DataLayout* v) { /* do nothing */ } |
|
73 |
||
1 | 74 |
// The methods below control how object iterations invoking this closure |
75 |
// should be performed: |
|
76 |
||
77 |
// If "true", invoke on header klass field. |
|
78 |
bool do_header() { return true; } // Note that this is non-virtual. |
|
79 |
// Controls how prefetching is done for invocations of this closure. |
|
80 |
Prefetch::style prefetch_style() { // Note that this is non-virtual. |
|
81 |
return Prefetch::do_none; |
|
82 |
} |
|
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
83 |
|
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
84 |
// True iff this closure may be safely applied more than once to an oop |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
85 |
// location without an intervening "major reset" (like the end of a GC). |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
86 |
virtual bool idempotent() { return false; } |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
87 |
virtual bool apply_to_weak_ref_discovered_field() { return false; } |
3690 | 88 |
|
89 |
#ifdef ASSERT |
|
90 |
static bool _must_remember_klasses; |
|
91 |
static bool must_remember_klasses(); |
|
92 |
static void set_must_remember_klasses(bool v); |
|
93 |
#endif |
|
1 | 94 |
}; |
95 |
||
96 |
// ObjectClosure is used for iterating through an object space |
|
97 |
||
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
98 |
class ObjectClosure : public Closure { |
1 | 99 |
public: |
100 |
// Called for each object. |
|
101 |
virtual void do_object(oop obj) = 0; |
|
102 |
}; |
|
103 |
||
104 |
||
105 |
class BoolObjectClosure : public ObjectClosure { |
|
106 |
public: |
|
107 |
virtual bool do_object_b(oop obj) = 0; |
|
108 |
}; |
|
109 |
||
110 |
// Applies an oop closure to all ref fields in objects iterated over in an |
|
111 |
// object iteration. |
|
112 |
class ObjectToOopClosure: public ObjectClosure { |
|
113 |
OopClosure* _cl; |
|
114 |
public: |
|
115 |
void do_object(oop obj); |
|
116 |
ObjectToOopClosure(OopClosure* cl) : _cl(cl) {} |
|
117 |
}; |
|
118 |
||
119 |
// A version of ObjectClosure with "memory" (see _previous_address below) |
|
120 |
class UpwardsObjectClosure: public BoolObjectClosure { |
|
121 |
HeapWord* _previous_address; |
|
122 |
public: |
|
123 |
UpwardsObjectClosure() : _previous_address(NULL) { } |
|
124 |
void set_previous(HeapWord* addr) { _previous_address = addr; } |
|
125 |
HeapWord* previous() { return _previous_address; } |
|
126 |
// A return value of "true" can be used by the caller to decide |
|
127 |
// if this object's end should *NOT* be recorded in |
|
128 |
// _previous_address above. |
|
129 |
virtual bool do_object_bm(oop obj, MemRegion mr) = 0; |
|
130 |
}; |
|
131 |
||
132 |
// A version of ObjectClosure that is expected to be robust |
|
133 |
// in the face of possibly uninitialized objects. |
|
134 |
class ObjectClosureCareful : public ObjectClosure { |
|
135 |
public: |
|
136 |
virtual size_t do_object_careful_m(oop p, MemRegion mr) = 0; |
|
137 |
virtual size_t do_object_careful(oop p) = 0; |
|
138 |
}; |
|
139 |
||
140 |
// The following are used in CompactibleFreeListSpace and |
|
141 |
// ConcurrentMarkSweepGeneration. |
|
142 |
||
143 |
// Blk closure (abstract class) |
|
144 |
class BlkClosure : public StackObj { |
|
145 |
public: |
|
146 |
virtual size_t do_blk(HeapWord* addr) = 0; |
|
147 |
}; |
|
148 |
||
149 |
// A version of BlkClosure that is expected to be robust |
|
150 |
// in the face of possibly uninitialized objects. |
|
151 |
class BlkClosureCareful : public BlkClosure { |
|
152 |
public: |
|
153 |
size_t do_blk(HeapWord* addr) { |
|
154 |
guarantee(false, "call do_blk_careful instead"); |
|
155 |
return 0; |
|
156 |
} |
|
157 |
virtual size_t do_blk_careful(HeapWord* addr) = 0; |
|
158 |
}; |
|
159 |
||
160 |
// SpaceClosure is used for iterating over spaces |
|
161 |
||
162 |
class Space; |
|
163 |
class CompactibleSpace; |
|
164 |
||
165 |
class SpaceClosure : public StackObj { |
|
166 |
public: |
|
167 |
// Called for each space |
|
168 |
virtual void do_space(Space* s) = 0; |
|
169 |
}; |
|
170 |
||
171 |
class CompactibleSpaceClosure : public StackObj { |
|
172 |
public: |
|
173 |
// Called for each compactible space |
|
174 |
virtual void do_space(CompactibleSpace* s) = 0; |
|
175 |
}; |
|
176 |
||
177 |
||
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
178 |
// CodeBlobClosure is used for iterating through code blobs |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
179 |
// in the code cache or on thread stacks |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
180 |
|
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
181 |
class CodeBlobClosure : public Closure { |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
182 |
public: |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
183 |
// Called for each code blob. |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
184 |
virtual void do_code_blob(CodeBlob* cb) = 0; |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
185 |
}; |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
186 |
|
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
187 |
|
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
188 |
class MarkingCodeBlobClosure : public CodeBlobClosure { |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
189 |
public: |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
190 |
// Called for each code blob, but at most once per unique blob. |
3913
e049e6b81e11
6885169: merge of 4957990 and 6863023 causes conflict on do_nmethods
jrose
parents:
3912
diff
changeset
|
191 |
virtual void do_newly_marked_nmethod(nmethod* nm) = 0; |
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
192 |
|
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
193 |
virtual void do_code_blob(CodeBlob* cb); |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
194 |
// = { if (!nmethod(cb)->test_set_oops_do_mark()) do_newly_marked_nmethod(cb); } |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
195 |
|
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
196 |
class MarkScope : public StackObj { |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
197 |
protected: |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
198 |
bool _active; |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
199 |
public: |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
200 |
MarkScope(bool activate = true); |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
201 |
// = { if (active) nmethod::oops_do_marking_prologue(); } |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
202 |
~MarkScope(); |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
203 |
// = { if (active) nmethod::oops_do_marking_epilogue(); } |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
204 |
}; |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
205 |
}; |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
206 |
|
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
207 |
|
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
208 |
// Applies an oop closure to all ref fields in code blobs |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
209 |
// iterated over in an object iteration. |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
210 |
class CodeBlobToOopClosure: public MarkingCodeBlobClosure { |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
211 |
OopClosure* _cl; |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
212 |
bool _do_marking; |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
213 |
public: |
3913
e049e6b81e11
6885169: merge of 4957990 and 6863023 causes conflict on do_nmethods
jrose
parents:
3912
diff
changeset
|
214 |
virtual void do_newly_marked_nmethod(nmethod* cb); |
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
215 |
// = { cb->oops_do(_cl); } |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
216 |
virtual void do_code_blob(CodeBlob* cb); |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
217 |
// = { if (_do_marking) super::do_code_blob(cb); else cb->oops_do(_cl); } |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
218 |
CodeBlobToOopClosure(OopClosure* cl, bool do_marking) |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
219 |
: _cl(cl), _do_marking(do_marking) {} |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
220 |
}; |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
221 |
|
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
1388
diff
changeset
|
222 |
|
1 | 223 |
|
224 |
// MonitorClosure is used for iterating over monitors in the monitors cache |
|
225 |
||
226 |
class ObjectMonitor; |
|
227 |
||
228 |
class MonitorClosure : public StackObj { |
|
229 |
public: |
|
230 |
// called for each monitor in cache |
|
231 |
virtual void do_monitor(ObjectMonitor* m) = 0; |
|
232 |
}; |
|
233 |
||
234 |
// A closure that is applied without any arguments. |
|
235 |
class VoidClosure : public StackObj { |
|
236 |
public: |
|
237 |
// I would have liked to declare this a pure virtual, but that breaks |
|
238 |
// in mysterious ways, for unknown reasons. |
|
239 |
virtual void do_void(); |
|
240 |
}; |
|
241 |
||
242 |
||
243 |
// YieldClosure is intended for use by iteration loops |
|
244 |
// to incrementalize their work, allowing interleaving |
|
245 |
// of an interruptable task so as to allow other |
|
246 |
// threads to run (which may not otherwise be able to access |
|
247 |
// exclusive resources, for instance). Additionally, the |
|
248 |
// closure also allows for aborting an ongoing iteration |
|
249 |
// by means of checking the return value from the polling |
|
250 |
// call. |
|
251 |
class YieldClosure : public StackObj { |
|
252 |
public: |
|
253 |
virtual bool should_return() = 0; |
|
254 |
}; |
|
255 |
||
256 |
// Abstract closure for serializing data (read or write). |
|
257 |
||
258 |
class SerializeOopClosure : public OopClosure { |
|
259 |
public: |
|
260 |
// Return bool indicating whether closure implements read or write. |
|
261 |
virtual bool reading() const = 0; |
|
262 |
||
263 |
// Read/write the int pointed to by i. |
|
264 |
virtual void do_int(int* i) = 0; |
|
265 |
||
266 |
// Read/write the size_t pointed to by i. |
|
267 |
virtual void do_size_t(size_t* i) = 0; |
|
268 |
||
269 |
// Read/write the void pointer pointed to by p. |
|
270 |
virtual void do_ptr(void** p) = 0; |
|
271 |
||
272 |
// Read/write the HeapWord pointer pointed to be p. |
|
273 |
virtual void do_ptr(HeapWord** p) = 0; |
|
274 |
||
275 |
// Read/write the region specified. |
|
276 |
virtual void do_region(u_char* start, size_t size) = 0; |
|
277 |
||
278 |
// Check/write the tag. If reading, then compare the tag against |
|
279 |
// the passed in value and fail is they don't match. This allows |
|
280 |
// for verification that sections of the serialized data are of the |
|
281 |
// correct length. |
|
282 |
virtual void do_tag(int tag) = 0; |
|
283 |
}; |
|
3690 | 284 |
|
285 |
#ifdef ASSERT |
|
286 |
// This class is used to flag phases of a collection that |
|
287 |
// can unload classes and which should override the |
|
288 |
// should_remember_klasses() and remember_klass() of OopClosure. |
|
289 |
// The _must_remember_klasses is set in the contructor and restored |
|
290 |
// in the destructor. _must_remember_klasses is checked in assertions |
|
291 |
// in the OopClosure implementations of should_remember_klasses() and |
|
292 |
// remember_klass() and the expectation is that the OopClosure |
|
293 |
// implementation should not be in use if _must_remember_klasses is set. |
|
294 |
// Instances of RememberKlassesChecker can be place in |
|
295 |
// marking phases of collections which can do class unloading. |
|
296 |
// RememberKlassesChecker can be passed "false" to turn off checking. |
|
297 |
// It is used by CMS when CMS yields to a different collector. |
|
298 |
class RememberKlassesChecker: StackObj { |
|
4738
25586a89c1c3
6895236: CMS: cmsOopClosures.inline.hpp:43 assert(..., "Should remember klasses in this context")
jmasa
parents:
3919
diff
changeset
|
299 |
bool _saved_state; |
25586a89c1c3
6895236: CMS: cmsOopClosures.inline.hpp:43 assert(..., "Should remember klasses in this context")
jmasa
parents:
3919
diff
changeset
|
300 |
bool _do_check; |
3690 | 301 |
public: |
4738
25586a89c1c3
6895236: CMS: cmsOopClosures.inline.hpp:43 assert(..., "Should remember klasses in this context")
jmasa
parents:
3919
diff
changeset
|
302 |
RememberKlassesChecker(bool checking_on) : _saved_state(false), |
25586a89c1c3
6895236: CMS: cmsOopClosures.inline.hpp:43 assert(..., "Should remember klasses in this context")
jmasa
parents:
3919
diff
changeset
|
303 |
_do_check(true) { |
25586a89c1c3
6895236: CMS: cmsOopClosures.inline.hpp:43 assert(..., "Should remember klasses in this context")
jmasa
parents:
3919
diff
changeset
|
304 |
// The ClassUnloading unloading flag affects the collectors except |
25586a89c1c3
6895236: CMS: cmsOopClosures.inline.hpp:43 assert(..., "Should remember klasses in this context")
jmasa
parents:
3919
diff
changeset
|
305 |
// for CMS. |
25586a89c1c3
6895236: CMS: cmsOopClosures.inline.hpp:43 assert(..., "Should remember klasses in this context")
jmasa
parents:
3919
diff
changeset
|
306 |
// CMS unloads classes if CMSClassUnloadingEnabled is true or |
25586a89c1c3
6895236: CMS: cmsOopClosures.inline.hpp:43 assert(..., "Should remember klasses in this context")
jmasa
parents:
3919
diff
changeset
|
307 |
// if ExplicitGCInvokesConcurrentAndUnloadsClasses is true and |
25586a89c1c3
6895236: CMS: cmsOopClosures.inline.hpp:43 assert(..., "Should remember klasses in this context")
jmasa
parents:
3919
diff
changeset
|
308 |
// the current collection is an explicit collection. Turning |
25586a89c1c3
6895236: CMS: cmsOopClosures.inline.hpp:43 assert(..., "Should remember klasses in this context")
jmasa
parents:
3919
diff
changeset
|
309 |
// on the checking in general for |
25586a89c1c3
6895236: CMS: cmsOopClosures.inline.hpp:43 assert(..., "Should remember klasses in this context")
jmasa
parents:
3919
diff
changeset
|
310 |
// ExplicitGCInvokesConcurrentAndUnloadsClasses and |
25586a89c1c3
6895236: CMS: cmsOopClosures.inline.hpp:43 assert(..., "Should remember klasses in this context")
jmasa
parents:
3919
diff
changeset
|
311 |
// UseConcMarkSweepGC should not lead to false positives. |
25586a89c1c3
6895236: CMS: cmsOopClosures.inline.hpp:43 assert(..., "Should remember klasses in this context")
jmasa
parents:
3919
diff
changeset
|
312 |
_do_check = |
25586a89c1c3
6895236: CMS: cmsOopClosures.inline.hpp:43 assert(..., "Should remember klasses in this context")
jmasa
parents:
3919
diff
changeset
|
313 |
ClassUnloading && !UseConcMarkSweepGC || |
25586a89c1c3
6895236: CMS: cmsOopClosures.inline.hpp:43 assert(..., "Should remember klasses in this context")
jmasa
parents:
3919
diff
changeset
|
314 |
CMSClassUnloadingEnabled && UseConcMarkSweepGC || |
25586a89c1c3
6895236: CMS: cmsOopClosures.inline.hpp:43 assert(..., "Should remember klasses in this context")
jmasa
parents:
3919
diff
changeset
|
315 |
ExplicitGCInvokesConcurrentAndUnloadsClasses && UseConcMarkSweepGC; |
25586a89c1c3
6895236: CMS: cmsOopClosures.inline.hpp:43 assert(..., "Should remember klasses in this context")
jmasa
parents:
3919
diff
changeset
|
316 |
if (_do_check) { |
25586a89c1c3
6895236: CMS: cmsOopClosures.inline.hpp:43 assert(..., "Should remember klasses in this context")
jmasa
parents:
3919
diff
changeset
|
317 |
_saved_state = OopClosure::must_remember_klasses(); |
25586a89c1c3
6895236: CMS: cmsOopClosures.inline.hpp:43 assert(..., "Should remember klasses in this context")
jmasa
parents:
3919
diff
changeset
|
318 |
OopClosure::set_must_remember_klasses(checking_on); |
3690 | 319 |
} |
320 |
} |
|
321 |
~RememberKlassesChecker() { |
|
4738
25586a89c1c3
6895236: CMS: cmsOopClosures.inline.hpp:43 assert(..., "Should remember klasses in this context")
jmasa
parents:
3919
diff
changeset
|
322 |
if (_do_check) { |
25586a89c1c3
6895236: CMS: cmsOopClosures.inline.hpp:43 assert(..., "Should remember klasses in this context")
jmasa
parents:
3919
diff
changeset
|
323 |
OopClosure::set_must_remember_klasses(_saved_state); |
3690 | 324 |
} |
325 |
} |
|
326 |
}; |
|
327 |
#endif // ASSERT |