annotate src/share/vm/memory/generationSpec.cpp @ 1972:f95d63e2154a

6989984: Use standard include model for Hospot Summary: Replaced MakeDeps and the includeDB files with more standardized solutions. Reviewed-by: coleenp, kvn, kamg
author stefank
date Tue, 23 Nov 2010 13:22:55 -0800
parents c18cbe5936b8
children 9f059abe8cf2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #include "precompiled.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #include "memory/compactPermGen.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27 #include "memory/defNewGeneration.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "memory/filemap.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "memory/genRemSet.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #include "memory/generationSpec.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31 #include "memory/tenuredGeneration.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32 #include "runtime/java.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
33 #ifndef SERIALGC
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
34 #include "gc_implementation/concurrentMarkSweep/cmsPermGen.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
35 #include "gc_implementation/parNew/asParNewGeneration.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
36 #include "gc_implementation/parNew/parNewGeneration.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
37 #endif
0
a61af66fc99e Initial load
duke
parents:
diff changeset
38
a61af66fc99e Initial load
duke
parents:
diff changeset
39 Generation* GenerationSpec::init(ReservedSpace rs, int level,
a61af66fc99e Initial load
duke
parents:
diff changeset
40 GenRemSet* remset) {
a61af66fc99e Initial load
duke
parents:
diff changeset
41 switch (name()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
42 case Generation::DefNew:
a61af66fc99e Initial load
duke
parents:
diff changeset
43 return new DefNewGeneration(rs, init_size(), level);
a61af66fc99e Initial load
duke
parents:
diff changeset
44
a61af66fc99e Initial load
duke
parents:
diff changeset
45 case Generation::MarkSweepCompact:
a61af66fc99e Initial load
duke
parents:
diff changeset
46 return new TenuredGeneration(rs, init_size(), level, remset);
a61af66fc99e Initial load
duke
parents:
diff changeset
47
a61af66fc99e Initial load
duke
parents:
diff changeset
48 #ifndef SERIALGC
a61af66fc99e Initial load
duke
parents:
diff changeset
49 case Generation::ParNew:
a61af66fc99e Initial load
duke
parents:
diff changeset
50 return new ParNewGeneration(rs, init_size(), level);
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52 case Generation::ASParNew:
a61af66fc99e Initial load
duke
parents:
diff changeset
53 return new ASParNewGeneration(rs,
a61af66fc99e Initial load
duke
parents:
diff changeset
54 init_size(),
a61af66fc99e Initial load
duke
parents:
diff changeset
55 init_size() /* min size */,
a61af66fc99e Initial load
duke
parents:
diff changeset
56 level);
a61af66fc99e Initial load
duke
parents:
diff changeset
57
a61af66fc99e Initial load
duke
parents:
diff changeset
58 case Generation::ConcurrentMarkSweep: {
a61af66fc99e Initial load
duke
parents:
diff changeset
59 assert(UseConcMarkSweepGC, "UseConcMarkSweepGC should be set");
a61af66fc99e Initial load
duke
parents:
diff changeset
60 CardTableRS* ctrs = remset->as_CardTableRS();
a61af66fc99e Initial load
duke
parents:
diff changeset
61 if (ctrs == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
62 vm_exit_during_initialization("Rem set incompatibility.");
a61af66fc99e Initial load
duke
parents:
diff changeset
63 }
a61af66fc99e Initial load
duke
parents:
diff changeset
64 // Otherwise
a61af66fc99e Initial load
duke
parents:
diff changeset
65 // The constructor creates the CMSCollector if needed,
a61af66fc99e Initial load
duke
parents:
diff changeset
66 // else registers with an existing CMSCollector
a61af66fc99e Initial load
duke
parents:
diff changeset
67
a61af66fc99e Initial load
duke
parents:
diff changeset
68 ConcurrentMarkSweepGeneration* g = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
69 g = new ConcurrentMarkSweepGeneration(rs,
a61af66fc99e Initial load
duke
parents:
diff changeset
70 init_size(), level, ctrs, UseCMSAdaptiveFreeLists,
a61af66fc99e Initial load
duke
parents:
diff changeset
71 (FreeBlockDictionary::DictionaryChoice)CMSDictionaryChoice);
a61af66fc99e Initial load
duke
parents:
diff changeset
72
a61af66fc99e Initial load
duke
parents:
diff changeset
73 g->initialize_performance_counters();
a61af66fc99e Initial load
duke
parents:
diff changeset
74
a61af66fc99e Initial load
duke
parents:
diff changeset
75 return g;
a61af66fc99e Initial load
duke
parents:
diff changeset
76 }
a61af66fc99e Initial load
duke
parents:
diff changeset
77
a61af66fc99e Initial load
duke
parents:
diff changeset
78 case Generation::ASConcurrentMarkSweep: {
a61af66fc99e Initial load
duke
parents:
diff changeset
79 assert(UseConcMarkSweepGC, "UseConcMarkSweepGC should be set");
a61af66fc99e Initial load
duke
parents:
diff changeset
80 CardTableRS* ctrs = remset->as_CardTableRS();
a61af66fc99e Initial load
duke
parents:
diff changeset
81 if (ctrs == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
82 vm_exit_during_initialization("Rem set incompatibility.");
a61af66fc99e Initial load
duke
parents:
diff changeset
83 }
a61af66fc99e Initial load
duke
parents:
diff changeset
84 // Otherwise
a61af66fc99e Initial load
duke
parents:
diff changeset
85 // The constructor creates the CMSCollector if needed,
a61af66fc99e Initial load
duke
parents:
diff changeset
86 // else registers with an existing CMSCollector
a61af66fc99e Initial load
duke
parents:
diff changeset
87
a61af66fc99e Initial load
duke
parents:
diff changeset
88 ASConcurrentMarkSweepGeneration* g = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
89 g = new ASConcurrentMarkSweepGeneration(rs,
a61af66fc99e Initial load
duke
parents:
diff changeset
90 init_size(), level, ctrs, UseCMSAdaptiveFreeLists,
a61af66fc99e Initial load
duke
parents:
diff changeset
91 (FreeBlockDictionary::DictionaryChoice)CMSDictionaryChoice);
a61af66fc99e Initial load
duke
parents:
diff changeset
92
a61af66fc99e Initial load
duke
parents:
diff changeset
93 g->initialize_performance_counters();
a61af66fc99e Initial load
duke
parents:
diff changeset
94
a61af66fc99e Initial load
duke
parents:
diff changeset
95 return g;
a61af66fc99e Initial load
duke
parents:
diff changeset
96 }
a61af66fc99e Initial load
duke
parents:
diff changeset
97 #endif // SERIALGC
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 default:
a61af66fc99e Initial load
duke
parents:
diff changeset
100 guarantee(false, "unrecognized GenerationName");
a61af66fc99e Initial load
duke
parents:
diff changeset
101 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
102 }
a61af66fc99e Initial load
duke
parents:
diff changeset
103 }
a61af66fc99e Initial load
duke
parents:
diff changeset
104
a61af66fc99e Initial load
duke
parents:
diff changeset
105
a61af66fc99e Initial load
duke
parents:
diff changeset
106 PermanentGenerationSpec::PermanentGenerationSpec(PermGen::Name name,
a61af66fc99e Initial load
duke
parents:
diff changeset
107 size_t init_size, size_t max_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
108 size_t read_only_size, size_t read_write_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
109 size_t misc_data_size, size_t misc_code_size) {
a61af66fc99e Initial load
duke
parents:
diff changeset
110 _name = name;
a61af66fc99e Initial load
duke
parents:
diff changeset
111 _init_size = init_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113 if (UseSharedSpaces || DumpSharedSpaces) {
a61af66fc99e Initial load
duke
parents:
diff changeset
114 _enable_shared_spaces = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
115 if (UseSharedSpaces) {
a61af66fc99e Initial load
duke
parents:
diff changeset
116 // Override shared space sizes from those in the file.
a61af66fc99e Initial load
duke
parents:
diff changeset
117 FileMapInfo* mapinfo = FileMapInfo::current_info();
a61af66fc99e Initial load
duke
parents:
diff changeset
118 _read_only_size = mapinfo->space_capacity(CompactingPermGenGen::ro);
a61af66fc99e Initial load
duke
parents:
diff changeset
119 _read_write_size = mapinfo->space_capacity(CompactingPermGenGen::rw);
a61af66fc99e Initial load
duke
parents:
diff changeset
120 _misc_data_size = mapinfo->space_capacity(CompactingPermGenGen::md);
a61af66fc99e Initial load
duke
parents:
diff changeset
121 _misc_code_size = mapinfo->space_capacity(CompactingPermGenGen::mc);
a61af66fc99e Initial load
duke
parents:
diff changeset
122 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
123 _read_only_size = read_only_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
124 _read_write_size = read_write_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
125 _misc_data_size = misc_data_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
126 _misc_code_size = misc_code_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
127 }
a61af66fc99e Initial load
duke
parents:
diff changeset
128 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
129 _enable_shared_spaces = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
130 _read_only_size = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
131 _read_write_size = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
132 _misc_data_size = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
133 _misc_code_size = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
134 }
a61af66fc99e Initial load
duke
parents:
diff changeset
135
a61af66fc99e Initial load
duke
parents:
diff changeset
136 _max_size = max_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
137 }
a61af66fc99e Initial load
duke
parents:
diff changeset
138
a61af66fc99e Initial load
duke
parents:
diff changeset
139
a61af66fc99e Initial load
duke
parents:
diff changeset
140 PermGen* PermanentGenerationSpec::init(ReservedSpace rs,
a61af66fc99e Initial load
duke
parents:
diff changeset
141 size_t init_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
142 GenRemSet *remset) {
a61af66fc99e Initial load
duke
parents:
diff changeset
143
a61af66fc99e Initial load
duke
parents:
diff changeset
144 // Break the reserved spaces into pieces for the permanent space
a61af66fc99e Initial load
duke
parents:
diff changeset
145 // and the shared spaces.
a61af66fc99e Initial load
duke
parents:
diff changeset
146 ReservedSpace perm_rs = rs.first_part(_max_size, UseSharedSpaces,
a61af66fc99e Initial load
duke
parents:
diff changeset
147 UseSharedSpaces);
a61af66fc99e Initial load
duke
parents:
diff changeset
148 ReservedSpace shared_rs = rs.last_part(_max_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
149
a61af66fc99e Initial load
duke
parents:
diff changeset
150 if (enable_shared_spaces()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
151 if (!perm_rs.is_reserved() ||
a61af66fc99e Initial load
duke
parents:
diff changeset
152 perm_rs.base() + perm_rs.size() != shared_rs.base()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
153 FileMapInfo* mapinfo = FileMapInfo::current_info();
a61af66fc99e Initial load
duke
parents:
diff changeset
154 mapinfo->fail_continue("Sharing disabled - unable to "
a61af66fc99e Initial load
duke
parents:
diff changeset
155 "reserve address space.");
a61af66fc99e Initial load
duke
parents:
diff changeset
156 shared_rs.release();
a61af66fc99e Initial load
duke
parents:
diff changeset
157 disable_sharing();
a61af66fc99e Initial load
duke
parents:
diff changeset
158 }
a61af66fc99e Initial load
duke
parents:
diff changeset
159 }
a61af66fc99e Initial load
duke
parents:
diff changeset
160
a61af66fc99e Initial load
duke
parents:
diff changeset
161 switch (name()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
162 case PermGen::MarkSweepCompact:
a61af66fc99e Initial load
duke
parents:
diff changeset
163 return new CompactingPermGen(perm_rs, shared_rs, init_size, remset, this);
a61af66fc99e Initial load
duke
parents:
diff changeset
164
a61af66fc99e Initial load
duke
parents:
diff changeset
165 #ifndef SERIALGC
a61af66fc99e Initial load
duke
parents:
diff changeset
166 case PermGen::MarkSweep:
a61af66fc99e Initial load
duke
parents:
diff changeset
167 guarantee(false, "NYI");
a61af66fc99e Initial load
duke
parents:
diff changeset
168 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
169
a61af66fc99e Initial load
duke
parents:
diff changeset
170 case PermGen::ConcurrentMarkSweep: {
a61af66fc99e Initial load
duke
parents:
diff changeset
171 assert(UseConcMarkSweepGC, "UseConcMarkSweepGC should be set");
a61af66fc99e Initial load
duke
parents:
diff changeset
172 CardTableRS* ctrs = remset->as_CardTableRS();
a61af66fc99e Initial load
duke
parents:
diff changeset
173 if (ctrs == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
174 vm_exit_during_initialization("RemSet/generation incompatibility.");
a61af66fc99e Initial load
duke
parents:
diff changeset
175 }
a61af66fc99e Initial load
duke
parents:
diff changeset
176 // XXXPERM
a61af66fc99e Initial load
duke
parents:
diff changeset
177 return new CMSPermGen(perm_rs, init_size, ctrs,
a61af66fc99e Initial load
duke
parents:
diff changeset
178 (FreeBlockDictionary::DictionaryChoice)CMSDictionaryChoice);
a61af66fc99e Initial load
duke
parents:
diff changeset
179 }
a61af66fc99e Initial load
duke
parents:
diff changeset
180 #endif // SERIALGC
a61af66fc99e Initial load
duke
parents:
diff changeset
181 default:
a61af66fc99e Initial load
duke
parents:
diff changeset
182 guarantee(false, "unrecognized GenerationName");
a61af66fc99e Initial load
duke
parents:
diff changeset
183 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
184 }
a61af66fc99e Initial load
duke
parents:
diff changeset
185 }
a61af66fc99e Initial load
duke
parents:
diff changeset
186
a61af66fc99e Initial load
duke
parents:
diff changeset
187
a61af66fc99e Initial load
duke
parents:
diff changeset
188 // Alignment
a61af66fc99e Initial load
duke
parents:
diff changeset
189 void PermanentGenerationSpec::align(size_t alignment) {
a61af66fc99e Initial load
duke
parents:
diff changeset
190 _init_size = align_size_up(_init_size, alignment);
a61af66fc99e Initial load
duke
parents:
diff changeset
191 _max_size = align_size_up(_max_size, alignment);
a61af66fc99e Initial load
duke
parents:
diff changeset
192 _read_only_size = align_size_up(_read_only_size, alignment);
a61af66fc99e Initial load
duke
parents:
diff changeset
193 _read_write_size = align_size_up(_read_write_size, alignment);
a61af66fc99e Initial load
duke
parents:
diff changeset
194 _misc_data_size = align_size_up(_misc_data_size, alignment);
a61af66fc99e Initial load
duke
parents:
diff changeset
195 _misc_code_size = align_size_up(_misc_code_size, alignment);
a61af66fc99e Initial load
duke
parents:
diff changeset
196
a61af66fc99e Initial load
duke
parents:
diff changeset
197 assert(enable_shared_spaces() || (_read_only_size + _read_write_size == 0),
a61af66fc99e Initial load
duke
parents:
diff changeset
198 "Shared space when disabled?");
a61af66fc99e Initial load
duke
parents:
diff changeset
199 }