Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp @ 10288:eba99d16dc6f
8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
Summary: split up compute_generation_free_space() into two functions: compute_eden_space_size() + compute_old_gen_free_space(), each of which (if needed) can be reused without executing an overhead of the other.
Reviewed-by: jmasa, tschatzl
Contributed-by: tamao <tao.mao@oracle.com>
author | tamao |
---|---|
date | Wed, 15 May 2013 10:41:22 -0700 |
parents | 12f651e29f6b |
children | 001ec9515f84 |
comparison
equal
deleted
inserted
replaced
10287:12f651e29f6b | 10288:eba99d16dc6f |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2001, 2013, 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. |
275 // Calculate optimal free space amounts | 275 // Calculate optimal free space amounts |
276 assert(young_gen->max_size() > | 276 assert(young_gen->max_size() > |
277 young_gen->from_space()->capacity_in_bytes() + | 277 young_gen->from_space()->capacity_in_bytes() + |
278 young_gen->to_space()->capacity_in_bytes(), | 278 young_gen->to_space()->capacity_in_bytes(), |
279 "Sizes of space in young gen are out-of-bounds"); | 279 "Sizes of space in young gen are out-of-bounds"); |
280 | |
281 size_t young_live = young_gen->used_in_bytes(); | |
282 size_t eden_live = young_gen->eden_space()->used_in_bytes(); | |
283 size_t old_live = old_gen->used_in_bytes(); | |
284 size_t cur_eden = young_gen->eden_space()->capacity_in_bytes(); | |
285 size_t max_old_gen_size = old_gen->max_gen_size(); | |
280 size_t max_eden_size = young_gen->max_size() - | 286 size_t max_eden_size = young_gen->max_size() - |
281 young_gen->from_space()->capacity_in_bytes() - | 287 young_gen->from_space()->capacity_in_bytes() - |
282 young_gen->to_space()->capacity_in_bytes(); | 288 young_gen->to_space()->capacity_in_bytes(); |
283 size_policy->compute_generation_free_space(young_gen->used_in_bytes(), | 289 |
284 young_gen->eden_space()->used_in_bytes(), | 290 // Used for diagnostics |
285 old_gen->used_in_bytes(), | 291 size_policy->clear_generation_free_space_flags(); |
286 young_gen->eden_space()->capacity_in_bytes(), | 292 |
287 old_gen->max_gen_size(), | 293 size_policy->compute_generation_free_space(young_live, |
288 max_eden_size, | 294 eden_live, |
289 true /* full gc*/, | 295 old_live, |
290 gc_cause, | 296 cur_eden, |
291 heap->collector_policy()); | 297 max_old_gen_size, |
298 max_eden_size, | |
299 true /* full gc*/); | |
300 | |
301 size_policy->check_gc_overhead_limit(young_live, | |
302 eden_live, | |
303 max_old_gen_size, | |
304 max_eden_size, | |
305 true /* full gc*/, | |
306 gc_cause, | |
307 heap->collector_policy()); | |
308 | |
309 size_policy->decay_supplemental_growth(true /* full gc*/); | |
292 | 310 |
293 heap->resize_old_gen(size_policy->calculated_old_free_size_in_bytes()); | 311 heap->resize_old_gen(size_policy->calculated_old_free_size_in_bytes()); |
294 | 312 |
295 // Don't resize the young generation at an major collection. A | 313 // Don't resize the young generation at an major collection. A |
296 // desired young generation size may have been calculated but | 314 // desired young generation size may have been calculated but |