Mercurial > hg > truffle
annotate src/share/vm/gc_implementation/parallelScavenge/generationSizer.cpp @ 19083:09292c24d555
LSStackSlotAllocator: hide inner class.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Sat, 31 Jan 2015 11:07:15 +0100 |
parents | ee527493b36d |
children |
rev | line source |
---|---|
13060
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
1 /* |
8f07aa079343
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. |
8f07aa079343
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. |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
4 * |
8f07aa079343
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 |
8f07aa079343
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 |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
8 * |
8f07aa079343
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 |
8f07aa079343
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 |
8f07aa079343
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 |
8f07aa079343
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 |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
13 * accompanied this code). |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
14 * |
8f07aa079343
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 |
8f07aa079343
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, |
8f07aa079343
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. |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
18 * |
8f07aa079343
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 |
8f07aa079343
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 |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
21 * questions. |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
22 * |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
23 */ |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
24 |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
25 #include "precompiled.hpp" |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
26 #include "gc_implementation/parallelScavenge/generationSizer.hpp" |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
27 #include "memory/collectorPolicy.hpp" |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
28 |
8f07aa079343
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) { |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
30 if (TracePageSizes) { |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
31 tty->print_cr("%s: " SIZE_FORMAT "," SIZE_FORMAT " " |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
32 SIZE_FORMAT "," SIZE_FORMAT " " |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
33 SIZE_FORMAT, |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
34 str, |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
35 _min_gen1_size / K, _max_gen1_size / K, |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
36 _min_gen0_size / K, _max_gen0_size / K, |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
37 _max_heap_byte_size / K); |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
38 } |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
39 } |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
40 |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
41 void GenerationSizer::initialize_alignments() { |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
42 _space_alignment = _gen_alignment = default_gen_alignment(); |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
43 _heap_alignment = compute_heap_alignment(); |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
44 } |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
45 |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
46 void GenerationSizer::initialize_flags() { |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
47 // Do basic sizing work |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
48 TwoGenerationCollectorPolicy::initialize_flags(); |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
49 |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
50 assert(UseSerialGC || |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
51 !FLAG_IS_DEFAULT(ParallelGCThreads) || |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
52 (ParallelGCThreads > 0), |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
53 "ParallelGCThreads should be set before flag initialization"); |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
54 |
8f07aa079343
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 |
8f07aa079343
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 |
8f07aa079343
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. |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
58 if (MinSurvivorRatio < 3) { |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
59 FLAG_SET_ERGO(uintx, MinSurvivorRatio, 3); |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
60 } |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
61 |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
62 if (InitialSurvivorRatio < 3) { |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
63 FLAG_SET_ERGO(uintx, InitialSurvivorRatio, 3); |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
64 } |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
65 } |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
66 |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
67 void GenerationSizer::initialize_size_info() { |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
68 trace_gen_sizes("ps heap raw"); |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
69 const size_t page_sz = os::page_size_for_region(_min_heap_byte_size, |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
70 _max_heap_byte_size, |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
71 8); |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
72 |
8f07aa079343
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? |
8f07aa079343
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"); |
8f07aa079343
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); |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
76 if (new_alignment != _gen_alignment) { |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
77 _gen_alignment = new_alignment; |
13069
ee527493b36d
8027960: Assertion assert(end >= start) failed during nightly testing on solaris
sjohanss
parents:
13060
diff
changeset
|
78 _space_alignment = new_alignment; |
13060
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
79 // Redo everything from the start |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
80 initialize_flags(); |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
81 } |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
82 TwoGenerationCollectorPolicy::initialize_size_info(); |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
83 |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
84 trace_gen_sizes("ps heap rnd"); |
8f07aa079343
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
diff
changeset
|
85 } |