comparison src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @ 20254:9fec19bb0659

8032379: Remove the is_scavenging flag to process_strong_roots Summary: Refactor the strong root processing to avoid using a boolean in addition to the ScanOption enum. Reviewed-by: stefank, tschatzl, ehelin, jmasa
author mgerdin
date Tue, 14 Jan 2014 16:40:33 +0100
parents ce8f6bb717c9
children 7426d8d76305
comparison
equal deleted inserted replaced
20253:731e8175d53f 20254:9fec19bb0659
3036 gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel. 3036 gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
3037 3037
3038 gch->gen_process_strong_roots(_cmsGen->level(), 3038 gch->gen_process_strong_roots(_cmsGen->level(),
3039 true, // younger gens are roots 3039 true, // younger gens are roots
3040 true, // activate StrongRootsScope 3040 true, // activate StrongRootsScope
3041 false, // not scavenging
3042 SharedHeap::ScanningOption(roots_scanning_options()), 3041 SharedHeap::ScanningOption(roots_scanning_options()),
3043 &notOlder, 3042 &notOlder,
3044 true, // walk code active on stacks 3043 true, // walk code active on stacks
3045 NULL, 3044 NULL,
3046 NULL); // SSS: Provide correct closure 3045 NULL); // SSS: Provide correct closure
3104 3103
3105 gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel. 3104 gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
3106 gch->gen_process_strong_roots(_cmsGen->level(), 3105 gch->gen_process_strong_roots(_cmsGen->level(),
3107 true, // younger gens are roots 3106 true, // younger gens are roots
3108 true, // activate StrongRootsScope 3107 true, // activate StrongRootsScope
3109 false, // not scavenging
3110 SharedHeap::ScanningOption(roots_scanning_options()), 3108 SharedHeap::ScanningOption(roots_scanning_options()),
3111 &notOlder, 3109 &notOlder,
3112 true, // walk code active on stacks 3110 true, // walk code active on stacks
3113 NULL, 3111 NULL,
3114 &klass_closure); 3112 &klass_closure);
3306 } 3304 }
3307 3305
3308 void CMSCollector::setup_cms_unloading_and_verification_state() { 3306 void CMSCollector::setup_cms_unloading_and_verification_state() {
3309 const bool should_verify = VerifyBeforeGC || VerifyAfterGC || VerifyDuringGC 3307 const bool should_verify = VerifyBeforeGC || VerifyAfterGC || VerifyDuringGC
3310 || VerifyBeforeExit; 3308 || VerifyBeforeExit;
3311 const int rso = SharedHeap::SO_Strings | SharedHeap::SO_CodeCache; 3309 const int rso = SharedHeap::SO_Strings | SharedHeap::SO_AllCodeCache;
3312 3310
3313 // We set the proper root for this CMS cycle here. 3311 // We set the proper root for this CMS cycle here.
3314 if (should_unload_classes()) { // Should unload classes this cycle 3312 if (should_unload_classes()) { // Should unload classes this cycle
3315 remove_root_scanning_option(SharedHeap::SO_AllClasses); 3313 remove_root_scanning_option(SharedHeap::SO_AllClasses);
3316 add_root_scanning_option(SharedHeap::SO_SystemClasses); 3314 add_root_scanning_option(SharedHeap::SO_SystemClasses);
3742 CMKlassClosure klass_closure(&notOlder); 3740 CMKlassClosure klass_closure(&notOlder);
3743 gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel. 3741 gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
3744 gch->gen_process_strong_roots(_cmsGen->level(), 3742 gch->gen_process_strong_roots(_cmsGen->level(),
3745 true, // younger gens are roots 3743 true, // younger gens are roots
3746 true, // activate StrongRootsScope 3744 true, // activate StrongRootsScope
3747 false, // not scavenging
3748 SharedHeap::ScanningOption(roots_scanning_options()), 3745 SharedHeap::ScanningOption(roots_scanning_options()),
3749 &notOlder, 3746 &notOlder,
3750 true, // walk all of code cache if (so & SO_CodeCache) 3747 true, // walk all of code cache if (so & SO_AllCodeCache)
3751 NULL, 3748 NULL,
3752 &klass_closure); 3749 &klass_closure);
3753 } 3750 }
3754 } 3751 }
3755 3752
5242 _timer.reset(); 5239 _timer.reset();
5243 _timer.start(); 5240 _timer.start();
5244 gch->gen_process_strong_roots(_collector->_cmsGen->level(), 5241 gch->gen_process_strong_roots(_collector->_cmsGen->level(),
5245 false, // yg was scanned above 5242 false, // yg was scanned above
5246 false, // this is parallel code 5243 false, // this is parallel code
5247 false, // not scavenging
5248 SharedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()), 5244 SharedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()),
5249 &par_mri_cl, 5245 &par_mri_cl,
5250 true, // walk all of code cache if (so & SO_CodeCache) 5246 true, // walk all of code cache if (so & SO_AllCodeCache)
5251 NULL, 5247 NULL,
5252 &klass_closure); 5248 &klass_closure);
5253 assert(_collector->should_unload_classes() 5249 assert(_collector->should_unload_classes()
5254 || (_collector->CMSCollector::roots_scanning_options() & SharedHeap::SO_CodeCache), 5250 || (_collector->CMSCollector::roots_scanning_options() & SharedHeap::SO_AllCodeCache),
5255 "if we didn't scan the code cache, we have to be ready to drop nmethods with expired weak oops"); 5251 "if we didn't scan the code cache, we have to be ready to drop nmethods with expired weak oops");
5256 _timer.stop(); 5252 _timer.stop();
5257 if (PrintCMSStatistics != 0) { 5253 if (PrintCMSStatistics != 0) {
5258 gclog_or_tty->print_cr( 5254 gclog_or_tty->print_cr(
5259 "Finished remaining root initial mark scan work in %dth thread: %3.3f sec", 5255 "Finished remaining root initial mark scan work in %dth thread: %3.3f sec",
5379 _timer.reset(); 5375 _timer.reset();
5380 _timer.start(); 5376 _timer.start();
5381 gch->gen_process_strong_roots(_collector->_cmsGen->level(), 5377 gch->gen_process_strong_roots(_collector->_cmsGen->level(),
5382 false, // yg was scanned above 5378 false, // yg was scanned above
5383 false, // this is parallel code 5379 false, // this is parallel code
5384 false, // not scavenging
5385 SharedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()), 5380 SharedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()),
5386 &par_mrias_cl, 5381 &par_mrias_cl,
5387 true, // walk all of code cache if (so & SO_CodeCache) 5382 true, // walk all of code cache if (so & SO_AllCodeCache)
5388 NULL, 5383 NULL,
5389 NULL); // The dirty klasses will be handled below 5384 NULL); // The dirty klasses will be handled below
5390 assert(_collector->should_unload_classes() 5385 assert(_collector->should_unload_classes()
5391 || (_collector->CMSCollector::roots_scanning_options() & SharedHeap::SO_CodeCache), 5386 || (_collector->CMSCollector::roots_scanning_options() & SharedHeap::SO_AllCodeCache),
5392 "if we didn't scan the code cache, we have to be ready to drop nmethods with expired weak oops"); 5387 "if we didn't scan the code cache, we have to be ready to drop nmethods with expired weak oops");
5393 _timer.stop(); 5388 _timer.stop();
5394 if (PrintCMSStatistics != 0) { 5389 if (PrintCMSStatistics != 0) {
5395 gclog_or_tty->print_cr( 5390 gclog_or_tty->print_cr(
5396 "Finished remaining root rescan work in %dth thread: %3.3f sec", 5391 "Finished remaining root rescan work in %dth thread: %3.3f sec",
5970 gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel. 5965 gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
5971 GenCollectedHeap::StrongRootsScope srs(gch); 5966 GenCollectedHeap::StrongRootsScope srs(gch);
5972 gch->gen_process_strong_roots(_cmsGen->level(), 5967 gch->gen_process_strong_roots(_cmsGen->level(),
5973 true, // younger gens as roots 5968 true, // younger gens as roots
5974 false, // use the local StrongRootsScope 5969 false, // use the local StrongRootsScope
5975 false, // not scavenging
5976 SharedHeap::ScanningOption(roots_scanning_options()), 5970 SharedHeap::ScanningOption(roots_scanning_options()),
5977 &mrias_cl, 5971 &mrias_cl,
5978 true, // walk code active on stacks 5972 true, // walk code active on stacks
5979 NULL, 5973 NULL,
5980 NULL); // The dirty klasses will be handled below 5974 NULL); // The dirty klasses will be handled below
5981 5975
5982 assert(should_unload_classes() 5976 assert(should_unload_classes()
5983 || (roots_scanning_options() & SharedHeap::SO_CodeCache), 5977 || (roots_scanning_options() & SharedHeap::SO_AllCodeCache),
5984 "if we didn't scan the code cache, we have to be ready to drop nmethods with expired weak oops"); 5978 "if we didn't scan the code cache, we have to be ready to drop nmethods with expired weak oops");
5985 } 5979 }
5986 5980
5987 { 5981 {
5988 GCTraceTime t("visit unhandled CLDs", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id()); 5982 GCTraceTime t("visit unhandled CLDs", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());