author | sangheki |
Wed, 13 Nov 2019 10:51:41 -0800 | |
changeset 59062 | 6530de931b8e |
parent 54467 | 0c5d713cf43f |
permissions | -rw-r--r-- |
33203 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
49392
diff
changeset
|
2 |
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. |
33203 | 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:
49392
diff
changeset
|
25 |
#ifndef SHARE_GC_G1_G1EDENREGIONS_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
49392
diff
changeset
|
26 |
#define SHARE_GC_G1_G1EDENREGIONS_HPP |
33203 | 27 |
|
59062
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
54467
diff
changeset
|
28 |
#include "gc/g1/g1RegionsOnNodes.hpp" |
38186
ccaa890f8617
8155943: Move G1Eden/SurvivorRegions into their own source files
mgerdin
parents:
38183
diff
changeset
|
29 |
#include "gc/g1/heapRegion.hpp" |
33203 | 30 |
#include "runtime/globals.hpp" |
38186
ccaa890f8617
8155943: Move G1Eden/SurvivorRegions into their own source files
mgerdin
parents:
38183
diff
changeset
|
31 |
#include "utilities/debug.hpp" |
38183
cb68e4923223
8150721: Don't explicitly manage G1 young regions in YoungList
mgerdin
parents:
38162
diff
changeset
|
32 |
|
49392
2956d0ece7a9
8199282: Remove ValueObj class for allocation subclassing for gc code
coleenp
parents:
47216
diff
changeset
|
33 |
class G1EdenRegions { |
38183
cb68e4923223
8150721: Don't explicitly manage G1 young regions in YoungList
mgerdin
parents:
38162
diff
changeset
|
34 |
private: |
54467
0c5d713cf43f
8218049: Survivor MemoryMXBean used() size granularity is region based
sangheki
parents:
53244
diff
changeset
|
35 |
int _length; |
0c5d713cf43f
8218049: Survivor MemoryMXBean used() size granularity is region based
sangheki
parents:
53244
diff
changeset
|
36 |
// Sum of used bytes from all retired eden regions. |
0c5d713cf43f
8218049: Survivor MemoryMXBean used() size granularity is region based
sangheki
parents:
53244
diff
changeset
|
37 |
// I.e. updated when mutator regions are retired. |
0c5d713cf43f
8218049: Survivor MemoryMXBean used() size granularity is region based
sangheki
parents:
53244
diff
changeset
|
38 |
volatile size_t _used_bytes; |
59062
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
54467
diff
changeset
|
39 |
G1RegionsOnNodes _regions_on_node; |
33203 | 40 |
|
38183
cb68e4923223
8150721: Don't explicitly manage G1 young regions in YoungList
mgerdin
parents:
38162
diff
changeset
|
41 |
public: |
59062
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
54467
diff
changeset
|
42 |
G1EdenRegions() : _length(0), _used_bytes(0), _regions_on_node() { } |
33203 | 43 |
|
59062
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
54467
diff
changeset
|
44 |
virtual uint add(HeapRegion* hr) { |
38186
ccaa890f8617
8155943: Move G1Eden/SurvivorRegions into their own source files
mgerdin
parents:
38183
diff
changeset
|
45 |
assert(!hr->is_eden(), "should not already be set"); |
ccaa890f8617
8155943: Move G1Eden/SurvivorRegions into their own source files
mgerdin
parents:
38183
diff
changeset
|
46 |
_length++; |
59062
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
54467
diff
changeset
|
47 |
return _regions_on_node.add(hr); |
38186
ccaa890f8617
8155943: Move G1Eden/SurvivorRegions into their own source files
mgerdin
parents:
38183
diff
changeset
|
48 |
} |
33203 | 49 |
|
59062
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
54467
diff
changeset
|
50 |
void clear() { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
54467
diff
changeset
|
51 |
_length = 0; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
54467
diff
changeset
|
52 |
_used_bytes = 0; |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
54467
diff
changeset
|
53 |
_regions_on_node.clear(); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
54467
diff
changeset
|
54 |
} |
33203 | 55 |
|
38183
cb68e4923223
8150721: Don't explicitly manage G1 young regions in YoungList
mgerdin
parents:
38162
diff
changeset
|
56 |
uint length() const { return _length; } |
59062
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
54467
diff
changeset
|
57 |
uint regions_on_node(uint node_index) const { return _regions_on_node.count(node_index); } |
54467
0c5d713cf43f
8218049: Survivor MemoryMXBean used() size granularity is region based
sangheki
parents:
53244
diff
changeset
|
58 |
|
0c5d713cf43f
8218049: Survivor MemoryMXBean used() size granularity is region based
sangheki
parents:
53244
diff
changeset
|
59 |
size_t used_bytes() const { return _used_bytes; } |
0c5d713cf43f
8218049: Survivor MemoryMXBean used() size granularity is region based
sangheki
parents:
53244
diff
changeset
|
60 |
|
0c5d713cf43f
8218049: Survivor MemoryMXBean used() size granularity is region based
sangheki
parents:
53244
diff
changeset
|
61 |
void add_used_bytes(size_t used_bytes) { |
0c5d713cf43f
8218049: Survivor MemoryMXBean used() size granularity is region based
sangheki
parents:
53244
diff
changeset
|
62 |
_used_bytes += used_bytes; |
0c5d713cf43f
8218049: Survivor MemoryMXBean used() size granularity is region based
sangheki
parents:
53244
diff
changeset
|
63 |
} |
33203 | 64 |
}; |
65 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
49392
diff
changeset
|
66 |
#endif // SHARE_GC_G1_G1EDENREGIONS_HPP |