src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp

changeset 6088
40b8c6bad703
parent 5784
190899198332
child 6089
592d8b01fedd
equal deleted inserted replaced
6087:28674af341ac 6088:40b8c6bad703
592 _icms_start_limit(NULL), 592 _icms_start_limit(NULL),
593 _icms_stop_limit(NULL), 593 _icms_stop_limit(NULL),
594 _verification_mark_bm(0, Mutex::leaf + 1, "CMS_verification_mark_bm_lock"), 594 _verification_mark_bm(0, Mutex::leaf + 1, "CMS_verification_mark_bm_lock"),
595 _completed_initialization(false), 595 _completed_initialization(false),
596 _collector_policy(cp), 596 _collector_policy(cp),
597 _should_unload_classes(false), 597 _should_unload_classes(CMSClassUnloadingEnabled),
598 _concurrent_cycles_since_last_unload(0), 598 _concurrent_cycles_since_last_unload(0),
599 _roots_scanning_options(0), 599 _roots_scanning_options(SharedHeap::SO_None),
600 _inter_sweep_estimate(CMS_SweepWeight, CMS_SweepPadding), 600 _inter_sweep_estimate(CMS_SweepWeight, CMS_SweepPadding),
601 _intra_sweep_estimate(CMS_SweepWeight, CMS_SweepPadding), 601 _intra_sweep_estimate(CMS_SweepWeight, CMS_SweepPadding),
602 _gc_tracer_cm(new (ResourceObj::C_HEAP, mtGC) CMSTracer()), 602 _gc_tracer_cm(new (ResourceObj::C_HEAP, mtGC) CMSTracer()),
603 _gc_timer_cm(new (ResourceObj::C_HEAP, mtGC) ConcurrentGCTimer()), 603 _gc_timer_cm(new (ResourceObj::C_HEAP, mtGC) ConcurrentGCTimer()),
604 _cms_start_registered(false) 604 _cms_start_registered(false)
785 assert( ( _survivor_plab_array != NULL 785 assert( ( _survivor_plab_array != NULL
786 && _survivor_chunk_array != NULL) 786 && _survivor_chunk_array != NULL)
787 || ( _survivor_chunk_capacity == 0 787 || ( _survivor_chunk_capacity == 0
788 && _survivor_chunk_index == 0), 788 && _survivor_chunk_index == 0),
789 "Error"); 789 "Error");
790
791 // Choose what strong roots should be scanned depending on verification options
792 if (!CMSClassUnloadingEnabled) {
793 // If class unloading is disabled we want to include all classes into the root set.
794 add_root_scanning_option(SharedHeap::SO_AllClasses);
795 } else {
796 add_root_scanning_option(SharedHeap::SO_SystemClasses);
797 }
798 790
799 NOT_PRODUCT(_overflow_counter = CMSMarkStackOverflowInterval;) 791 NOT_PRODUCT(_overflow_counter = CMSMarkStackOverflowInterval;)
800 _gc_counters = new CollectorCounters("CMS", 1); 792 _gc_counters = new CollectorCounters("CMS", 1);
801 _completed_initialization = true; 793 _completed_initialization = true;
802 _inter_sweep_timer.start(); // start of time 794 _inter_sweep_timer.start(); // start of time
3308 void CMSCollector::setup_cms_unloading_and_verification_state() { 3300 void CMSCollector::setup_cms_unloading_and_verification_state() {
3309 const bool should_verify = VerifyBeforeGC || VerifyAfterGC || VerifyDuringGC 3301 const bool should_verify = VerifyBeforeGC || VerifyAfterGC || VerifyDuringGC
3310 || VerifyBeforeExit; 3302 || VerifyBeforeExit;
3311 const int rso = SharedHeap::SO_Strings | SharedHeap::SO_CodeCache; 3303 const int rso = SharedHeap::SO_Strings | SharedHeap::SO_CodeCache;
3312 3304
3305 // We set the proper root for this CMS cycle here.
3313 if (should_unload_classes()) { // Should unload classes this cycle 3306 if (should_unload_classes()) { // Should unload classes this cycle
3307 remove_root_scanning_option(SharedHeap::SO_AllClasses);
3308 add_root_scanning_option(SharedHeap::SO_SystemClasses);
3314 remove_root_scanning_option(rso); // Shrink the root set appropriately 3309 remove_root_scanning_option(rso); // Shrink the root set appropriately
3315 set_verifying(should_verify); // Set verification state for this cycle 3310 set_verifying(should_verify); // Set verification state for this cycle
3316 return; // Nothing else needs to be done at this time 3311 return; // Nothing else needs to be done at this time
3317 } 3312 }
3318 3313
3319 // Not unloading classes this cycle 3314 // Not unloading classes this cycle
3320 assert(!should_unload_classes(), "Inconsitency!"); 3315 assert(!should_unload_classes(), "Inconsitency!");
3316 remove_root_scanning_option(SharedHeap::SO_SystemClasses);
3317 add_root_scanning_option(SharedHeap::SO_AllClasses);
3318
3321 if ((!verifying() || unloaded_classes_last_cycle()) && should_verify) { 3319 if ((!verifying() || unloaded_classes_last_cycle()) && should_verify) {
3322 // Include symbols, strings and code cache elements to prevent their resurrection. 3320 // Include symbols, strings and code cache elements to prevent their resurrection.
3323 add_root_scanning_option(rso); 3321 add_root_scanning_option(rso);
3324 set_verifying(true); 3322 set_verifying(true);
3325 } else if (verifying() && !should_verify) { 3323 } else if (verifying() && !should_verify) {

mercurial