Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @ 13086:096c224171c4
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 20 Nov 2013 00:10:38 +0100 |
parents | 592d8b01fedd |
children | 86e6d691f2e1 |
comparison
equal
deleted
inserted
replaced
12782:92b7ec34ddfa | 13086:096c224171c4 |
---|---|
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 |
2530 } | 2522 } |
2531 | 2523 |
2532 // Snapshot the soft reference policy to be used in this collection cycle. | 2524 // Snapshot the soft reference policy to be used in this collection cycle. |
2533 ref_processor()->setup_policy(clear_all_soft_refs); | 2525 ref_processor()->setup_policy(clear_all_soft_refs); |
2534 | 2526 |
2527 // Decide if class unloading should be done | |
2528 update_should_unload_classes(); | |
2529 | |
2535 bool init_mark_was_synchronous = false; // until proven otherwise | 2530 bool init_mark_was_synchronous = false; // until proven otherwise |
2536 while (_collectorState != Idling) { | 2531 while (_collectorState != Idling) { |
2537 if (TraceCMSState) { | 2532 if (TraceCMSState) { |
2538 gclog_or_tty->print_cr("Thread " INTPTR_FORMAT " in CMS state %d", | 2533 gclog_or_tty->print_cr("Thread " INTPTR_FORMAT " in CMS state %d", |
2539 Thread::current(), _collectorState); | 2534 Thread::current(), _collectorState); |
3308 void CMSCollector::setup_cms_unloading_and_verification_state() { | 3303 void CMSCollector::setup_cms_unloading_and_verification_state() { |
3309 const bool should_verify = VerifyBeforeGC || VerifyAfterGC || VerifyDuringGC | 3304 const bool should_verify = VerifyBeforeGC || VerifyAfterGC || VerifyDuringGC |
3310 || VerifyBeforeExit; | 3305 || VerifyBeforeExit; |
3311 const int rso = SharedHeap::SO_Strings | SharedHeap::SO_CodeCache; | 3306 const int rso = SharedHeap::SO_Strings | SharedHeap::SO_CodeCache; |
3312 | 3307 |
3308 // We set the proper root for this CMS cycle here. | |
3313 if (should_unload_classes()) { // Should unload classes this cycle | 3309 if (should_unload_classes()) { // Should unload classes this cycle |
3310 remove_root_scanning_option(SharedHeap::SO_AllClasses); | |
3311 add_root_scanning_option(SharedHeap::SO_SystemClasses); | |
3314 remove_root_scanning_option(rso); // Shrink the root set appropriately | 3312 remove_root_scanning_option(rso); // Shrink the root set appropriately |
3315 set_verifying(should_verify); // Set verification state for this cycle | 3313 set_verifying(should_verify); // Set verification state for this cycle |
3316 return; // Nothing else needs to be done at this time | 3314 return; // Nothing else needs to be done at this time |
3317 } | 3315 } |
3318 | 3316 |
3319 // Not unloading classes this cycle | 3317 // Not unloading classes this cycle |
3320 assert(!should_unload_classes(), "Inconsitency!"); | 3318 assert(!should_unload_classes(), "Inconsitency!"); |
3319 remove_root_scanning_option(SharedHeap::SO_SystemClasses); | |
3320 add_root_scanning_option(SharedHeap::SO_AllClasses); | |
3321 | |
3321 if ((!verifying() || unloaded_classes_last_cycle()) && should_verify) { | 3322 if ((!verifying() || unloaded_classes_last_cycle()) && should_verify) { |
3322 // Include symbols, strings and code cache elements to prevent their resurrection. | 3323 // Include symbols, strings and code cache elements to prevent their resurrection. |
3323 add_root_scanning_option(rso); | 3324 add_root_scanning_option(rso); |
3324 set_verifying(true); | 3325 set_verifying(true); |
3325 } else if (verifying() && !should_verify) { | 3326 } else if (verifying() && !should_verify) { |