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/g1/g1GCServicabilitySupport.hpp" 27 #include "gc/g1/g1CollectedHeap.hpp" 28 #include "gc/g1/g1MemoryPool.hpp" 29 30 #include "services/memoryManager.hpp" 31 32 class G1YoungGenMemoryManager : public GCMemoryManager { 33 private: 34 public: 35 G1YoungGenMemoryManager() : GCMemoryManager() {} 36 37 const char* name() { return "G1 Young Generation"; } 38 }; 39 40 class G1OldGenMemoryManager : public GCMemoryManager { 41 private: 42 public: 43 G1OldGenMemoryManager() : GCMemoryManager() {} 44 45 const char* name() { return "G1 Old Generation"; } 46 }; 47 48 49 GCMemoryManager* G1GCServicabilitySupport::create_minor_gc_manager() { 50 return new G1YoungGenMemoryManager(); 51 } 52 53 GCMemoryManager* G1GCServicabilitySupport::create_major_gc_manager() { 54 return new G1OldGenMemoryManager(); 55 } 56 57 void G1GCServicabilitySupport::add_memory_pools(GrowableArray<MemoryPool*>* pools_list, 58 GCMemoryManager* minor_mgr, 59 GCMemoryManager* major_mgr) { 60 61 G1CollectedHeap* g1h = G1CollectedHeap::heap(); 62 G1EdenPool* eden = new G1EdenPool(g1h); 63 G1SurvivorPool* survivor = new G1SurvivorPool(g1h); 64 G1OldGenPool* old_gen = new G1OldGenPool(g1h); 65 66 major_mgr->add_pool(eden); 67 major_mgr->add_pool(survivor); 68 major_mgr->add_pool(old_gen); 69 minor_mgr->add_pool(eden); 70 minor_mgr->add_pool(survivor); 71 pools_list->append(eden); 72 pools_list->append(survivor); 73 pools_list->append(old_gen); 74 }