author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 38012 | hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp@69916710bfed |
child 53116 | bb03098c4dde |
permissions | -rw-r--r-- |
1374 | 1 |
/* |
35927
58bbbbb4a8c7
8148944: CollectorPolicy methods for memory allocations are specific to GenCollectorPolicy
mgerdin
parents:
35909
diff
changeset
|
2 |
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. |
1374 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
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 |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5350
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5350
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5350
diff
changeset
|
21 |
* questions. |
1374 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
37134
9dd3975ca940
8151711: Move G1 number sequences out of the G1 collector policy
mgerdin
parents:
37080
diff
changeset
|
26 |
#include "gc/g1/g1Analytics.hpp" |
30764 | 27 |
#include "gc/g1/g1CollectorPolicy.hpp" |
37041 | 28 |
#include "gc/g1/g1YoungGenSizer.hpp" |
37985
539c597ee0fa
8154154: Separate G1 specific policy code from the CollectorPolicy class hierarchy
mgerdin
parents:
37262
diff
changeset
|
29 |
#include "gc/g1/heapRegion.hpp" |
30764 | 30 |
#include "gc/g1/heapRegionRemSet.hpp" |
31 |
#include "gc/shared/gcPolicyCounters.hpp" |
|
37985
539c597ee0fa
8154154: Separate G1 specific policy code from the CollectorPolicy class hierarchy
mgerdin
parents:
37262
diff
changeset
|
32 |
#include "runtime/globals.hpp" |
7397 | 33 |
#include "utilities/debug.hpp" |
1374 | 34 |
|
37985
539c597ee0fa
8154154: Separate G1 specific policy code from the CollectorPolicy class hierarchy
mgerdin
parents:
37262
diff
changeset
|
35 |
G1CollectorPolicy::G1CollectorPolicy() { |
28483
76dc30e48a6e
8068739: G1CollectoryPolicy uses uninitialized field '_sigma' in the constructor
tschatzl
parents:
28213
diff
changeset
|
36 |
|
3697
ea9211aa02f5
6819085: G1: use larger and/or user settable region size
tonyp
parents:
3691
diff
changeset
|
37 |
// Set up the region size and associated fields. Given that the |
ea9211aa02f5
6819085: G1: use larger and/or user settable region size
tonyp
parents:
3691
diff
changeset
|
38 |
// policy is created before the heap, we have to set this up here, |
ea9211aa02f5
6819085: G1: use larger and/or user settable region size
tonyp
parents:
3691
diff
changeset
|
39 |
// so it's done as soon as possible. |
19728
9e1556506d2d
8019902: G1: Use the average heap size rather than the minimum heap size to calculate the region size
brutisso
parents:
19546
diff
changeset
|
40 |
|
9e1556506d2d
8019902: G1: Use the average heap size rather than the minimum heap size to calculate the region size
brutisso
parents:
19546
diff
changeset
|
41 |
// It would have been natural to pass initial_heap_byte_size() and |
9e1556506d2d
8019902: G1: Use the average heap size rather than the minimum heap size to calculate the region size
brutisso
parents:
19546
diff
changeset
|
42 |
// max_heap_byte_size() to setup_heap_region_size() but those have |
9e1556506d2d
8019902: G1: Use the average heap size rather than the minimum heap size to calculate the region size
brutisso
parents:
19546
diff
changeset
|
43 |
// not been set up at this point since they should be aligned with |
9e1556506d2d
8019902: G1: Use the average heap size rather than the minimum heap size to calculate the region size
brutisso
parents:
19546
diff
changeset
|
44 |
// the region size. So, there is a circular dependency here. We base |
9e1556506d2d
8019902: G1: Use the average heap size rather than the minimum heap size to calculate the region size
brutisso
parents:
19546
diff
changeset
|
45 |
// the region size on the heap size, but the heap size should be |
9e1556506d2d
8019902: G1: Use the average heap size rather than the minimum heap size to calculate the region size
brutisso
parents:
19546
diff
changeset
|
46 |
// aligned with the region size. To get around this we use the |
9e1556506d2d
8019902: G1: Use the average heap size rather than the minimum heap size to calculate the region size
brutisso
parents:
19546
diff
changeset
|
47 |
// unaligned values for the heap. |
9e1556506d2d
8019902: G1: Use the average heap size rather than the minimum heap size to calculate the region size
brutisso
parents:
19546
diff
changeset
|
48 |
HeapRegion::setup_heap_region_size(InitialHeapSize, MaxHeapSize); |
4902
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
4481
diff
changeset
|
49 |
HeapRegionRemSet::setup_remset_size(); |
34298
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
34134
diff
changeset
|
50 |
} |
f3c9dcc5af96
8136681: Factor out IHOP calculation from G1CollectorPolicy
tschatzl
parents:
34134
diff
changeset
|
51 |
|
21561
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
21558
diff
changeset
|
52 |
void G1CollectorPolicy::initialize_alignments() { |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
21558
diff
changeset
|
53 |
_space_alignment = HeapRegion::GrainBytes; |
33212 | 54 |
size_t card_table_alignment = CardTableRS::ct_max_alignment_constraint(); |
21561
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
21558
diff
changeset
|
55 |
size_t page_size = UseLargePages ? os::large_page_size() : os::vm_page_size(); |
c619b1cb4554
8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking
jwilhelm
parents:
21558
diff
changeset
|
56 |
_heap_alignment = MAX3(card_table_alignment, _space_alignment, page_size); |
1374 | 57 |
} |