--- /dev/null 2017-11-08 15:25:57.713133075 +0100 +++ new/src/hotspot/share/gc/g1/g1GCServicabilitySupport.cpp 2017-11-20 16:28:41.606226611 +0100 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2017, Red Hat, Inc. and/or its affiliates. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "precompiled.hpp" +#include "gc/g1/g1GCServicabilitySupport.hpp" +#include "gc/g1/g1CollectedHeap.hpp" +#include "gc/g1/g1MemoryPool.hpp" + +#include "services/memoryManager.hpp" + +class G1YoungGenMemoryManager : public GCMemoryManager { +private: +public: + G1YoungGenMemoryManager() : GCMemoryManager() {} + + const char* name() { return "G1 Young Generation"; } +}; + +class G1OldGenMemoryManager : public GCMemoryManager { +private: +public: + G1OldGenMemoryManager() : GCMemoryManager() {} + + const char* name() { return "G1 Old Generation"; } +}; + + +GCMemoryManager* G1GCServicabilitySupport::create_minor_gc_manager() { + return new G1YoungGenMemoryManager(); +} + +GCMemoryManager* G1GCServicabilitySupport::create_major_gc_manager() { + return new G1OldGenMemoryManager(); +} + +void G1GCServicabilitySupport::add_memory_pools(GrowableArray* pools_list, + GCMemoryManager* minor_mgr, + GCMemoryManager* major_mgr) { + + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + G1EdenPool* eden = new G1EdenPool(g1h); + G1SurvivorPool* survivor = new G1SurvivorPool(g1h); + G1OldGenPool* old_gen = new G1OldGenPool(g1h); + + major_mgr->add_pool(eden); + major_mgr->add_pool(survivor); + major_mgr->add_pool(old_gen); + minor_mgr->add_pool(eden); + minor_mgr->add_pool(survivor); + pools_list->append(eden); + pools_list->append(survivor); + pools_list->append(old_gen); +}