Mercurial > hg > graal-jvmci-8
comparison src/share/vm/memory/collectorPolicy.cpp @ 8016:1135141fb97e
Merge
author | brutisso |
---|---|
date | Fri, 08 Feb 2013 10:08:40 +0100 |
parents | db9981fd3124 95ccff9eee8e |
children | fd7b3770c77e |
comparison
equal
deleted
inserted
replaced
8004:df8462fbe585 | 8016:1135141fb97e |
---|---|
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. |
233 GenCollectorPolicy::initialize_flags(); | 233 GenCollectorPolicy::initialize_flags(); |
234 | 234 |
235 OldSize = align_size_down(OldSize, min_alignment()); | 235 OldSize = align_size_down(OldSize, min_alignment()); |
236 if (NewSize + OldSize > MaxHeapSize) { | 236 if (NewSize + OldSize > MaxHeapSize) { |
237 MaxHeapSize = NewSize + OldSize; | 237 MaxHeapSize = NewSize + OldSize; |
238 } | |
239 | |
240 if (FLAG_IS_CMDLINE(OldSize) && FLAG_IS_DEFAULT(NewSize)) { | |
241 // NewRatio will be used later to set the young generation size so we use | |
242 // it to calculate how big the heap should be based on the requested OldSize | |
243 // and NewRatio. | |
244 assert(NewRatio > 0, "NewRatio should have been set up earlier"); | |
245 size_t calculated_heapsize = (OldSize / NewRatio) * (NewRatio + 1); | |
246 | |
247 calculated_heapsize = align_size_up(calculated_heapsize, max_alignment()); | |
248 MaxHeapSize = calculated_heapsize; | |
249 InitialHeapSize = calculated_heapsize; | |
238 } | 250 } |
239 MaxHeapSize = align_size_up(MaxHeapSize, max_alignment()); | 251 MaxHeapSize = align_size_up(MaxHeapSize, max_alignment()); |
240 | 252 |
241 always_do_update_barrier = UseConcMarkSweepGC; | 253 always_do_update_barrier = UseConcMarkSweepGC; |
242 | 254 |
383 // is used to make the needed adjustments. The application of the | 395 // is used to make the needed adjustments. The application of the |
384 // policies could be more sophisticated (iterative for example) but | 396 // policies could be more sophisticated (iterative for example) but |
385 // keeping it simple also seems a worthwhile goal. | 397 // keeping it simple also seems a worthwhile goal. |
386 bool TwoGenerationCollectorPolicy::adjust_gen0_sizes(size_t* gen0_size_ptr, | 398 bool TwoGenerationCollectorPolicy::adjust_gen0_sizes(size_t* gen0_size_ptr, |
387 size_t* gen1_size_ptr, | 399 size_t* gen1_size_ptr, |
388 size_t heap_size, | 400 const size_t heap_size, |
389 size_t min_gen0_size) { | 401 const size_t min_gen1_size) { |
390 bool result = false; | 402 bool result = false; |
403 | |
391 if ((*gen1_size_ptr + *gen0_size_ptr) > heap_size) { | 404 if ((*gen1_size_ptr + *gen0_size_ptr) > heap_size) { |
392 if (((*gen0_size_ptr + OldSize) > heap_size) && | 405 if ((heap_size < (*gen0_size_ptr + min_gen1_size)) && |
393 (heap_size - min_gen0_size) >= min_alignment()) { | 406 (heap_size >= min_gen1_size + min_alignment())) { |
394 // Adjust gen0 down to accomodate OldSize | 407 // Adjust gen0 down to accommodate min_gen1_size |
395 *gen0_size_ptr = heap_size - min_gen0_size; | 408 *gen0_size_ptr = heap_size - min_gen1_size; |
396 *gen0_size_ptr = | 409 *gen0_size_ptr = |
397 MAX2((uintx)align_size_down(*gen0_size_ptr, min_alignment()), | 410 MAX2((uintx)align_size_down(*gen0_size_ptr, min_alignment()), |
398 min_alignment()); | 411 min_alignment()); |
399 assert(*gen0_size_ptr > 0, "Min gen0 is too large"); | 412 assert(*gen0_size_ptr > 0, "Min gen0 is too large"); |
400 result = true; | 413 result = true; |