author | sangheki |
Wed, 13 Nov 2019 10:49:32 -0800 | |
changeset 59061 | df6f2350edfa |
parent 54678 | 93f09ca4a7f8 |
permissions | -rw-r--r-- |
37041 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
53116
diff
changeset
|
2 |
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. |
37041 | 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 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
* |
|
23 |
*/ |
|
24 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
53116
diff
changeset
|
25 |
#ifndef SHARE_GC_G1_G1YOUNGGENSIZER_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
53116
diff
changeset
|
26 |
#define SHARE_GC_G1_G1YOUNGGENSIZER_HPP |
37985
539c597ee0fa
8154154: Separate G1 specific policy code from the CollectorPolicy class hierarchy
mgerdin
parents:
37041
diff
changeset
|
27 |
|
49392
2956d0ece7a9
8199282: Remove ValueObj class for allocation subclassing for gc code
coleenp
parents:
47216
diff
changeset
|
28 |
#include "utilities/globalDefinitions.hpp" |
37041 | 29 |
|
30 |
// There are three command line options related to the young gen size: |
|
31 |
// NewSize, MaxNewSize and NewRatio (There is also -Xmn, but that is |
|
32 |
// just a short form for NewSize==MaxNewSize). G1 will use its internal |
|
33 |
// heuristics to calculate the actual young gen size, so these options |
|
34 |
// basically only limit the range within which G1 can pick a young gen |
|
35 |
// size. Also, these are general options taking byte sizes. G1 will |
|
36 |
// internally work with a number of regions instead. So, some rounding |
|
37 |
// will occur. |
|
38 |
// |
|
39 |
// If nothing related to the the young gen size is set on the command |
|
40 |
// line we should allow the young gen to be between G1NewSizePercent |
|
41 |
// and G1MaxNewSizePercent of the heap size. This means that every time |
|
42 |
// the heap size changes, the limits for the young gen size will be |
|
43 |
// recalculated. |
|
44 |
// |
|
45 |
// If only -XX:NewSize is set we should use the specified value as the |
|
46 |
// minimum size for young gen. Still using G1MaxNewSizePercent of the |
|
47 |
// heap as maximum. |
|
48 |
// |
|
49 |
// If only -XX:MaxNewSize is set we should use the specified value as the |
|
50 |
// maximum size for young gen. Still using G1NewSizePercent of the heap |
|
51 |
// as minimum. |
|
52 |
// |
|
53 |
// If -XX:NewSize and -XX:MaxNewSize are both specified we use these values. |
|
54 |
// No updates when the heap size changes. There is a special case when |
|
55 |
// NewSize==MaxNewSize. This is interpreted as "fixed" and will use a |
|
56 |
// different heuristic for calculating the collection set when we do mixed |
|
57 |
// collection. |
|
58 |
// |
|
59 |
// If only -XX:NewRatio is set we should use the specified ratio of the heap |
|
60 |
// as both min and max. This will be interpreted as "fixed" just like the |
|
61 |
// NewSize==MaxNewSize case above. But we will update the min and max |
|
62 |
// every time the heap size changes. |
|
63 |
// |
|
64 |
// NewSize and MaxNewSize override NewRatio. So, NewRatio is ignored if it is |
|
65 |
// combined with either NewSize or MaxNewSize. (A warning message is printed.) |
|
53116
bb03098c4dde
8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents:
49392
diff
changeset
|
66 |
class G1YoungGenSizer : public CHeapObj<mtGC> { |
37041 | 67 |
private: |
68 |
enum SizerKind { |
|
69 |
SizerDefaults, |
|
70 |
SizerNewSizeOnly, |
|
71 |
SizerMaxNewSizeOnly, |
|
72 |
SizerMaxAndNewSize, |
|
73 |
SizerNewRatio |
|
74 |
}; |
|
75 |
SizerKind _sizer_kind; |
|
38652
ba8be1a71dec
8156028: G1YoungGenSizer _adaptive_size not correct when setting NewSize and MaxNewSize to the same value
sjohanss
parents:
37985
diff
changeset
|
76 |
|
ba8be1a71dec
8156028: G1YoungGenSizer _adaptive_size not correct when setting NewSize and MaxNewSize to the same value
sjohanss
parents:
37985
diff
changeset
|
77 |
// False when using a fixed young generation size due to command-line options, |
ba8be1a71dec
8156028: G1YoungGenSizer _adaptive_size not correct when setting NewSize and MaxNewSize to the same value
sjohanss
parents:
37985
diff
changeset
|
78 |
// true otherwise. |
54466
58751415d5f8
8222105: Add "use_" prefix to G1Policy::adaptive_young_list_length
tschatzl
parents:
53244
diff
changeset
|
79 |
bool _use_adaptive_sizing; |
38652
ba8be1a71dec
8156028: G1YoungGenSizer _adaptive_size not correct when setting NewSize and MaxNewSize to the same value
sjohanss
parents:
37985
diff
changeset
|
80 |
|
37041 | 81 |
uint calculate_default_min_length(uint new_number_of_heap_regions); |
82 |
uint calculate_default_max_length(uint new_number_of_heap_regions); |
|
83 |
||
84 |
// Update the given values for minimum and maximum young gen length in regions |
|
85 |
// given the number of heap regions depending on the kind of sizing algorithm. |
|
86 |
void recalculate_min_max_young_length(uint number_of_heap_regions, uint* min_young_length, uint* max_young_length); |
|
87 |
||
53116
bb03098c4dde
8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents:
49392
diff
changeset
|
88 |
protected: |
bb03098c4dde
8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents:
49392
diff
changeset
|
89 |
uint _min_desired_young_length; |
bb03098c4dde
8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents:
49392
diff
changeset
|
90 |
uint _max_desired_young_length; |
bb03098c4dde
8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents:
49392
diff
changeset
|
91 |
|
37041 | 92 |
public: |
93 |
G1YoungGenSizer(); |
|
94 |
// Calculate the maximum length of the young gen given the number of regions |
|
95 |
// depending on the sizing algorithm. |
|
53116
bb03098c4dde
8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents:
49392
diff
changeset
|
96 |
virtual void adjust_max_new_size(uint number_of_heap_regions); |
37041 | 97 |
|
53116
bb03098c4dde
8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents:
49392
diff
changeset
|
98 |
virtual void heap_size_changed(uint new_number_of_heap_regions); |
37985
539c597ee0fa
8154154: Separate G1 specific policy code from the CollectorPolicy class hierarchy
mgerdin
parents:
37041
diff
changeset
|
99 |
uint min_desired_young_length() const { |
37041 | 100 |
return _min_desired_young_length; |
101 |
} |
|
37985
539c597ee0fa
8154154: Separate G1 specific policy code from the CollectorPolicy class hierarchy
mgerdin
parents:
37041
diff
changeset
|
102 |
uint max_desired_young_length() const { |
37041 | 103 |
return _max_desired_young_length; |
104 |
} |
|
105 |
||
54466
58751415d5f8
8222105: Add "use_" prefix to G1Policy::adaptive_young_list_length
tschatzl
parents:
53244
diff
changeset
|
106 |
bool use_adaptive_young_list_length() const { |
58751415d5f8
8222105: Add "use_" prefix to G1Policy::adaptive_young_list_length
tschatzl
parents:
53244
diff
changeset
|
107 |
return _use_adaptive_sizing; |
37041 | 108 |
} |
53116
bb03098c4dde
8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents:
49392
diff
changeset
|
109 |
|
54678
93f09ca4a7f8
8198505: Remove CollectorPolicy and its subclasses
stefank
parents:
54466
diff
changeset
|
110 |
static G1YoungGenSizer* create_gen_sizer(); |
37041 | 111 |
}; |
112 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
53116
diff
changeset
|
113 |
#endif // SHARE_GC_G1_G1YOUNGGENSIZER_HPP |