src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp

changeset 4130
2e6857353b2c
parent 4096
b86575d092a2
child 4174
04155d9c8c76
     1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Wed Oct 03 20:31:41 2012 +0200
     1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Thu Oct 04 10:04:13 2012 -0700
     1.3 @@ -4151,7 +4151,7 @@
     1.4    }
     1.5  }
     1.6  
     1.7 -void G1CollectedHeap::release_gc_alloc_regions() {
     1.8 +void G1CollectedHeap::release_gc_alloc_regions(uint no_of_gc_workers) {
     1.9    _survivor_gc_alloc_region.release();
    1.10    // If we have an old GC alloc region to release, we'll save it in
    1.11    // _retained_old_gc_alloc_region. If we don't
    1.12 @@ -4161,8 +4161,8 @@
    1.13    _retained_old_gc_alloc_region = _old_gc_alloc_region.release();
    1.14  
    1.15    if (ResizePLAB) {
    1.16 -    _survivor_plab_stats.adjust_desired_plab_sz();
    1.17 -    _old_plab_stats.adjust_desired_plab_sz();
    1.18 +    _survivor_plab_stats.adjust_desired_plab_sz(no_of_gc_workers);
    1.19 +    _old_plab_stats.adjust_desired_plab_sz(no_of_gc_workers);
    1.20    }
    1.21  }
    1.22  
    1.23 @@ -5427,7 +5427,7 @@
    1.24  };
    1.25  
    1.26  // Weak Reference processing during an evacuation pause (part 1).
    1.27 -void G1CollectedHeap::process_discovered_references() {
    1.28 +void G1CollectedHeap::process_discovered_references(uint no_of_gc_workers) {
    1.29    double ref_proc_start = os::elapsedTime();
    1.30  
    1.31    ReferenceProcessor* rp = _ref_processor_stw;
    1.32 @@ -5454,15 +5454,14 @@
    1.33    // referents points to another object which is also referenced by an
    1.34    // object discovered by the STW ref processor.
    1.35  
    1.36 -  uint active_workers = (G1CollectedHeap::use_parallel_gc_threads() ?
    1.37 -                        workers()->active_workers() : 1);
    1.38 -
    1.39    assert(!G1CollectedHeap::use_parallel_gc_threads() ||
    1.40 -           active_workers == workers()->active_workers(),
    1.41 -           "Need to reset active_workers");
    1.42 -
    1.43 -  set_par_threads(active_workers);
    1.44 -  G1ParPreserveCMReferentsTask keep_cm_referents(this, active_workers, _task_queues);
    1.45 +           no_of_gc_workers == workers()->active_workers(),
    1.46 +           "Need to reset active GC workers");
    1.47 +
    1.48 +  set_par_threads(no_of_gc_workers);
    1.49 +  G1ParPreserveCMReferentsTask keep_cm_referents(this,
    1.50 +                                                 no_of_gc_workers,
    1.51 +                                                 _task_queues);
    1.52  
    1.53    if (G1CollectedHeap::use_parallel_gc_threads()) {
    1.54      workers()->run_task(&keep_cm_referents);
    1.55 @@ -5528,10 +5527,10 @@
    1.56                                        NULL);
    1.57    } else {
    1.58      // Parallel reference processing
    1.59 -    assert(rp->num_q() == active_workers, "sanity");
    1.60 -    assert(active_workers <= rp->max_num_q(), "sanity");
    1.61 -
    1.62 -    G1STWRefProcTaskExecutor par_task_executor(this, workers(), _task_queues, active_workers);
    1.63 +    assert(rp->num_q() == no_of_gc_workers, "sanity");
    1.64 +    assert(no_of_gc_workers <= rp->max_num_q(), "sanity");
    1.65 +
    1.66 +    G1STWRefProcTaskExecutor par_task_executor(this, workers(), _task_queues, no_of_gc_workers);
    1.67      rp->process_discovered_references(&is_alive, &keep_alive, &drain_queue, &par_task_executor);
    1.68    }
    1.69  
    1.70 @@ -5546,7 +5545,7 @@
    1.71  }
    1.72  
    1.73  // Weak Reference processing during an evacuation pause (part 2).
    1.74 -void G1CollectedHeap::enqueue_discovered_references() {
    1.75 +void G1CollectedHeap::enqueue_discovered_references(uint no_of_gc_workers) {
    1.76    double ref_enq_start = os::elapsedTime();
    1.77  
    1.78    ReferenceProcessor* rp = _ref_processor_stw;
    1.79 @@ -5560,13 +5559,12 @@
    1.80    } else {
    1.81      // Parallel reference enqueuing
    1.82  
    1.83 -    uint active_workers = (ParallelGCThreads > 0 ? workers()->active_workers() : 1);
    1.84 -    assert(active_workers == workers()->active_workers(),
    1.85 -           "Need to reset active_workers");
    1.86 -    assert(rp->num_q() == active_workers, "sanity");
    1.87 -    assert(active_workers <= rp->max_num_q(), "sanity");
    1.88 -
    1.89 -    G1STWRefProcTaskExecutor par_task_executor(this, workers(), _task_queues, active_workers);
    1.90 +    assert(no_of_gc_workers == workers()->active_workers(),
    1.91 +           "Need to reset active workers");
    1.92 +    assert(rp->num_q() == no_of_gc_workers, "sanity");
    1.93 +    assert(no_of_gc_workers <= rp->max_num_q(), "sanity");
    1.94 +
    1.95 +    G1STWRefProcTaskExecutor par_task_executor(this, workers(), _task_queues, no_of_gc_workers);
    1.96      rp->enqueue_discovered_references(&par_task_executor);
    1.97    }
    1.98  
    1.99 @@ -5658,7 +5656,7 @@
   1.100    // as we may have to copy some 'reachable' referent
   1.101    // objects (and their reachable sub-graphs) that were
   1.102    // not copied during the pause.
   1.103 -  process_discovered_references();
   1.104 +  process_discovered_references(n_workers);
   1.105  
   1.106    // Weak root processing.
   1.107    // Note: when JSR 292 is enabled and code blobs can contain
   1.108 @@ -5670,7 +5668,7 @@
   1.109      JNIHandles::weak_oops_do(&is_alive, &keep_alive);
   1.110    }
   1.111  
   1.112 -  release_gc_alloc_regions();
   1.113 +  release_gc_alloc_regions(n_workers);
   1.114    g1_rem_set()->cleanup_after_oops_into_collection_set_do();
   1.115  
   1.116    concurrent_g1_refine()->clear_hot_cache();
   1.117 @@ -5694,7 +5692,7 @@
   1.118    // will log these updates (and dirty their associated
   1.119    // cards). We need these updates logged to update any
   1.120    // RSets.
   1.121 -  enqueue_discovered_references();
   1.122 +  enqueue_discovered_references(n_workers);
   1.123  
   1.124    if (G1DeferredRSUpdate) {
   1.125      RedirtyLoggedCardTableEntryFastClosure redirty;

mercurial