hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp
changeset 6759 67b1a69ef5aa
parent 5547 f4b087cbb361
child 7397 5b173b4ca846
equal deleted inserted replaced
6451:516540f1f076 6759:67b1a69ef5aa
     1 /*
     1 /*
     2  * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    37   initialize_perm_generation(PermGen::ConcurrentMarkSweep);
    37   initialize_perm_generation(PermGen::ConcurrentMarkSweep);
    38   _generations = new GenerationSpecPtr[number_of_generations()];
    38   _generations = new GenerationSpecPtr[number_of_generations()];
    39   if (_generations == NULL)
    39   if (_generations == NULL)
    40     vm_exit_during_initialization("Unable to allocate gen spec");
    40     vm_exit_during_initialization("Unable to allocate gen spec");
    41 
    41 
    42   if (UseParNewGC && ParallelGCThreads > 0) {
    42   if (ParNewGeneration::in_use()) {
    43     if (UseAdaptiveSizePolicy) {
    43     if (UseAdaptiveSizePolicy) {
    44       _generations[0] = new GenerationSpec(Generation::ASParNew,
    44       _generations[0] = new GenerationSpec(Generation::ASParNew,
    45                                            _initial_gen0_size, _max_gen0_size);
    45                                            _initial_gen0_size, _max_gen0_size);
    46     } else {
    46     } else {
    47       _generations[0] = new GenerationSpec(Generation::ParNew,
    47       _generations[0] = new GenerationSpec(Generation::ParNew,
    77                                            GCTimeRatio);
    77                                            GCTimeRatio);
    78 }
    78 }
    79 
    79 
    80 void ConcurrentMarkSweepPolicy::initialize_gc_policy_counters() {
    80 void ConcurrentMarkSweepPolicy::initialize_gc_policy_counters() {
    81   // initialize the policy counters - 2 collectors, 3 generations
    81   // initialize the policy counters - 2 collectors, 3 generations
    82   if (UseParNewGC && ParallelGCThreads > 0) {
    82   if (ParNewGeneration::in_use()) {
    83     _gc_policy_counters = new GCPolicyCounters("ParNew:CMS", 2, 3);
    83     _gc_policy_counters = new GCPolicyCounters("ParNew:CMS", 2, 3);
    84   }
    84   }
    85   else {
    85   else {
    86     _gc_policy_counters = new GCPolicyCounters("Copy:CMS", 2, 3);
    86     _gc_policy_counters = new GCPolicyCounters("Copy:CMS", 2, 3);
    87   }
    87   }
   100 
   100 
   101 void ASConcurrentMarkSweepPolicy::initialize_gc_policy_counters() {
   101 void ASConcurrentMarkSweepPolicy::initialize_gc_policy_counters() {
   102 
   102 
   103   assert(size_policy() != NULL, "A size policy is required");
   103   assert(size_policy() != NULL, "A size policy is required");
   104   // initialize the policy counters - 2 collectors, 3 generations
   104   // initialize the policy counters - 2 collectors, 3 generations
   105   if (UseParNewGC && ParallelGCThreads > 0) {
   105   if (ParNewGeneration::in_use()) {
   106     _gc_policy_counters = new CMSGCAdaptivePolicyCounters("ParNew:CMS", 2, 3,
   106     _gc_policy_counters = new CMSGCAdaptivePolicyCounters("ParNew:CMS", 2, 3,
   107       size_policy());
   107       size_policy());
   108   }
   108   }
   109   else {
   109   else {
   110     _gc_policy_counters = new CMSGCAdaptivePolicyCounters("Copy:CMS", 2, 3,
   110     _gc_policy_counters = new CMSGCAdaptivePolicyCounters("Copy:CMS", 2, 3,