author | sangheki |
Wed, 13 Nov 2019 10:51:41 -0800 | |
changeset 59062 | 6530de931b8e |
parent 54467 | 0c5d713cf43f |
permissions | -rw-r--r-- |
33203 | 1 |
/* |
54467
0c5d713cf43f
8218049: Survivor MemoryMXBean used() size granularity is region based
sangheki
parents:
47216
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 |
||
25 |
#include "precompiled.hpp" |
|
38186
ccaa890f8617
8155943: Move G1Eden/SurvivorRegions into their own source files
mgerdin
parents:
38183
diff
changeset
|
26 |
#include "gc/g1/g1SurvivorRegions.hpp" |
33203 | 27 |
#include "gc/g1/heapRegion.hpp" |
38162
4e2c3433a3ae
8150393: Maintain the set of survivor regions in an array between GCs
mgerdin
parents:
38109
diff
changeset
|
28 |
#include "utilities/growableArray.hpp" |
38183
cb68e4923223
8150721: Don't explicitly manage G1 young regions in YoungList
mgerdin
parents:
38162
diff
changeset
|
29 |
#include "utilities/debug.hpp" |
33203 | 30 |
|
54467
0c5d713cf43f
8218049: Survivor MemoryMXBean used() size granularity is region based
sangheki
parents:
47216
diff
changeset
|
31 |
G1SurvivorRegions::G1SurvivorRegions() : |
0c5d713cf43f
8218049: Survivor MemoryMXBean used() size granularity is region based
sangheki
parents:
47216
diff
changeset
|
32 |
_regions(new (ResourceObj::C_HEAP, mtGC) GrowableArray<HeapRegion*>(8, true, mtGC)), |
59062
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
54467
diff
changeset
|
33 |
_used_bytes(0), |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
54467
diff
changeset
|
34 |
_regions_on_node() {} |
33203 | 35 |
|
59062
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
54467
diff
changeset
|
36 |
uint G1SurvivorRegions::add(HeapRegion* hr) { |
38183
cb68e4923223
8150721: Don't explicitly manage G1 young regions in YoungList
mgerdin
parents:
38162
diff
changeset
|
37 |
assert(hr->is_survivor(), "should be flagged as survivor region"); |
cb68e4923223
8150721: Don't explicitly manage G1 young regions in YoungList
mgerdin
parents:
38162
diff
changeset
|
38 |
_regions->append(hr); |
59062
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
54467
diff
changeset
|
39 |
return _regions_on_node.add(hr); |
33203 | 40 |
} |
41 |
||
38183
cb68e4923223
8150721: Don't explicitly manage G1 young regions in YoungList
mgerdin
parents:
38162
diff
changeset
|
42 |
uint G1SurvivorRegions::length() const { |
cb68e4923223
8150721: Don't explicitly manage G1 young regions in YoungList
mgerdin
parents:
38162
diff
changeset
|
43 |
return (uint)_regions->length(); |
38162
4e2c3433a3ae
8150393: Maintain the set of survivor regions in an array between GCs
mgerdin
parents:
38109
diff
changeset
|
44 |
} |
4e2c3433a3ae
8150393: Maintain the set of survivor regions in an array between GCs
mgerdin
parents:
38109
diff
changeset
|
45 |
|
59062
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
54467
diff
changeset
|
46 |
uint G1SurvivorRegions::regions_on_node(uint node_index) const { |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
54467
diff
changeset
|
47 |
return _regions_on_node.count(node_index); |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
54467
diff
changeset
|
48 |
} |
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
54467
diff
changeset
|
49 |
|
38183
cb68e4923223
8150721: Don't explicitly manage G1 young regions in YoungList
mgerdin
parents:
38162
diff
changeset
|
50 |
void G1SurvivorRegions::convert_to_eden() { |
cb68e4923223
8150721: Don't explicitly manage G1 young regions in YoungList
mgerdin
parents:
38162
diff
changeset
|
51 |
for (GrowableArrayIterator<HeapRegion*> it = _regions->begin(); |
cb68e4923223
8150721: Don't explicitly manage G1 young regions in YoungList
mgerdin
parents:
38162
diff
changeset
|
52 |
it != _regions->end(); |
cb68e4923223
8150721: Don't explicitly manage G1 young regions in YoungList
mgerdin
parents:
38162
diff
changeset
|
53 |
++it) { |
cb68e4923223
8150721: Don't explicitly manage G1 young regions in YoungList
mgerdin
parents:
38162
diff
changeset
|
54 |
HeapRegion* hr = *it; |
cb68e4923223
8150721: Don't explicitly manage G1 young regions in YoungList
mgerdin
parents:
38162
diff
changeset
|
55 |
hr->set_eden_pre_gc(); |
33203 | 56 |
} |
38183
cb68e4923223
8150721: Don't explicitly manage G1 young regions in YoungList
mgerdin
parents:
38162
diff
changeset
|
57 |
clear(); |
33203 | 58 |
} |
59 |
||
38183
cb68e4923223
8150721: Don't explicitly manage G1 young regions in YoungList
mgerdin
parents:
38162
diff
changeset
|
60 |
void G1SurvivorRegions::clear() { |
cb68e4923223
8150721: Don't explicitly manage G1 young regions in YoungList
mgerdin
parents:
38162
diff
changeset
|
61 |
_regions->clear(); |
54467
0c5d713cf43f
8218049: Survivor MemoryMXBean used() size granularity is region based
sangheki
parents:
47216
diff
changeset
|
62 |
_used_bytes = 0; |
59062
6530de931b8e
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
54467
diff
changeset
|
63 |
_regions_on_node.clear(); |
33203 | 64 |
} |
65 |
||
54467
0c5d713cf43f
8218049: Survivor MemoryMXBean used() size granularity is region based
sangheki
parents:
47216
diff
changeset
|
66 |
void G1SurvivorRegions::add_used_bytes(size_t used_bytes) { |
0c5d713cf43f
8218049: Survivor MemoryMXBean used() size granularity is region based
sangheki
parents:
47216
diff
changeset
|
67 |
_used_bytes += used_bytes; |
0c5d713cf43f
8218049: Survivor MemoryMXBean used() size granularity is region based
sangheki
parents:
47216
diff
changeset
|
68 |
} |