author | jmasa |
Fri, 01 Aug 2014 15:40:12 -0700 | |
changeset 25905 | 04a3d83cc752 |
parent 25366 | 8b8061f353ee |
child 26700 | 8107d0778244 |
permissions | -rw-r--r-- |
21561
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
1 |
/* |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
2 |
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
4 |
* |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
8 |
* |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
13 |
* accompanied this code). |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
14 |
* |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
18 |
* |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
21 |
* questions. |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
22 |
* |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
23 |
*/ |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
24 |
|
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
25 |
#include "precompiled.hpp" |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
26 |
#include "gc_implementation/parallelScavenge/generationSizer.hpp" |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
27 |
#include "memory/collectorPolicy.hpp" |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
28 |
|
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
29 |
void GenerationSizer::trace_gen_sizes(const char* const str) { |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
30 |
if (TracePageSizes) { |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
31 |
tty->print_cr("%s: " SIZE_FORMAT "," SIZE_FORMAT " " |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
32 |
SIZE_FORMAT "," SIZE_FORMAT " " |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
33 |
SIZE_FORMAT, |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
34 |
str, |
24941
4ebbe176a7b1
8042298: Remove the names gen0 and gen1 from the GC code
jwilhelm
parents:
24353
diff
changeset
|
35 |
_min_old_size / K, _max_old_size / K, |
4ebbe176a7b1
8042298: Remove the names gen0 and gen1 from the GC code
jwilhelm
parents:
24353
diff
changeset
|
36 |
_min_young_size / K, _max_young_size / K, |
21561
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
37 |
_max_heap_byte_size / K); |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
38 |
} |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
39 |
} |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
40 |
|
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
41 |
void GenerationSizer::initialize_alignments() { |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
42 |
_space_alignment = _gen_alignment = default_gen_alignment(); |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
43 |
_heap_alignment = compute_heap_alignment(); |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
44 |
} |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
45 |
|
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
46 |
void GenerationSizer::initialize_flags() { |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
47 |
// Do basic sizing work |
24353
148147d21135
8027643: Merge GenCollectorPolicy and TwoGenerationCollectorPolicy
jwilhelm
parents:
21570
diff
changeset
|
48 |
GenCollectorPolicy::initialize_flags(); |
21561
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
49 |
|
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
50 |
assert(UseSerialGC || |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
51 |
!FLAG_IS_DEFAULT(ParallelGCThreads) || |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
52 |
(ParallelGCThreads > 0), |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
53 |
"ParallelGCThreads should be set before flag initialization"); |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
54 |
|
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
55 |
// The survivor ratio's are calculated "raw", unlike the |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
56 |
// default gc, which adds 2 to the ratio value. We need to |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
57 |
// make sure the values are valid before using them. |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
58 |
if (MinSurvivorRatio < 3) { |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
59 |
FLAG_SET_ERGO(uintx, MinSurvivorRatio, 3); |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
60 |
} |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
61 |
|
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
62 |
if (InitialSurvivorRatio < 3) { |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
63 |
FLAG_SET_ERGO(uintx, InitialSurvivorRatio, 3); |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
64 |
} |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
65 |
} |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
66 |
|
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
67 |
void GenerationSizer::initialize_size_info() { |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
68 |
trace_gen_sizes("ps heap raw"); |
25366 | 69 |
const size_t page_sz = os::page_size_for_region(_min_heap_byte_size, |
70 |
_max_heap_byte_size, |
|
71 |
8); |
|
21561
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
72 |
|
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
73 |
// Can a page size be something else than a power of two? |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
74 |
assert(is_power_of_2((intptr_t)page_sz), "must be a power of 2"); |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
75 |
size_t new_alignment = round_to(page_sz, _gen_alignment); |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
76 |
if (new_alignment != _gen_alignment) { |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
77 |
_gen_alignment = new_alignment; |
21570
7006807e3cc8
8027960: Assertion assert(end >= start) failed during nightly testing on solaris
sjohanss
parents:
21561
diff
changeset
|
78 |
_space_alignment = new_alignment; |
21561
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
79 |
// Redo everything from the start |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
80 |
initialize_flags(); |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
81 |
} |
24353
148147d21135
8027643: Merge GenCollectorPolicy and TwoGenerationCollectorPolicy
jwilhelm
parents:
21570
diff
changeset
|
82 |
GenCollectorPolicy::initialize_size_info(); |
21561
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
83 |
|
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
84 |
trace_gen_sizes("ps heap rnd"); |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
85 |
} |