src/share/vm/memory/generationSpec.cpp

Tue, 11 Sep 2012 14:59:23 +0200

author
stefank
date
Tue, 11 Sep 2012 14:59:23 +0200
changeset 4050
ec98e58952b2
parent 4037
da91efe96a93
child 4542
db9981fd3124
permissions
-rw-r--r--

7197350: NPG: jvmtiHeapReferenceCallback receives incorrect reference_kind for system class roots
Summary: Fix the iteration over the system classes and report the correct reference kind.
Reviewed-by: coleenp, rbackman

duke@435 1 /*
coleenp@4037 2 * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #include "precompiled.hpp"
coleenp@4037 26 #include "memory/binaryTreeDictionary.hpp"
stefank@2314 27 #include "memory/defNewGeneration.hpp"
stefank@2314 28 #include "memory/filemap.hpp"
stefank@2314 29 #include "memory/genRemSet.hpp"
stefank@2314 30 #include "memory/generationSpec.hpp"
stefank@2314 31 #include "memory/tenuredGeneration.hpp"
stefank@2314 32 #include "runtime/java.hpp"
stefank@2314 33 #ifndef SERIALGC
stefank@2314 34 #include "gc_implementation/parNew/asParNewGeneration.hpp"
coleenp@4037 35 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp"
stefank@2314 36 #include "gc_implementation/parNew/parNewGeneration.hpp"
stefank@2314 37 #endif
duke@435 38
duke@435 39 Generation* GenerationSpec::init(ReservedSpace rs, int level,
duke@435 40 GenRemSet* remset) {
duke@435 41 switch (name()) {
duke@435 42 case Generation::DefNew:
duke@435 43 return new DefNewGeneration(rs, init_size(), level);
duke@435 44
duke@435 45 case Generation::MarkSweepCompact:
duke@435 46 return new TenuredGeneration(rs, init_size(), level, remset);
duke@435 47
duke@435 48 #ifndef SERIALGC
duke@435 49 case Generation::ParNew:
duke@435 50 return new ParNewGeneration(rs, init_size(), level);
duke@435 51
duke@435 52 case Generation::ASParNew:
duke@435 53 return new ASParNewGeneration(rs,
duke@435 54 init_size(),
duke@435 55 init_size() /* min size */,
duke@435 56 level);
duke@435 57
duke@435 58 case Generation::ConcurrentMarkSweep: {
duke@435 59 assert(UseConcMarkSweepGC, "UseConcMarkSweepGC should be set");
duke@435 60 CardTableRS* ctrs = remset->as_CardTableRS();
duke@435 61 if (ctrs == NULL) {
duke@435 62 vm_exit_during_initialization("Rem set incompatibility.");
duke@435 63 }
duke@435 64 // Otherwise
duke@435 65 // The constructor creates the CMSCollector if needed,
duke@435 66 // else registers with an existing CMSCollector
duke@435 67
duke@435 68 ConcurrentMarkSweepGeneration* g = NULL;
duke@435 69 g = new ConcurrentMarkSweepGeneration(rs,
duke@435 70 init_size(), level, ctrs, UseCMSAdaptiveFreeLists,
jmasa@3730 71 (FreeBlockDictionary<FreeChunk>::DictionaryChoice)CMSDictionaryChoice);
duke@435 72
duke@435 73 g->initialize_performance_counters();
duke@435 74
duke@435 75 return g;
duke@435 76 }
duke@435 77
duke@435 78 case Generation::ASConcurrentMarkSweep: {
duke@435 79 assert(UseConcMarkSweepGC, "UseConcMarkSweepGC should be set");
duke@435 80 CardTableRS* ctrs = remset->as_CardTableRS();
duke@435 81 if (ctrs == NULL) {
duke@435 82 vm_exit_during_initialization("Rem set incompatibility.");
duke@435 83 }
duke@435 84 // Otherwise
duke@435 85 // The constructor creates the CMSCollector if needed,
duke@435 86 // else registers with an existing CMSCollector
duke@435 87
duke@435 88 ASConcurrentMarkSweepGeneration* g = NULL;
duke@435 89 g = new ASConcurrentMarkSweepGeneration(rs,
duke@435 90 init_size(), level, ctrs, UseCMSAdaptiveFreeLists,
jmasa@3730 91 (FreeBlockDictionary<FreeChunk>::DictionaryChoice)CMSDictionaryChoice);
duke@435 92
duke@435 93 g->initialize_performance_counters();
duke@435 94
duke@435 95 return g;
duke@435 96 }
duke@435 97 #endif // SERIALGC
duke@435 98
duke@435 99 default:
duke@435 100 guarantee(false, "unrecognized GenerationName");
duke@435 101 return NULL;
duke@435 102 }
duke@435 103 }

mercurial