1 /* 2 * Copyright (c) 2017, Red Hat, Inc. and/or its affiliates. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 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 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/parallel/parallelGCServicabilitySupport.hpp" 27 #include "gc/parallel/parallelScavengeHeap.hpp" 28 #include "gc/parallel/psMemoryPool.hpp" 29 30 #include "services/memoryManager.hpp" 31 32 class PSScavengeMemoryManager : public GCMemoryManager { 33 private: 34 public: 35 PSScavengeMemoryManager() : GCMemoryManager() {} 36 37 const char* name() { return "PS Scavenge"; } 38 }; 39 40 class PSMarkSweepMemoryManager : public GCMemoryManager { 41 private: 42 public: 43 PSMarkSweepMemoryManager() : GCMemoryManager() {} 44 45 const char* name() { return "PS MarkSweep"; } 46 }; 47 48 GCMemoryManager* ParallelGCServicabilitySupport::create_minor_gc_manager() { 49 return new PSScavengeMemoryManager(); 50 } 51 52 GCMemoryManager* ParallelGCServicabilitySupport::create_major_gc_manager() { 53 return new PSMarkSweepMemoryManager(); 54 } 55 56 void ParallelGCServicabilitySupport::add_memory_pools(GrowableArray<MemoryPool*>* pools_list, 57 GCMemoryManager* minor_mgr, 58 GCMemoryManager* major_mgr) { 59 ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); 60 PSYoungGen* young_gen = heap->young_gen(); 61 EdenMutableSpacePool* eden = new EdenMutableSpacePool(young_gen, 62 young_gen->eden_space(), 63 "PS Eden Space", 64 MemoryPool::Heap, 65 false /* support_usage_threshold */); 66 67 SurvivorMutableSpacePool* survivor = new SurvivorMutableSpacePool(young_gen, 68 "PS Survivor Space", 69 MemoryPool::Heap, 70 false /* support_usage_threshold */); 71 72 PSGenerationPool* old_gen_pool = new PSGenerationPool(heap->old_gen(), 73 "PS Old Gen", 74 MemoryPool::Heap, 75 true /* support_usage_threshold */); 76 77 major_mgr->add_pool(eden); 78 major_mgr->add_pool(survivor); 79 major_mgr->add_pool(old_gen_pool); 80 81 minor_mgr->add_pool(eden); 82 minor_mgr->add_pool(survivor); 83 84 pools_list->append(eden); 85 pools_list->append(survivor); 86 pools_list->append(old_gen_pool); 87 88 }