Print this page
G1: Use SoftMaxHeapSize to guide GC heuristics
Split |
Close |
Expand all |
Collapse all |
--- old/src/hotspot/share/gc/g1/g1CollectorState.hpp
+++ new/src/hotspot/share/gc/g1/g1CollectorState.hpp
1 1 /*
2 2 * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 4 *
5 5 * This code is free software; you can redistribute it and/or modify it
6 6 * under the terms of the GNU General Public License version 2 only, as
7 7 * published by the Free Software Foundation.
8 8 *
9 9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 12 * version 2 for more details (a copy is included in the LICENSE file that
13 13 * accompanied this code).
14 14 *
15 15 * You should have received a copy of the GNU General Public License version
16 16 * 2 along with this work; if not, write to the Free Software Foundation,
17 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 18 *
19 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 20 * or visit www.oracle.com if you need additional information or have any
21 21 * questions.
22 22 *
23 23 */
24 24
25 25 #ifndef SHARE_GC_G1_G1COLLECTORSTATE_HPP
26 26 #define SHARE_GC_G1_G1COLLECTORSTATE_HPP
27 27
28 28 #include "gc/g1/g1YCTypes.hpp"
29 29 #include "utilities/globalDefinitions.hpp"
30 30
31 31 // State of the G1 collection.
32 32 class G1CollectorState {
33 33 // Indicates whether we are in the phase where we do partial gcs that only contain
34 34 // the young generation. Not set while _in_full_gc is set.
35 35 bool _in_young_only_phase;
36 36
37 37 // Indicates whether we are in the last young gc before the mixed gc phase. This GC
38 38 // is required to keep pause time requirements.
39 39 bool _in_young_gc_before_mixed;
40 40
41 41 // If _initiate_conc_mark_if_possible is set at the beginning of a
42 42 // pause, it is a suggestion that the pause should start a marking
43 43 // cycle by doing the initial-mark work. However, it is possible
44 44 // that the concurrent marking thread is still finishing up the
45 45 // previous marking cycle (e.g., clearing the next marking
46 46 // bitmap). If that is the case we cannot start a new cycle and
47 47 // we'll have to wait for the concurrent marking thread to finish
48 48 // what it is doing. In this case we will postpone the marking cycle
49 49 // initiation decision for the next pause. When we eventually decide
50 50 // to start a cycle, we will set _in_initial_mark_gc which
51 51 // will stay true until the end of the initial-mark pause doing the
52 52 // initial-mark work.
53 53 volatile bool _in_initial_mark_gc;
54 54
55 55 // At the end of a pause we check the heap occupancy and we decide
56 56 // whether we will start a marking cycle during the next pause. If
57 57 // we decide that we want to do that, set this parameter. This parameter will
58 58 // stay set until the beginning of a subsequent pause (not necessarily
59 59 // the next one) when we decide that we will indeed start a marking cycle and
60 60 // do the initial-mark work.
61 61 volatile bool _initiate_conc_mark_if_possible;
62 62
63 63 // Marking or rebuilding remembered set work is in progress. Set from the end
↓ open down ↓ |
63 lines elided |
↑ open up ↑ |
64 64 // of the initial mark pause to the end of the Cleanup pause.
65 65 bool _mark_or_rebuild_in_progress;
66 66
67 67 // The next bitmap is currently being cleared or about to be cleared. TAMS and bitmap
68 68 // may be out of sync.
69 69 bool _clearing_next_bitmap;
70 70
71 71 // Set during a full gc pause.
72 72 bool _in_full_gc;
73 73
74 + // Indicate finish of mixed gc(s)
75 + bool _finish_of_mixed_gc;
76 +
74 77 public:
75 78 G1CollectorState() :
76 79 _in_young_only_phase(true),
77 80 _in_young_gc_before_mixed(false),
78 81
79 82 _in_initial_mark_gc(false),
80 83 _initiate_conc_mark_if_possible(false),
81 84
82 85 _mark_or_rebuild_in_progress(false),
83 86 _clearing_next_bitmap(false),
84 - _in_full_gc(false) { }
87 + _in_full_gc(false),
88 + _finish_of_mixed_gc(false) { }
85 89
86 90 // Phase setters
87 91 void set_in_young_only_phase(bool v) { _in_young_only_phase = v; }
88 92
89 93 // Pause setters
90 94 void set_in_young_gc_before_mixed(bool v) { _in_young_gc_before_mixed = v; }
91 95 void set_in_initial_mark_gc(bool v) { _in_initial_mark_gc = v; }
92 96 void set_in_full_gc(bool v) { _in_full_gc = v; }
97 + void set_finish_of_mixed_gc(bool v) { _finish_of_mixed_gc = v; }
93 98
94 99 void set_initiate_conc_mark_if_possible(bool v) { _initiate_conc_mark_if_possible = v; }
95 100
96 101 void set_mark_or_rebuild_in_progress(bool v) { _mark_or_rebuild_in_progress = v; }
97 102 void set_clearing_next_bitmap(bool v) { _clearing_next_bitmap = v; }
98 103
99 104 // Phase getters
100 105 bool in_young_only_phase() const { return _in_young_only_phase && !_in_full_gc; }
101 106 bool in_mixed_phase() const { return !in_young_only_phase() && !_in_full_gc; }
102 107
103 108 // Specific pauses
104 109 bool in_young_gc_before_mixed() const { return _in_young_gc_before_mixed; }
105 110 bool in_full_gc() const { return _in_full_gc; }
106 111 bool in_initial_mark_gc() const { return _in_initial_mark_gc; }
107 112
108 113 bool initiate_conc_mark_if_possible() const { return _initiate_conc_mark_if_possible; }
109 114
110 115 bool mark_or_rebuild_in_progress() const { return _mark_or_rebuild_in_progress; }
111 116 bool clearing_next_bitmap() const { return _clearing_next_bitmap; }
117 + bool finish_of_mixed_gc() const { return _finish_of_mixed_gc; }
112 118
113 119 G1YCType yc_type() const {
114 120 if (in_initial_mark_gc()) {
115 121 return InitialMark;
116 122 } else if (mark_or_rebuild_in_progress()) {
117 123 return DuringMarkOrRebuild;
118 124 } else if (in_young_only_phase()) {
119 125 return Normal;
120 126 } else {
121 127 return Mixed;
122 128 }
123 129 }
124 130 };
125 131
126 132 #endif // SHARE_GC_G1_G1COLLECTORSTATE_HPP
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX