Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/memory/generationSpec.cpp
32285 views
/*1* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#include "precompiled.hpp"25#include "memory/binaryTreeDictionary.hpp"26#include "memory/defNewGeneration.hpp"27#include "memory/filemap.hpp"28#include "memory/genRemSet.hpp"29#include "memory/generationSpec.hpp"30#include "memory/tenuredGeneration.hpp"31#include "runtime/java.hpp"32#include "utilities/macros.hpp"33#if INCLUDE_ALL_GCS34#include "gc_implementation/parNew/asParNewGeneration.hpp"35#include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp"36#include "gc_implementation/parNew/parNewGeneration.hpp"37#endif // INCLUDE_ALL_GCS3839Generation* GenerationSpec::init(ReservedSpace rs, int level,40GenRemSet* remset) {41switch (name()) {42case Generation::DefNew:43return new DefNewGeneration(rs, init_size(), level);4445case Generation::MarkSweepCompact:46return new TenuredGeneration(rs, init_size(), level, remset);4748#if INCLUDE_ALL_GCS49case Generation::ParNew:50return new ParNewGeneration(rs, init_size(), level);5152case Generation::ASParNew:53return new ASParNewGeneration(rs,54init_size(),55init_size() /* min size */,56level);5758case Generation::ConcurrentMarkSweep: {59assert(UseConcMarkSweepGC, "UseConcMarkSweepGC should be set");60CardTableRS* ctrs = remset->as_CardTableRS();61if (ctrs == NULL) {62vm_exit_during_initialization("Rem set incompatibility.");63}64// Otherwise65// The constructor creates the CMSCollector if needed,66// else registers with an existing CMSCollector6768ConcurrentMarkSweepGeneration* g = NULL;69g = new ConcurrentMarkSweepGeneration(rs,70init_size(), level, ctrs, UseCMSAdaptiveFreeLists,71(FreeBlockDictionary<FreeChunk>::DictionaryChoice)CMSDictionaryChoice);7273g->initialize_performance_counters();7475return g;76}7778case Generation::ASConcurrentMarkSweep: {79assert(UseConcMarkSweepGC, "UseConcMarkSweepGC should be set");80CardTableRS* ctrs = remset->as_CardTableRS();81if (ctrs == NULL) {82vm_exit_during_initialization("Rem set incompatibility.");83}84// Otherwise85// The constructor creates the CMSCollector if needed,86// else registers with an existing CMSCollector8788ASConcurrentMarkSweepGeneration* g = NULL;89g = new ASConcurrentMarkSweepGeneration(rs,90init_size(), level, ctrs, UseCMSAdaptiveFreeLists,91(FreeBlockDictionary<FreeChunk>::DictionaryChoice)CMSDictionaryChoice);9293g->initialize_performance_counters();9495return g;96}97#endif // INCLUDE_ALL_GCS9899default:100guarantee(false, "unrecognized GenerationName");101return NULL;102}103}104105106