Merge

Mon, 11 Nov 2013 05:05:36 -0800

author
jwilhelm
date
Mon, 11 Nov 2013 05:05:36 -0800
changeset 6092
bde526e3667e
parent 6091
236cecd9ec97
parent 6089
592d8b01fedd
child 6093
11b116661830

Merge

     1.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Mon Nov 11 13:50:10 2013 +0100
     1.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Mon Nov 11 05:05:36 2013 -0800
     1.3 @@ -594,9 +594,9 @@
     1.4    _verification_mark_bm(0, Mutex::leaf + 1, "CMS_verification_mark_bm_lock"),
     1.5    _completed_initialization(false),
     1.6    _collector_policy(cp),
     1.7 -  _should_unload_classes(false),
     1.8 +  _should_unload_classes(CMSClassUnloadingEnabled),
     1.9    _concurrent_cycles_since_last_unload(0),
    1.10 -  _roots_scanning_options(0),
    1.11 +  _roots_scanning_options(SharedHeap::SO_None),
    1.12    _inter_sweep_estimate(CMS_SweepWeight, CMS_SweepPadding),
    1.13    _intra_sweep_estimate(CMS_SweepWeight, CMS_SweepPadding),
    1.14    _gc_tracer_cm(new (ResourceObj::C_HEAP, mtGC) CMSTracer()),
    1.15 @@ -788,14 +788,6 @@
    1.16               && _survivor_chunk_index == 0),
    1.17           "Error");
    1.18  
    1.19 -  // Choose what strong roots should be scanned depending on verification options
    1.20 -  if (!CMSClassUnloadingEnabled) {
    1.21 -    // If class unloading is disabled we want to include all classes into the root set.
    1.22 -    add_root_scanning_option(SharedHeap::SO_AllClasses);
    1.23 -  } else {
    1.24 -    add_root_scanning_option(SharedHeap::SO_SystemClasses);
    1.25 -  }
    1.26 -
    1.27    NOT_PRODUCT(_overflow_counter = CMSMarkStackOverflowInterval;)
    1.28    _gc_counters = new CollectorCounters("CMS", 1);
    1.29    _completed_initialization = true;
    1.30 @@ -2532,6 +2524,9 @@
    1.31    // Snapshot the soft reference policy to be used in this collection cycle.
    1.32    ref_processor()->setup_policy(clear_all_soft_refs);
    1.33  
    1.34 +  // Decide if class unloading should be done
    1.35 +  update_should_unload_classes();
    1.36 +
    1.37    bool init_mark_was_synchronous = false; // until proven otherwise
    1.38    while (_collectorState != Idling) {
    1.39      if (TraceCMSState) {
    1.40 @@ -3310,7 +3305,10 @@
    1.41                               || VerifyBeforeExit;
    1.42    const  int  rso           =   SharedHeap::SO_Strings | SharedHeap::SO_CodeCache;
    1.43  
    1.44 +  // We set the proper root for this CMS cycle here.
    1.45    if (should_unload_classes()) {   // Should unload classes this cycle
    1.46 +    remove_root_scanning_option(SharedHeap::SO_AllClasses);
    1.47 +    add_root_scanning_option(SharedHeap::SO_SystemClasses);
    1.48      remove_root_scanning_option(rso);  // Shrink the root set appropriately
    1.49      set_verifying(should_verify);    // Set verification state for this cycle
    1.50      return;                            // Nothing else needs to be done at this time
    1.51 @@ -3318,6 +3316,9 @@
    1.52  
    1.53    // Not unloading classes this cycle
    1.54    assert(!should_unload_classes(), "Inconsitency!");
    1.55 +  remove_root_scanning_option(SharedHeap::SO_SystemClasses);
    1.56 +  add_root_scanning_option(SharedHeap::SO_AllClasses);
    1.57 +
    1.58    if ((!verifying() || unloaded_classes_last_cycle()) && should_verify) {
    1.59      // Include symbols, strings and code cache elements to prevent their resurrection.
    1.60      add_root_scanning_option(rso);

mercurial