comparison src/share/vm/gc_implementation/g1/g1MonitoringSupport.cpp @ 6010:720b6a76dd9d

7157073: G1: type change size_t -> uint for region counts / indexes Summary: Change the type of fields / variables / etc. that represent region counts and indeces from size_t to uint. Reviewed-by: iveresov, brutisso, jmasa, jwilhelm
author tonyp
date Wed, 18 Apr 2012 07:21:15 -0400
parents b5290bf0a9e4
children da91efe96a93
comparison
equal deleted inserted replaced
6009:dde53abda3d6 6010:720b6a76dd9d
1 /* 1 /*
2 * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
175 // Recalculate all the sizes from scratch. We assume that this is 175 // Recalculate all the sizes from scratch. We assume that this is
176 // called at a point where no concurrent updates to the various 176 // called at a point where no concurrent updates to the various
177 // values we read here are possible (i.e., at a STW phase at the end 177 // values we read here are possible (i.e., at a STW phase at the end
178 // of a GC). 178 // of a GC).
179 179
180 size_t young_list_length = g1->young_list()->length(); 180 uint young_list_length = g1->young_list()->length();
181 size_t survivor_list_length = g1->g1_policy()->recorded_survivor_regions(); 181 uint survivor_list_length = g1->g1_policy()->recorded_survivor_regions();
182 assert(young_list_length >= survivor_list_length, "invariant"); 182 assert(young_list_length >= survivor_list_length, "invariant");
183 size_t eden_list_length = young_list_length - survivor_list_length; 183 uint eden_list_length = young_list_length - survivor_list_length;
184 // Max length includes any potential extensions to the young gen 184 // Max length includes any potential extensions to the young gen
185 // we'll do when the GC locker is active. 185 // we'll do when the GC locker is active.
186 size_t young_list_max_length = g1->g1_policy()->young_list_max_length(); 186 uint young_list_max_length = g1->g1_policy()->young_list_max_length();
187 assert(young_list_max_length >= survivor_list_length, "invariant"); 187 assert(young_list_max_length >= survivor_list_length, "invariant");
188 size_t eden_list_max_length = young_list_max_length - survivor_list_length; 188 uint eden_list_max_length = young_list_max_length - survivor_list_length;
189 189
190 _overall_used = g1->used_unlocked(); 190 _overall_used = g1->used_unlocked();
191 _eden_used = eden_list_length * HeapRegion::GrainBytes; 191 _eden_used = (size_t) eden_list_length * HeapRegion::GrainBytes;
192 _survivor_used = survivor_list_length * HeapRegion::GrainBytes; 192 _survivor_used = (size_t) survivor_list_length * HeapRegion::GrainBytes;
193 _young_region_num = young_list_length; 193 _young_region_num = young_list_length;
194 _old_used = subtract_up_to_zero(_overall_used, _eden_used + _survivor_used); 194 _old_used = subtract_up_to_zero(_overall_used, _eden_used + _survivor_used);
195 195
196 // First calculate the committed sizes that can be calculated independently. 196 // First calculate the committed sizes that can be calculated independently.
197 _survivor_committed = _survivor_used; 197 _survivor_committed = _survivor_used;
205 // survivor and old space). 205 // survivor and old space).
206 assert(committed >= (_survivor_committed + _old_committed), "sanity"); 206 assert(committed >= (_survivor_committed + _old_committed), "sanity");
207 committed -= _survivor_committed + _old_committed; 207 committed -= _survivor_committed + _old_committed;
208 208
209 // Next, calculate and remove the committed size for the eden. 209 // Next, calculate and remove the committed size for the eden.
210 _eden_committed = eden_list_max_length * HeapRegion::GrainBytes; 210 _eden_committed = (size_t) eden_list_max_length * HeapRegion::GrainBytes;
211 // Somewhat defensive: be robust in case there are inaccuracies in 211 // Somewhat defensive: be robust in case there are inaccuracies in
212 // the calculations 212 // the calculations
213 _eden_committed = MIN2(_eden_committed, committed); 213 _eden_committed = MIN2(_eden_committed, committed);
214 committed -= _eden_committed; 214 committed -= _eden_committed;
215 215
235 G1CollectedHeap* g1 = g1h(); 235 G1CollectedHeap* g1 = g1h();
236 236
237 // When a new eden region is allocated, only the eden_used size is 237 // When a new eden region is allocated, only the eden_used size is
238 // affected (since we have recalculated everything else at the last GC). 238 // affected (since we have recalculated everything else at the last GC).
239 239
240 size_t young_region_num = g1h()->young_list()->length(); 240 uint young_region_num = g1h()->young_list()->length();
241 if (young_region_num > _young_region_num) { 241 if (young_region_num > _young_region_num) {
242 size_t diff = young_region_num - _young_region_num; 242 uint diff = young_region_num - _young_region_num;
243 _eden_used += diff * HeapRegion::GrainBytes; 243 _eden_used += (size_t) diff * HeapRegion::GrainBytes;
244 // Somewhat defensive: cap the eden used size to make sure it 244 // Somewhat defensive: cap the eden used size to make sure it
245 // never exceeds the committed size. 245 // never exceeds the committed size.
246 _eden_used = MIN2(_eden_used, _eden_committed); 246 _eden_used = MIN2(_eden_used, _eden_committed);
247 _young_region_num = young_region_num; 247 _young_region_num = young_region_num;
248 } 248 }