comparison src/share/vm/memory/iterator.hpp @ 1190:4788266644c1

6895236: CMS: cmsOopClosures.inline.hpp:43 assert(..., "Should remember klasses in this context") Summary: Adjust assertion checking for ExplicitGCInvokesConcurrentAndUnloadsClasses as a reason for class unloading Reviewed-by: ysr
author jmasa
date Thu, 21 Jan 2010 11:33:32 -0800
parents a1423fe86a18
children c18cbe5936b8
comparison
equal deleted inserted replaced
1170:c4d722788ed6 1190:4788266644c1
294 // Instances of RememberKlassesChecker can be place in 294 // Instances of RememberKlassesChecker can be place in
295 // marking phases of collections which can do class unloading. 295 // marking phases of collections which can do class unloading.
296 // RememberKlassesChecker can be passed "false" to turn off checking. 296 // RememberKlassesChecker can be passed "false" to turn off checking.
297 // It is used by CMS when CMS yields to a different collector. 297 // It is used by CMS when CMS yields to a different collector.
298 class RememberKlassesChecker: StackObj { 298 class RememberKlassesChecker: StackObj {
299 bool _state; 299 bool _saved_state;
300 bool _skip; 300 bool _do_check;
301 public: 301 public:
302 RememberKlassesChecker(bool checking_on) : _state(false), _skip(false) { 302 RememberKlassesChecker(bool checking_on) : _saved_state(false),
303 _skip = !(ClassUnloading && !UseConcMarkSweepGC || 303 _do_check(true) {
304 CMSClassUnloadingEnabled && UseConcMarkSweepGC); 304 // The ClassUnloading unloading flag affects the collectors except
305 if (_skip) { 305 // for CMS.
306 return; 306 // CMS unloads classes if CMSClassUnloadingEnabled is true or
307 // if ExplicitGCInvokesConcurrentAndUnloadsClasses is true and
308 // the current collection is an explicit collection. Turning
309 // on the checking in general for
310 // ExplicitGCInvokesConcurrentAndUnloadsClasses and
311 // UseConcMarkSweepGC should not lead to false positives.
312 _do_check =
313 ClassUnloading && !UseConcMarkSweepGC ||
314 CMSClassUnloadingEnabled && UseConcMarkSweepGC ||
315 ExplicitGCInvokesConcurrentAndUnloadsClasses && UseConcMarkSweepGC;
316 if (_do_check) {
317 _saved_state = OopClosure::must_remember_klasses();
318 OopClosure::set_must_remember_klasses(checking_on);
307 } 319 }
308 _state = OopClosure::must_remember_klasses();
309 OopClosure::set_must_remember_klasses(checking_on);
310 } 320 }
311 ~RememberKlassesChecker() { 321 ~RememberKlassesChecker() {
312 if (_skip) { 322 if (_do_check) {
313 return; 323 OopClosure::set_must_remember_klasses(_saved_state);
314 } 324 }
315 OopClosure::set_must_remember_klasses(_state);
316 } 325 }
317 }; 326 };
318 #endif // ASSERT 327 #endif // ASSERT