Mercurial > hg > graal-compiler
annotate src/share/vm/gc_implementation/concurrentMarkSweep/cmsGCAdaptivePolicyCounters.cpp @ 1716:be3f9c242c9d
6948538: CMS: BOT walkers can fall into object allocation and initialization cracks
Summary: GC workers now recognize an intermediate transient state of blocks which are allocated but have not yet completed initialization. blk_start() calls do not attempt to determine the size of a block in the transient state, rather waiting for the block to become initialized so that it is safe to query its size. Audited and ensured the order of initialization of object fields (klass, free bit and size) to respect block state transition protocol. Also included some new assertion checking code enabled in debug mode.
Reviewed-by: chrisphi, johnc, poonam
author | ysr |
---|---|
date | Mon, 16 Aug 2010 15:58:42 -0700 |
parents | c18cbe5936b8 |
children | f95d63e2154a |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
2 * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
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 | 22 * |
23 */ | |
24 | |
25 # include "incls/_precompiled.incl" | |
26 # include "incls/_cmsGCAdaptivePolicyCounters.cpp.incl" | |
27 | |
28 CMSGCAdaptivePolicyCounters::CMSGCAdaptivePolicyCounters(const char* name_arg, | |
29 int collectors, | |
30 int generations, | |
31 AdaptiveSizePolicy* size_policy_arg) | |
32 : GCAdaptivePolicyCounters(name_arg, | |
33 collectors, | |
34 generations, | |
35 size_policy_arg) { | |
36 if (UsePerfData) { | |
37 EXCEPTION_MARK; | |
38 ResourceMark rm; | |
39 | |
40 const char* cname = | |
41 PerfDataManager::counter_name(name_space(), "cmsCapacity"); | |
42 _cms_capacity_counter = PerfDataManager::create_variable(SUN_GC, cname, | |
43 PerfData::U_Bytes, (jlong) OldSize, CHECK); | |
44 #ifdef NOT_PRODUCT | |
45 cname = | |
46 PerfDataManager::counter_name(name_space(), "initialPause"); | |
47 _initial_pause_counter = PerfDataManager::create_variable(SUN_GC, cname, | |
48 PerfData::U_Ticks, | |
49 (jlong) cms_size_policy()->avg_initial_pause()->last_sample(), | |
50 CHECK); | |
51 | |
52 cname = PerfDataManager::counter_name(name_space(), "remarkPause"); | |
53 _remark_pause_counter = PerfDataManager::create_variable(SUN_GC, cname, | |
54 PerfData::U_Ticks, | |
55 (jlong) cms_size_policy()->avg_remark_pause()->last_sample(), | |
56 CHECK); | |
57 #endif | |
58 cname = | |
59 PerfDataManager::counter_name(name_space(), "avgInitialPause"); | |
60 _avg_initial_pause_counter = PerfDataManager::create_variable(SUN_GC, cname, | |
61 PerfData::U_Ticks, | |
62 (jlong) cms_size_policy()->avg_initial_pause()->average(), | |
63 CHECK); | |
64 | |
65 cname = PerfDataManager::counter_name(name_space(), "avgRemarkPause"); | |
66 _avg_remark_pause_counter = PerfDataManager::create_variable(SUN_GC, cname, | |
67 PerfData::U_Ticks, | |
68 (jlong) cms_size_policy()->avg_remark_pause()->average(), | |
69 CHECK); | |
70 | |
71 cname = PerfDataManager::counter_name(name_space(), "avgSTWGcCost"); | |
72 _avg_cms_STW_gc_cost_counter = PerfDataManager::create_variable(SUN_GC, | |
73 cname, | |
74 PerfData::U_Ticks, | |
75 (jlong) cms_size_policy()->avg_cms_STW_gc_cost()->average(), | |
76 CHECK); | |
77 | |
78 cname = PerfDataManager::counter_name(name_space(), "avgSTWTime"); | |
79 _avg_cms_STW_time_counter = PerfDataManager::create_variable(SUN_GC, | |
80 cname, | |
81 PerfData::U_Ticks, | |
82 (jlong) cms_size_policy()->avg_cms_STW_time()->average(), | |
83 CHECK); | |
84 | |
85 | |
86 cname = PerfDataManager::counter_name(name_space(), "avgConcurrentTime"); | |
87 _avg_concurrent_time_counter = PerfDataManager::create_variable(SUN_GC, | |
88 cname, | |
89 PerfData::U_Ticks, | |
90 (jlong) cms_size_policy()->avg_concurrent_time()->average(), | |
91 CHECK); | |
92 | |
93 cname = | |
94 PerfDataManager::counter_name(name_space(), "avgConcurrentInterval"); | |
95 _avg_concurrent_interval_counter = PerfDataManager::create_variable(SUN_GC, | |
96 cname, | |
97 PerfData::U_Ticks, | |
98 (jlong) cms_size_policy()->avg_concurrent_interval()->average(), | |
99 CHECK); | |
100 | |
101 cname = PerfDataManager::counter_name(name_space(), "avgConcurrentGcCost"); | |
102 _avg_concurrent_gc_cost_counter = PerfDataManager::create_variable(SUN_GC, | |
103 cname, | |
104 PerfData::U_Ticks, | |
105 (jlong) cms_size_policy()->avg_concurrent_gc_cost()->average(), | |
106 CHECK); | |
107 | |
108 cname = PerfDataManager::counter_name(name_space(), "avgCMSFreeAtSweep"); | |
109 _avg_cms_free_at_sweep_counter = PerfDataManager::create_variable(SUN_GC, | |
110 cname, | |
111 PerfData::U_Ticks, | |
112 (jlong) cms_size_policy()->avg_cms_free_at_sweep()->average(), | |
113 CHECK); | |
114 | |
115 cname = PerfDataManager::counter_name(name_space(), "avgCMSFree"); | |
116 _avg_cms_free_counter = PerfDataManager::create_variable(SUN_GC, | |
117 cname, | |
118 PerfData::U_Ticks, | |
119 (jlong) cms_size_policy()->avg_cms_free()->average(), | |
120 CHECK); | |
121 | |
122 cname = PerfDataManager::counter_name(name_space(), "avgCMSPromo"); | |
123 _avg_cms_promo_counter = PerfDataManager::create_variable(SUN_GC, | |
124 cname, | |
125 PerfData::U_Ticks, | |
126 (jlong) cms_size_policy()->avg_cms_promo()->average(), | |
127 CHECK); | |
128 | |
129 cname = PerfDataManager::counter_name(name_space(), "avgMscPause"); | |
130 _avg_msc_pause_counter = PerfDataManager::create_variable(SUN_GC, | |
131 cname, | |
132 PerfData::U_Ticks, | |
133 (jlong) cms_size_policy()->avg_msc_pause()->average(), | |
134 CHECK); | |
135 | |
136 cname = PerfDataManager::counter_name(name_space(), "avgMscInterval"); | |
137 _avg_msc_interval_counter = PerfDataManager::create_variable(SUN_GC, | |
138 cname, | |
139 PerfData::U_Ticks, | |
140 (jlong) cms_size_policy()->avg_msc_interval()->average(), | |
141 CHECK); | |
142 | |
143 cname = PerfDataManager::counter_name(name_space(), "mscGcCost"); | |
144 _msc_gc_cost_counter = PerfDataManager::create_variable(SUN_GC, | |
145 cname, | |
146 PerfData::U_Ticks, | |
147 (jlong) cms_size_policy()->avg_msc_gc_cost()->average(), | |
148 CHECK); | |
149 | |
150 cname = PerfDataManager::counter_name(name_space(), "avgMsPause"); | |
151 _avg_ms_pause_counter = PerfDataManager::create_variable(SUN_GC, | |
152 cname, | |
153 PerfData::U_Ticks, | |
154 (jlong) cms_size_policy()->avg_ms_pause()->average(), | |
155 CHECK); | |
156 | |
157 cname = PerfDataManager::counter_name(name_space(), "avgMsInterval"); | |
158 _avg_ms_interval_counter = PerfDataManager::create_variable(SUN_GC, | |
159 cname, | |
160 PerfData::U_Ticks, | |
161 (jlong) cms_size_policy()->avg_ms_interval()->average(), | |
162 CHECK); | |
163 | |
164 cname = PerfDataManager::counter_name(name_space(), "msGcCost"); | |
165 _ms_gc_cost_counter = PerfDataManager::create_variable(SUN_GC, | |
166 cname, | |
167 PerfData::U_Ticks, | |
168 (jlong) cms_size_policy()->avg_ms_gc_cost()->average(), | |
169 CHECK); | |
170 | |
171 cname = PerfDataManager::counter_name(name_space(), "majorGcCost"); | |
172 _major_gc_cost_counter = PerfDataManager::create_variable(SUN_GC, cname, | |
173 PerfData::U_Ticks, (jlong) cms_size_policy()->cms_gc_cost(), CHECK); | |
174 | |
175 cname = PerfDataManager::counter_name(name_space(), "avgPromotedAvg"); | |
176 _promoted_avg_counter = | |
177 PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes, | |
178 cms_size_policy()->calculated_promo_size_in_bytes(), CHECK); | |
179 | |
180 cname = PerfDataManager::counter_name(name_space(), "avgPromotedDev"); | |
181 _promoted_avg_dev_counter = | |
182 PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes, | |
183 (jlong) 0 , CHECK); | |
184 | |
185 cname = PerfDataManager::counter_name(name_space(), "avgPromotedPaddedAvg"); | |
186 _promoted_padded_avg_counter = | |
187 PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes, | |
188 cms_size_policy()->calculated_promo_size_in_bytes(), CHECK); | |
189 | |
190 cname = PerfDataManager::counter_name(name_space(), | |
191 "changeYoungGenForMajPauses"); | |
192 _change_young_gen_for_maj_pauses_counter = | |
193 PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Events, | |
194 (jlong)0, CHECK); | |
195 | |
196 cname = PerfDataManager::counter_name(name_space(), "remarkPauseOldSlope"); | |
197 _remark_pause_old_slope_counter = | |
198 PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes, | |
199 (jlong) cms_size_policy()->remark_pause_old_slope(), CHECK); | |
200 | |
201 cname = PerfDataManager::counter_name(name_space(), "initialPauseOldSlope"); | |
202 _initial_pause_old_slope_counter = | |
203 PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes, | |
204 (jlong) cms_size_policy()->initial_pause_old_slope(), CHECK); | |
205 | |
206 cname = | |
207 PerfDataManager::counter_name(name_space(), "remarkPauseYoungSlope") ; | |
208 _remark_pause_young_slope_counter = | |
209 PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes, | |
210 (jlong) cms_size_policy()->remark_pause_young_slope(), CHECK); | |
211 | |
212 cname = | |
213 PerfDataManager::counter_name(name_space(), "initialPauseYoungSlope"); | |
214 _initial_pause_young_slope_counter = | |
215 PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes, | |
216 (jlong) cms_size_policy()->initial_pause_young_slope(), CHECK); | |
217 | |
218 | |
219 } | |
220 assert(size_policy()->is_gc_cms_adaptive_size_policy(), | |
221 "Wrong type of size policy"); | |
222 } | |
223 | |
224 void CMSGCAdaptivePolicyCounters::update_counters() { | |
225 if (UsePerfData) { | |
226 GCAdaptivePolicyCounters::update_counters_from_policy(); | |
227 update_counters_from_policy(); | |
228 } | |
229 } | |
230 | |
231 void CMSGCAdaptivePolicyCounters::update_counters(CMSGCStats* gc_stats) { | |
232 if (UsePerfData) { | |
233 update_counters(); | |
234 update_promoted((size_t) gc_stats->avg_promoted()->last_sample()); | |
235 update_avg_promoted_avg(gc_stats); | |
236 update_avg_promoted_dev(gc_stats); | |
237 update_avg_promoted_padded_avg(gc_stats); | |
238 } | |
239 } | |
240 | |
241 void CMSGCAdaptivePolicyCounters::update_counters_from_policy() { | |
242 if (UsePerfData && (cms_size_policy() != NULL)) { | |
243 | |
244 GCAdaptivePolicyCounters::update_counters_from_policy(); | |
245 | |
246 update_major_gc_cost_counter(); | |
247 update_mutator_cost_counter(); | |
248 | |
249 update_eden_size(); | |
250 update_promo_size(); | |
251 | |
252 // If these updates from the last_sample() work, | |
253 // revise the update methods for these counters | |
254 // (both here and in PS). | |
255 update_survived((size_t) cms_size_policy()->avg_survived()->last_sample()); | |
256 | |
257 update_avg_concurrent_time_counter(); | |
258 update_avg_concurrent_interval_counter(); | |
259 update_avg_concurrent_gc_cost_counter(); | |
260 #ifdef NOT_PRODUCT | |
261 update_initial_pause_counter(); | |
262 update_remark_pause_counter(); | |
263 #endif | |
264 update_avg_initial_pause_counter(); | |
265 update_avg_remark_pause_counter(); | |
266 | |
267 update_avg_cms_STW_time_counter(); | |
268 update_avg_cms_STW_gc_cost_counter(); | |
269 | |
270 update_avg_cms_free_counter(); | |
271 update_avg_cms_free_at_sweep_counter(); | |
272 update_avg_cms_promo_counter(); | |
273 | |
274 update_avg_msc_pause_counter(); | |
275 update_avg_msc_interval_counter(); | |
276 update_msc_gc_cost_counter(); | |
277 | |
278 update_avg_ms_pause_counter(); | |
279 update_avg_ms_interval_counter(); | |
280 update_ms_gc_cost_counter(); | |
281 | |
282 update_avg_old_live_counter(); | |
283 | |
284 update_survivor_size_counters(); | |
285 update_avg_survived_avg_counters(); | |
286 update_avg_survived_dev_counters(); | |
287 | |
288 update_decrement_tenuring_threshold_for_gc_cost(); | |
289 update_increment_tenuring_threshold_for_gc_cost(); | |
290 update_decrement_tenuring_threshold_for_survivor_limit(); | |
291 | |
292 update_change_young_gen_for_maj_pauses(); | |
293 | |
294 update_major_collection_slope_counter(); | |
295 update_remark_pause_old_slope_counter(); | |
296 update_initial_pause_old_slope_counter(); | |
297 update_remark_pause_young_slope_counter(); | |
298 update_initial_pause_young_slope_counter(); | |
299 | |
300 update_decide_at_full_gc_counter(); | |
301 } | |
302 } |