/* * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. * 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 "gc/parallel/parallelGCServicabilitySupport.hpp" #include "gc/parallel/parallelScavengeHeap.hpp" #include "gc/parallel/psMemoryPool.hpp" #include "services/memoryManager.hpp" class PSScavengeMemoryManager : public GCMemoryManager { private: public: PSScavengeMemoryManager() : GCMemoryManager() {} const char* name() { return "PS Scavenge"; } }; class PSMarkSweepMemoryManager : public GCMemoryManager { private: public: PSMarkSweepMemoryManager() : GCMemoryManager() {} const char* name() { return "PS MarkSweep"; } }; GCMemoryManager* ParallelGCServicabilitySupport::create_minor_gc_manager() { return new PSScavengeMemoryManager(); } GCMemoryManager* ParallelGCServicabilitySupport::create_major_gc_manager() { return new PSMarkSweepMemoryManager(); } void ParallelGCServicabilitySupport::add_memory_pools(GrowableArray* pools_list, GCMemoryManager* minor_mgr, GCMemoryManager* major_mgr) { ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); PSYoungGen* young_gen = heap->young_gen(); EdenMutableSpacePool* eden = new EdenMutableSpacePool(young_gen, young_gen->eden_space(), "PS Eden Space", MemoryPool::Heap, false /* support_usage_threshold */); SurvivorMutableSpacePool* survivor = new SurvivorMutableSpacePool(young_gen, "PS Survivor Space", MemoryPool::Heap, false /* support_usage_threshold */); PSGenerationPool* old_gen_pool = new PSGenerationPool(heap->old_gen(), "PS Old Gen", MemoryPool::Heap, true /* support_usage_threshold */); major_mgr->add_pool(eden); major_mgr->add_pool(survivor); major_mgr->add_pool(old_gen_pool); minor_mgr->add_pool(eden); minor_mgr->add_pool(survivor); pools_list->append(eden); pools_list->append(survivor); pools_list->append(old_gen_pool); }