< prev index next >

src/hotspot/share/gc/cms/cmsHeap.cpp

Print this page




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"

  26 #include "gc/cms/compactibleFreeListSpace.hpp"
  27 #include "gc/cms/concurrentMarkSweepGeneration.hpp"
  28 #include "gc/cms/concurrentMarkSweepThread.hpp"
  29 #include "gc/cms/cmsHeap.hpp"
  30 #include "gc/cms/parNewGeneration.hpp"
  31 #include "gc/cms/vmCMSOperations.hpp"
  32 #include "gc/shared/genMemoryPools.hpp"
  33 #include "gc/shared/genOopClosures.inline.hpp"
  34 #include "gc/shared/strongRootsScope.hpp"
  35 #include "gc/shared/workgroup.hpp"
  36 #include "oops/oop.inline.hpp"
  37 #include "runtime/vmThread.hpp"
  38 #include "services/memoryManager.hpp"
  39 #include "utilities/stack.inline.hpp"
  40 
  41 class CompactibleFreeListSpacePool : public CollectedMemoryPool {
  42 private:
  43   CompactibleFreeListSpace* _space;
  44 public:
  45   CompactibleFreeListSpacePool(CompactibleFreeListSpace* space,


  71     _eden_pool(NULL),
  72     _survivor_pool(NULL),
  73     _old_pool(NULL) {
  74   _workers = new WorkGang("GC Thread", ParallelGCThreads,
  75                           /* are_GC_task_threads */true,
  76                           /* are_ConcurrentGC_threads */false);
  77   _workers->initialize_workers();
  78 }
  79 
  80 jint CMSHeap::initialize() {
  81   jint status = GenCollectedHeap::initialize();
  82   if (status != JNI_OK) return status;
  83 
  84   // If we are running CMS, create the collector responsible
  85   // for collecting the CMS generations.
  86   if (!create_cms_collector()) {
  87     return JNI_ENOMEM;
  88   }
  89 
  90   return JNI_OK;





  91 }
  92 
  93 void CMSHeap::initialize_serviceability() {
  94   _young_manager = new GCMemoryManager("ParNew", "end of minor GC");
  95   _old_manager = new GCMemoryManager("ConcurrentMarkSweep", "end of major GC");
  96 
  97   ParNewGeneration* young = (ParNewGeneration*) young_gen();
  98   _eden_pool = new ContiguousSpacePool(young->eden(),
  99                                        "Par Eden Space",
 100                                        young->max_eden_size(),
 101                                        false);
 102 
 103   _survivor_pool = new SurvivorContiguousSpacePool(young,
 104                                                    "Par Survivor Space",
 105                                                    young->max_survivor_size(),
 106                                                    false);
 107 
 108   ConcurrentMarkSweepGeneration* old = (ConcurrentMarkSweepGeneration*) old_gen();
 109   _old_pool = new CompactibleFreeListSpacePool(old->cmsSpace(),
 110                                                "CMS Old Gen",




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/cms/cmsCardTable.hpp"
  27 #include "gc/cms/compactibleFreeListSpace.hpp"
  28 #include "gc/cms/concurrentMarkSweepGeneration.hpp"
  29 #include "gc/cms/concurrentMarkSweepThread.hpp"
  30 #include "gc/cms/cmsHeap.hpp"
  31 #include "gc/cms/parNewGeneration.hpp"
  32 #include "gc/cms/vmCMSOperations.hpp"
  33 #include "gc/shared/genMemoryPools.hpp"
  34 #include "gc/shared/genOopClosures.inline.hpp"
  35 #include "gc/shared/strongRootsScope.hpp"
  36 #include "gc/shared/workgroup.hpp"
  37 #include "oops/oop.inline.hpp"
  38 #include "runtime/vmThread.hpp"
  39 #include "services/memoryManager.hpp"
  40 #include "utilities/stack.inline.hpp"
  41 
  42 class CompactibleFreeListSpacePool : public CollectedMemoryPool {
  43 private:
  44   CompactibleFreeListSpace* _space;
  45 public:
  46   CompactibleFreeListSpacePool(CompactibleFreeListSpace* space,


  72     _eden_pool(NULL),
  73     _survivor_pool(NULL),
  74     _old_pool(NULL) {
  75   _workers = new WorkGang("GC Thread", ParallelGCThreads,
  76                           /* are_GC_task_threads */true,
  77                           /* are_ConcurrentGC_threads */false);
  78   _workers->initialize_workers();
  79 }
  80 
  81 jint CMSHeap::initialize() {
  82   jint status = GenCollectedHeap::initialize();
  83   if (status != JNI_OK) return status;
  84 
  85   // If we are running CMS, create the collector responsible
  86   // for collecting the CMS generations.
  87   if (!create_cms_collector()) {
  88     return JNI_ENOMEM;
  89   }
  90 
  91   return JNI_OK;
  92 }
  93 
  94 CardTableRS* CMSHeap::create_rem_set(const MemRegion& reserved_region) {
  95   const bool scan_concurrently = CMSPrecleaningEnabled;
  96   return new CMSCardTable(reserved_region, scan_concurrently);
  97 }
  98 
  99 void CMSHeap::initialize_serviceability() {
 100   _young_manager = new GCMemoryManager("ParNew", "end of minor GC");
 101   _old_manager = new GCMemoryManager("ConcurrentMarkSweep", "end of major GC");
 102 
 103   ParNewGeneration* young = (ParNewGeneration*) young_gen();
 104   _eden_pool = new ContiguousSpacePool(young->eden(),
 105                                        "Par Eden Space",
 106                                        young->max_eden_size(),
 107                                        false);
 108 
 109   _survivor_pool = new SurvivorContiguousSpacePool(young,
 110                                                    "Par Survivor Space",
 111                                                    young->max_survivor_size(),
 112                                                    false);
 113 
 114   ConcurrentMarkSweepGeneration* old = (ConcurrentMarkSweepGeneration*) old_gen();
 115   _old_pool = new CompactibleFreeListSpacePool(old->cmsSpace(),
 116                                                "CMS Old Gen",


< prev index next >