src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp

Print this page




2654 
2655 // Decide if we want to enable class unloading as part of the
2656 // ensuing concurrent GC cycle. We will collect and
2657 // unload classes if it's the case that:
2658 // (1) an explicit gc request has been made and the flag
2659 //     ExplicitGCInvokesConcurrentAndUnloadsClasses is set, OR
2660 // (2) (a) class unloading is enabled at the command line, and
2661 //     (b) old gen is getting really full
2662 // NOTE: Provided there is no change in the state of the heap between
2663 // calls to this method, it should have idempotent results. Moreover,
2664 // its results should be monotonically increasing (i.e. going from 0 to 1,
2665 // but not 1 to 0) between successive calls between which the heap was
2666 // not collected. For the implementation below, it must thus rely on
2667 // the property that concurrent_cycles_since_last_unload()
2668 // will not decrease unless a collection cycle happened and that
2669 // _cmsGen->is_too_full() are
2670 // themselves also monotonic in that sense. See check_monotonicity()
2671 // below.
2672 void CMSCollector::update_should_unload_classes() {
2673   _should_unload_classes = false;




2674   // Condition 1 above
2675   if (_full_gc_requested && ExplicitGCInvokesConcurrentAndUnloadsClasses) {
2676     _should_unload_classes = true;
2677   } else if (CMSClassUnloadingEnabled) { // Condition 2.a above
2678     // Disjuncts 2.b.(i,ii,iii) above
2679     _should_unload_classes = (concurrent_cycles_since_last_unload() >=
2680                               CMSClassUnloadingMaxInterval)
2681                            || _cmsGen->is_too_full();
2682   }
2683 }
2684 
2685 bool ConcurrentMarkSweepGeneration::is_too_full() const {
2686   bool res = should_concurrent_collect();
2687   res = res && (occupancy() > (double)CMSIsTooFullPercentage/100.0);
2688   return res;
2689 }
2690 
2691 void CMSCollector::setup_cms_unloading_and_verification_state() {
2692   const  bool should_verify =   VerifyBeforeGC || VerifyAfterGC || VerifyDuringGC
2693                              || VerifyBeforeExit;




2654 
2655 // Decide if we want to enable class unloading as part of the
2656 // ensuing concurrent GC cycle. We will collect and
2657 // unload classes if it's the case that:
2658 // (1) an explicit gc request has been made and the flag
2659 //     ExplicitGCInvokesConcurrentAndUnloadsClasses is set, OR
2660 // (2) (a) class unloading is enabled at the command line, and
2661 //     (b) old gen is getting really full
2662 // NOTE: Provided there is no change in the state of the heap between
2663 // calls to this method, it should have idempotent results. Moreover,
2664 // its results should be monotonically increasing (i.e. going from 0 to 1,
2665 // but not 1 to 0) between successive calls between which the heap was
2666 // not collected. For the implementation below, it must thus rely on
2667 // the property that concurrent_cycles_since_last_unload()
2668 // will not decrease unless a collection cycle happened and that
2669 // _cmsGen->is_too_full() are
2670 // themselves also monotonic in that sense. See check_monotonicity()
2671 // below.
2672 void CMSCollector::update_should_unload_classes() {
2673   _should_unload_classes = false;
2674   if (!ClassUnloading) {
2675     return;
2676   }
2677 
2678   // Condition 1 above
2679   if (_full_gc_requested && ExplicitGCInvokesConcurrentAndUnloadsClasses) {
2680     _should_unload_classes = true;
2681   } else if (CMSClassUnloadingEnabled) { // Condition 2.a above
2682     // Disjuncts 2.b.(i,ii,iii) above
2683     _should_unload_classes = (concurrent_cycles_since_last_unload() >=
2684                               CMSClassUnloadingMaxInterval)
2685                            || _cmsGen->is_too_full();
2686   }
2687 }
2688 
2689 bool ConcurrentMarkSweepGeneration::is_too_full() const {
2690   bool res = should_concurrent_collect();
2691   res = res && (occupancy() > (double)CMSIsTooFullPercentage/100.0);
2692   return res;
2693 }
2694 
2695 void CMSCollector::setup_cms_unloading_and_verification_state() {
2696   const  bool should_verify =   VerifyBeforeGC || VerifyAfterGC || VerifyDuringGC
2697                              || VerifyBeforeExit;