aoqi@0: /* aoqi@0: * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: * aoqi@0: */ aoqi@0: aoqi@0: #include "precompiled.hpp" aoqi@0: #include "memory/binaryTreeDictionary.hpp" aoqi@0: #include "memory/defNewGeneration.hpp" aoqi@0: #include "memory/filemap.hpp" aoqi@0: #include "memory/genRemSet.hpp" aoqi@0: #include "memory/generationSpec.hpp" aoqi@0: #include "memory/tenuredGeneration.hpp" aoqi@0: #include "runtime/java.hpp" aoqi@0: #include "utilities/macros.hpp" aoqi@0: #if INCLUDE_ALL_GCS aoqi@0: #include "gc_implementation/parNew/asParNewGeneration.hpp" aoqi@0: #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp" aoqi@0: #include "gc_implementation/parNew/parNewGeneration.hpp" aoqi@0: #endif // INCLUDE_ALL_GCS aoqi@0: aoqi@0: Generation* GenerationSpec::init(ReservedSpace rs, int level, aoqi@0: GenRemSet* remset) { aoqi@0: switch (name()) { aoqi@0: case Generation::DefNew: aoqi@0: return new DefNewGeneration(rs, init_size(), level); aoqi@0: aoqi@0: case Generation::MarkSweepCompact: aoqi@0: return new TenuredGeneration(rs, init_size(), level, remset); aoqi@0: aoqi@0: #if INCLUDE_ALL_GCS aoqi@0: case Generation::ParNew: aoqi@0: return new ParNewGeneration(rs, init_size(), level); aoqi@0: aoqi@0: case Generation::ASParNew: aoqi@0: return new ASParNewGeneration(rs, aoqi@0: init_size(), aoqi@0: init_size() /* min size */, aoqi@0: level); aoqi@0: aoqi@0: case Generation::ConcurrentMarkSweep: { aoqi@0: assert(UseConcMarkSweepGC, "UseConcMarkSweepGC should be set"); aoqi@0: CardTableRS* ctrs = remset->as_CardTableRS(); aoqi@0: if (ctrs == NULL) { aoqi@0: vm_exit_during_initialization("Rem set incompatibility."); aoqi@0: } aoqi@0: // Otherwise aoqi@0: // The constructor creates the CMSCollector if needed, aoqi@0: // else registers with an existing CMSCollector aoqi@0: aoqi@0: ConcurrentMarkSweepGeneration* g = NULL; aoqi@0: g = new ConcurrentMarkSweepGeneration(rs, aoqi@0: init_size(), level, ctrs, UseCMSAdaptiveFreeLists, aoqi@0: (FreeBlockDictionary::DictionaryChoice)CMSDictionaryChoice); aoqi@0: aoqi@0: g->initialize_performance_counters(); aoqi@0: aoqi@0: return g; aoqi@0: } aoqi@0: aoqi@0: case Generation::ASConcurrentMarkSweep: { aoqi@0: assert(UseConcMarkSweepGC, "UseConcMarkSweepGC should be set"); aoqi@0: CardTableRS* ctrs = remset->as_CardTableRS(); aoqi@0: if (ctrs == NULL) { aoqi@0: vm_exit_during_initialization("Rem set incompatibility."); aoqi@0: } aoqi@0: // Otherwise aoqi@0: // The constructor creates the CMSCollector if needed, aoqi@0: // else registers with an existing CMSCollector aoqi@0: aoqi@0: ASConcurrentMarkSweepGeneration* g = NULL; aoqi@0: g = new ASConcurrentMarkSweepGeneration(rs, aoqi@0: init_size(), level, ctrs, UseCMSAdaptiveFreeLists, aoqi@0: (FreeBlockDictionary::DictionaryChoice)CMSDictionaryChoice); aoqi@0: aoqi@0: g->initialize_performance_counters(); aoqi@0: aoqi@0: return g; aoqi@0: } aoqi@0: #endif // INCLUDE_ALL_GCS aoqi@0: aoqi@0: default: aoqi@0: guarantee(false, "unrecognized GenerationName"); aoqi@0: return NULL; aoqi@0: } aoqi@0: }