author | sangheki |
Wed, 13 Nov 2019 10:49:12 -0800 | |
changeset 59060 | fce1fa1bdc91 |
parent 53244 | 9807daeb47c4 |
child 59062 | 6530de931b8e |
permissions | -rw-r--r-- |
7923 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
53116
diff
changeset
|
2 |
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. |
7923 | 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_HEAPREGIONSET_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
53116
diff
changeset
|
26 |
#define SHARE_GC_G1_HEAPREGIONSET_HPP |
7923 | 27 |
|
30764 | 28 |
#include "gc/g1/heapRegion.hpp" |
49725
e740e1a38c96
8200550: Xcode 9.3 produce warning -Wexpansion-to-defined
kbarrett
parents:
49632
diff
changeset
|
29 |
#include "utilities/macros.hpp" |
7923 | 30 |
|
35065
b4ff0249c092
8144996: Replace the HeapRegionSetCount class with an uint
david
parents:
35061
diff
changeset
|
31 |
#define assert_heap_region_set(p, message) \ |
b4ff0249c092
8144996: Replace the HeapRegionSetCount class with an uint
david
parents:
35061
diff
changeset
|
32 |
do { \ |
b4ff0249c092
8144996: Replace the HeapRegionSetCount class with an uint
david
parents:
35061
diff
changeset
|
33 |
assert((p), "[%s] %s ln: %u", \ |
b4ff0249c092
8144996: Replace the HeapRegionSetCount class with an uint
david
parents:
35061
diff
changeset
|
34 |
name(), message, length()); \ |
33753
3add06d0880f
8137756: Remove hrs_err_msg and hrs_ext_msg from heapRegionSet
david
parents:
30764
diff
changeset
|
35 |
} while (0) |
3add06d0880f
8137756: Remove hrs_err_msg and hrs_ext_msg from heapRegionSet
david
parents:
30764
diff
changeset
|
36 |
|
35065
b4ff0249c092
8144996: Replace the HeapRegionSetCount class with an uint
david
parents:
35061
diff
changeset
|
37 |
#define guarantee_heap_region_set(p, message) \ |
b4ff0249c092
8144996: Replace the HeapRegionSetCount class with an uint
david
parents:
35061
diff
changeset
|
38 |
do { \ |
b4ff0249c092
8144996: Replace the HeapRegionSetCount class with an uint
david
parents:
35061
diff
changeset
|
39 |
guarantee((p), "[%s] %s ln: %u", \ |
b4ff0249c092
8144996: Replace the HeapRegionSetCount class with an uint
david
parents:
35061
diff
changeset
|
40 |
name(), message, length()); \ |
33753
3add06d0880f
8137756: Remove hrs_err_msg and hrs_ext_msg from heapRegionSet
david
parents:
30764
diff
changeset
|
41 |
} while (0) |
3add06d0880f
8137756: Remove hrs_err_msg and hrs_ext_msg from heapRegionSet
david
parents:
30764
diff
changeset
|
42 |
|
35065
b4ff0249c092
8144996: Replace the HeapRegionSetCount class with an uint
david
parents:
35061
diff
changeset
|
43 |
#define assert_free_region_list(p, message) \ |
b4ff0249c092
8144996: Replace the HeapRegionSetCount class with an uint
david
parents:
35061
diff
changeset
|
44 |
do { \ |
b4ff0249c092
8144996: Replace the HeapRegionSetCount class with an uint
david
parents:
35061
diff
changeset
|
45 |
assert((p), "[%s] %s ln: %u hd: " PTR_FORMAT " tl: " PTR_FORMAT, \ |
b4ff0249c092
8144996: Replace the HeapRegionSetCount class with an uint
david
parents:
35061
diff
changeset
|
46 |
name(), message, length(), p2i(_head), p2i(_tail)); \ |
33753
3add06d0880f
8137756: Remove hrs_err_msg and hrs_ext_msg from heapRegionSet
david
parents:
30764
diff
changeset
|
47 |
} while (0) |
3add06d0880f
8137756: Remove hrs_err_msg and hrs_ext_msg from heapRegionSet
david
parents:
30764
diff
changeset
|
48 |
|
7923 | 49 |
|
51496
bf6b66fa8bdf
8209700: Remove HeapRegionSetBase::RegionSetKind for a more flexible approach
tschatzl
parents:
51494
diff
changeset
|
50 |
// Interface collecting various instance specific verification methods of |
bf6b66fa8bdf
8209700: Remove HeapRegionSetBase::RegionSetKind for a more flexible approach
tschatzl
parents:
51494
diff
changeset
|
51 |
// HeapRegionSets. |
bf6b66fa8bdf
8209700: Remove HeapRegionSetBase::RegionSetKind for a more flexible approach
tschatzl
parents:
51494
diff
changeset
|
52 |
class HeapRegionSetChecker : public CHeapObj<mtGC> { |
23450
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
53 |
public: |
51496
bf6b66fa8bdf
8209700: Remove HeapRegionSetBase::RegionSetKind for a more flexible approach
tschatzl
parents:
51494
diff
changeset
|
54 |
// Verify MT safety for this HeapRegionSet. |
bf6b66fa8bdf
8209700: Remove HeapRegionSetBase::RegionSetKind for a more flexible approach
tschatzl
parents:
51494
diff
changeset
|
55 |
virtual void check_mt_safety() = 0; |
bf6b66fa8bdf
8209700: Remove HeapRegionSetBase::RegionSetKind for a more flexible approach
tschatzl
parents:
51494
diff
changeset
|
56 |
// Returns true if the given HeapRegion is of the correct type for this HeapRegionSet. |
bf6b66fa8bdf
8209700: Remove HeapRegionSetBase::RegionSetKind for a more flexible approach
tschatzl
parents:
51494
diff
changeset
|
57 |
virtual bool is_correct_type(HeapRegion* hr) = 0; |
bf6b66fa8bdf
8209700: Remove HeapRegionSetBase::RegionSetKind for a more flexible approach
tschatzl
parents:
51494
diff
changeset
|
58 |
// Return a description of the type of regions this HeapRegionSet contains. |
bf6b66fa8bdf
8209700: Remove HeapRegionSetBase::RegionSetKind for a more flexible approach
tschatzl
parents:
51494
diff
changeset
|
59 |
virtual const char* get_description() = 0; |
23450
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
60 |
}; |
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
61 |
|
7923 | 62 |
// Base class for all the classes that represent heap region sets. It |
63 |
// contains the basic attributes that each set needs to maintain |
|
64 |
// (e.g., length, region num, used bytes sum) plus any shared |
|
65 |
// functionality (e.g., verification). |
|
66 |
||
49392
2956d0ece7a9
8199282: Remove ValueObj class for allocation subclassing for gc code
coleenp
parents:
47216
diff
changeset
|
67 |
class HeapRegionSetBase { |
11577
0af7e6e062a7
7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
10996
diff
changeset
|
68 |
friend class VMStructs; |
51494
1906adbef2dc
8208498: Put archive regions into a first-class HeapRegionSet
tschatzl
parents:
51332
diff
changeset
|
69 |
|
51496
bf6b66fa8bdf
8209700: Remove HeapRegionSetBase::RegionSetKind for a more flexible approach
tschatzl
parents:
51494
diff
changeset
|
70 |
HeapRegionSetChecker* _checker; |
7923 | 71 |
|
72 |
protected: |
|
35065
b4ff0249c092
8144996: Replace the HeapRegionSetCount class with an uint
david
parents:
35061
diff
changeset
|
73 |
// The number of regions in to the set. |
b4ff0249c092
8144996: Replace the HeapRegionSetCount class with an uint
david
parents:
35061
diff
changeset
|
74 |
uint _length; |
7923 | 75 |
|
76 |
const char* _name; |
|
77 |
||
23450
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
78 |
bool _verify_in_progress; |
10996 | 79 |
|
7923 | 80 |
// verify_region() is used to ensure that the contents of a region |
23450
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
81 |
// added to / removed from a set are consistent. |
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
82 |
void verify_region(HeapRegion* hr) PRODUCT_RETURN; |
7923 | 83 |
|
23450
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
84 |
void check_mt_safety() { |
51496
bf6b66fa8bdf
8209700: Remove HeapRegionSetBase::RegionSetKind for a more flexible approach
tschatzl
parents:
51494
diff
changeset
|
85 |
if (_checker != NULL) { |
bf6b66fa8bdf
8209700: Remove HeapRegionSetBase::RegionSetKind for a more flexible approach
tschatzl
parents:
51494
diff
changeset
|
86 |
_checker->check_mt_safety(); |
23450
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
87 |
} |
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
88 |
} |
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
89 |
|
51496
bf6b66fa8bdf
8209700: Remove HeapRegionSetBase::RegionSetKind for a more flexible approach
tschatzl
parents:
51494
diff
changeset
|
90 |
HeapRegionSetBase(const char* name, HeapRegionSetChecker* verifier); |
23450
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
91 |
|
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
92 |
public: |
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
93 |
const char* name() { return _name; } |
7923 | 94 |
|
35065
b4ff0249c092
8144996: Replace the HeapRegionSetCount class with an uint
david
parents:
35061
diff
changeset
|
95 |
uint length() const { return _length; } |
23450
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
96 |
|
35065
b4ff0249c092
8144996: Replace the HeapRegionSetCount class with an uint
david
parents:
35061
diff
changeset
|
97 |
bool is_empty() { return _length == 0; } |
23450
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
98 |
|
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
99 |
// It updates the fields of the set to reflect hr being added to |
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
100 |
// the set and tags the region appropriately. |
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
101 |
inline void add(HeapRegion* hr); |
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
102 |
|
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
103 |
// It updates the fields of the set to reflect hr being removed |
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
104 |
// from the set and tags the region appropriately. |
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
105 |
inline void remove(HeapRegion* hr); |
7923 | 106 |
|
107 |
virtual void verify(); |
|
108 |
void verify_start(); |
|
109 |
void verify_next_region(HeapRegion* hr); |
|
110 |
void verify_end(); |
|
111 |
||
49725
e740e1a38c96
8200550: Xcode 9.3 produce warning -Wexpansion-to-defined
kbarrett
parents:
49632
diff
changeset
|
112 |
void verify_optional() { DEBUG_ONLY(verify();) } |
7923 | 113 |
|
114 |
virtual void print_on(outputStream* out, bool print_contents = false); |
|
115 |
}; |
|
116 |
||
117 |
// This class represents heap region sets whose members are not |
|
118 |
// explicitly tracked. It's helpful to group regions using such sets |
|
119 |
// so that we can reason about all the region groups in the heap using |
|
120 |
// the same interface (namely, the HeapRegionSetBase API). |
|
121 |
||
122 |
class HeapRegionSet : public HeapRegionSetBase { |
|
123 |
public: |
|
51496
bf6b66fa8bdf
8209700: Remove HeapRegionSetBase::RegionSetKind for a more flexible approach
tschatzl
parents:
51494
diff
changeset
|
124 |
HeapRegionSet(const char* name, HeapRegionSetChecker* checker): |
bf6b66fa8bdf
8209700: Remove HeapRegionSetBase::RegionSetKind for a more flexible approach
tschatzl
parents:
51494
diff
changeset
|
125 |
HeapRegionSetBase(name, checker) { |
51494
1906adbef2dc
8208498: Put archive regions into a first-class HeapRegionSet
tschatzl
parents:
51332
diff
changeset
|
126 |
} |
7923 | 127 |
|
35065
b4ff0249c092
8144996: Replace the HeapRegionSetCount class with an uint
david
parents:
35061
diff
changeset
|
128 |
void bulk_remove(const uint removed) { |
b4ff0249c092
8144996: Replace the HeapRegionSetCount class with an uint
david
parents:
35061
diff
changeset
|
129 |
_length -= removed; |
23450
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
130 |
} |
7923 | 131 |
}; |
132 |
||
23471
ec9427262f0a
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
23450
diff
changeset
|
133 |
// A set that links all the regions added to it in a doubly-linked |
26157
70eddb655686
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
25730
diff
changeset
|
134 |
// sorted list. We should try to avoid doing operations that iterate over |
7923 | 135 |
// such lists in performance critical paths. Typically we should |
26157
70eddb655686
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
25730
diff
changeset
|
136 |
// add / remove one region at a time or concatenate two lists. |
7923 | 137 |
|
23450
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
138 |
class FreeRegionListIterator; |
7923 | 139 |
|
23450
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
140 |
class FreeRegionList : public HeapRegionSetBase { |
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
141 |
friend class FreeRegionListIterator; |
7923 | 142 |
|
143 |
private: |
|
144 |
HeapRegion* _head; |
|
145 |
HeapRegion* _tail; |
|
146 |
||
23471
ec9427262f0a
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
23450
diff
changeset
|
147 |
// _last is used to keep track of where we added an element the last |
26157
70eddb655686
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
25730
diff
changeset
|
148 |
// time. It helps to improve performance when adding several ordered items in a row. |
23471
ec9427262f0a
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
23450
diff
changeset
|
149 |
HeapRegion* _last; |
ec9427262f0a
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
23450
diff
changeset
|
150 |
|
23450
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
151 |
static uint _unrealistically_long_length; |
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
152 |
|
26157
70eddb655686
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
25730
diff
changeset
|
153 |
inline HeapRegion* remove_from_head_impl(); |
70eddb655686
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
25730
diff
changeset
|
154 |
inline HeapRegion* remove_from_tail_impl(); |
7923 | 155 |
|
156 |
protected: |
|
157 |
// See the comment for HeapRegionSetBase::clear() |
|
158 |
virtual void clear(); |
|
159 |
||
23450
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
160 |
public: |
51496
bf6b66fa8bdf
8209700: Remove HeapRegionSetBase::RegionSetKind for a more flexible approach
tschatzl
parents:
51494
diff
changeset
|
161 |
FreeRegionList(const char* name, HeapRegionSetChecker* checker = NULL): |
bf6b66fa8bdf
8209700: Remove HeapRegionSetBase::RegionSetKind for a more flexible approach
tschatzl
parents:
51494
diff
changeset
|
162 |
HeapRegionSetBase(name, checker) { |
7923 | 163 |
clear(); |
164 |
} |
|
165 |
||
23450
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
166 |
void verify_list(); |
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
167 |
|
26157
70eddb655686
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
25730
diff
changeset
|
168 |
#ifdef ASSERT |
70eddb655686
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
25730
diff
changeset
|
169 |
bool contains(HeapRegion* hr) const { |
70eddb655686
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
25730
diff
changeset
|
170 |
return hr->containing_set() == this; |
70eddb655686
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
25730
diff
changeset
|
171 |
} |
70eddb655686
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
25730
diff
changeset
|
172 |
#endif |
23450
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
173 |
|
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
174 |
static void set_unrealistically_long_length(uint len); |
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
175 |
|
23471
ec9427262f0a
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
23450
diff
changeset
|
176 |
// Add hr to the list. The region should not be a member of another set. |
ec9427262f0a
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
23450
diff
changeset
|
177 |
// Assumes that the list is ordered and will preserve that order. The order |
26316
93f6b40c038b
8054819: Rename HeapRegionSeq to HeapRegionManager
tschatzl
parents:
26157
diff
changeset
|
178 |
// is determined by hrm_index. |
23471
ec9427262f0a
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
23450
diff
changeset
|
179 |
inline void add_ordered(HeapRegion* hr); |
ec9427262f0a
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
23450
diff
changeset
|
180 |
|
ec9427262f0a
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
23450
diff
changeset
|
181 |
// Removes from head or tail based on the given argument. |
26157
70eddb655686
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
25730
diff
changeset
|
182 |
HeapRegion* remove_region(bool from_head); |
23471
ec9427262f0a
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
23450
diff
changeset
|
183 |
|
59060
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
53244
diff
changeset
|
184 |
HeapRegion* remove_region_with_node_index(bool from_head, |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
53244
diff
changeset
|
185 |
const uint requested_node_index, |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
53244
diff
changeset
|
186 |
uint* region_node_index); |
fce1fa1bdc91
8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
53244
diff
changeset
|
187 |
|
23471
ec9427262f0a
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
23450
diff
changeset
|
188 |
// Merge two ordered lists. The result is also ordered. The order is |
26316
93f6b40c038b
8054819: Rename HeapRegionSeq to HeapRegionManager
tschatzl
parents:
26157
diff
changeset
|
189 |
// determined by hrm_index. |
23471
ec9427262f0a
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
23450
diff
changeset
|
190 |
void add_ordered(FreeRegionList* from_list); |
ec9427262f0a
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
23450
diff
changeset
|
191 |
|
7923 | 192 |
// It empties the list by removing all regions from it. |
193 |
void remove_all(); |
|
194 |
||
26157
70eddb655686
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
25730
diff
changeset
|
195 |
// Remove all (contiguous) regions from first to first + num_regions -1 from |
70eddb655686
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
25730
diff
changeset
|
196 |
// this list. |
70eddb655686
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
25730
diff
changeset
|
197 |
// Num_regions must be > 1. |
70eddb655686
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
25730
diff
changeset
|
198 |
void remove_starting_at(HeapRegion* first, uint num_regions); |
7923 | 199 |
|
200 |
virtual void verify(); |
|
53116
bb03098c4dde
8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents:
51496
diff
changeset
|
201 |
|
bb03098c4dde
8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents:
51496
diff
changeset
|
202 |
uint num_of_regions_in_range(uint start, uint end) const; |
7923 | 203 |
}; |
204 |
||
8680 | 205 |
// Iterator class that provides a convenient way to iterate over the |
26157
70eddb655686
8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents:
25730
diff
changeset
|
206 |
// regions of a FreeRegionList. |
7923 | 207 |
|
23450
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
208 |
class FreeRegionListIterator : public StackObj { |
7923 | 209 |
private: |
23450
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
210 |
FreeRegionList* _list; |
23471
ec9427262f0a
8036025: Sort the freelist in order to shrink the heap
jwilhelm
parents:
23450
diff
changeset
|
211 |
HeapRegion* _curr; |
7923 | 212 |
|
213 |
public: |
|
214 |
bool more_available() { |
|
215 |
return _curr != NULL; |
|
216 |
} |
|
217 |
||
218 |
HeapRegion* get_next() { |
|
219 |
assert(more_available(), |
|
220 |
"get_next() should be called when more regions are available"); |
|
221 |
||
222 |
// If we are going to introduce a count in the iterator we should |
|
223 |
// do the "cycle" check. |
|
224 |
||
225 |
HeapRegion* hr = _curr; |
|
23450
c7c6202fc7e2
8034079: G1: Refactor the HeapRegionSet hierarchy
brutisso
parents:
13336
diff
changeset
|
226 |
_list->verify_region(hr); |
7923 | 227 |
_curr = hr->next(); |
228 |
return hr; |
|
229 |
} |
|
230 |
||
51332 | 231 |
FreeRegionListIterator(FreeRegionList* list) |
232 |
: _list(list), |
|
233 |
_curr(list->_head) { |
|
7923 | 234 |
} |
235 |
}; |
|
236 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
53116
diff
changeset
|
237 |
#endif // SHARE_GC_G1_HEAPREGIONSET_HPP |