/* * 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/serial/defNewGeneration.hpp" #include "gc/serial/serialGCServicabilitySupport.hpp" #include "gc/shared/genCollectedHeap.hpp" #include "services/memoryManager.hpp" #include "services/memoryPool.hpp" class CopyMemoryManager : public GCMemoryManager { private: public: CopyMemoryManager() : GCMemoryManager() {} const char* name() { return "Copy"; } }; class MSCMemoryManager : public GCMemoryManager { private: public: MSCMemoryManager() : GCMemoryManager() {} const char* name() { return "MarkSweepCompact"; } }; GCMemoryManager* SerialGCServicabilitySupport::create_minor_gc_manager() { return new CopyMemoryManager(); } GCMemoryManager* SerialGCServicabilitySupport::create_major_gc_manager() { return new MSCMemoryManager(); } void SerialGCServicabilitySupport::add_memory_pools(GrowableArray* pools_list, GCMemoryManager* minor_mgr, GCMemoryManager* major_mgr) { GenCollectedHeap* heap = GenCollectedHeap::heap(); DefNewGeneration* young_gen = (DefNewGeneration*) heap->young_gen(); // Add a memory pool for each space and young gen doesn't // support low memory detection as it is expected to get filled up. MemoryPool* eden = new ContiguousSpacePool(young_gen->eden(), "Eden Space", MemoryPool::Heap, young_gen->max_eden_size(), false /* support_usage_threshold */); MemoryPool* survivor = new SurvivorContiguousSpacePool(young_gen, "Survivor Space", MemoryPool::Heap, young_gen->max_survivor_size(), false /* support_usage_threshold */); GenerationPool* old = new GenerationPool(heap->old_gen(), "Tenured Gen", MemoryPool::Heap, true); pools_list->append(eden); pools_list->append(survivor); pools_list->append(old); minor_mgr->add_pool(eden); minor_mgr->add_pool(survivor); major_mgr->add_pool(eden); major_mgr->add_pool(survivor); major_mgr->add_pool(old); }