author | mgerdin |
Wed, 27 Apr 2016 16:11:45 +0200 | |
changeset 38162 | 4e2c3433a3ae |
parent 36365 | bcc9c9afda49 |
child 38183 | cb68e4923223 |
permissions | -rw-r--r-- |
33203 | 1 |
/* |
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
|
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 |
#ifndef SHARE_VM_GC_G1_YOUNGLIST_HPP |
|
26 |
#define SHARE_VM_GC_G1_YOUNGLIST_HPP |
|
27 |
||
28 |
#include "memory/allocation.hpp" |
|
29 |
#include "runtime/globals.hpp" |
|
30 |
||
38162
4e2c3433a3ae
8150393: Maintain the set of survivor regions in an array between GCs
mgerdin
parents:
36365
diff
changeset
|
31 |
template <typename T> |
4e2c3433a3ae
8150393: Maintain the set of survivor regions in an array between GCs
mgerdin
parents:
36365
diff
changeset
|
32 |
class GrowableArray; |
4e2c3433a3ae
8150393: Maintain the set of survivor regions in an array between GCs
mgerdin
parents:
36365
diff
changeset
|
33 |
|
33203 | 34 |
class YoungList : public CHeapObj<mtGC> { |
35 |
private: |
|
36 |
G1CollectedHeap* _g1h; |
|
38162
4e2c3433a3ae
8150393: Maintain the set of survivor regions in an array between GCs
mgerdin
parents:
36365
diff
changeset
|
37 |
GrowableArray<HeapRegion*>* _survivor_regions; |
33203 | 38 |
|
39 |
HeapRegion* _head; |
|
40 |
||
41 |
uint _length; |
|
42 |
||
43 |
void empty_list(HeapRegion* list); |
|
44 |
||
45 |
public: |
|
46 |
YoungList(G1CollectedHeap* g1h); |
|
47 |
||
48 |
void push_region(HeapRegion* hr); |
|
49 |
void add_survivor_region(HeapRegion* hr); |
|
50 |
||
51 |
void empty_list(); |
|
52 |
bool is_empty() { return _length == 0; } |
|
53 |
uint length() { return _length; } |
|
54 |
uint eden_length() { return length() - survivor_length(); } |
|
38162
4e2c3433a3ae
8150393: Maintain the set of survivor regions in an array between GCs
mgerdin
parents:
36365
diff
changeset
|
55 |
uint survivor_length(); |
4e2c3433a3ae
8150393: Maintain the set of survivor regions in an array between GCs
mgerdin
parents:
36365
diff
changeset
|
56 |
|
4e2c3433a3ae
8150393: Maintain the set of survivor regions in an array between GCs
mgerdin
parents:
36365
diff
changeset
|
57 |
const GrowableArray<HeapRegion*>* survivor_regions() const { return _survivor_regions; } |
33203 | 58 |
|
59 |
// Currently we do not keep track of the used byte sum for the |
|
60 |
// young list and the survivors and it'd be quite a lot of work to |
|
61 |
// do so. When we'll eventually replace the young list with |
|
62 |
// instances of HeapRegionLinkedList we'll get that for free. So, |
|
63 |
// we'll report the more accurate information then. |
|
64 |
size_t eden_used_bytes() { |
|
65 |
assert(length() >= survivor_length(), "invariant"); |
|
66 |
return (size_t) eden_length() * HeapRegion::GrainBytes; |
|
67 |
} |
|
68 |
size_t survivor_used_bytes() { |
|
69 |
return (size_t) survivor_length() * HeapRegion::GrainBytes; |
|
70 |
} |
|
71 |
||
72 |
// for development purposes |
|
73 |
void reset_auxilary_lists(); |
|
74 |
void clear() { _head = NULL; _length = 0; } |
|
75 |
||
76 |
void clear_survivors() { |
|
38162
4e2c3433a3ae
8150393: Maintain the set of survivor regions in an array between GCs
mgerdin
parents:
36365
diff
changeset
|
77 |
_survivor_regions->clear(); |
33203 | 78 |
} |
79 |
||
80 |
HeapRegion* first_region() { return _head; } |
|
81 |
||
82 |
// debugging |
|
83 |
bool check_list_well_formed(); |
|
36365
bcc9c9afda49
8150390: Move rs length sampling data to the sampling thread
mgerdin
parents:
33203
diff
changeset
|
84 |
bool check_list_empty(); |
33203 | 85 |
void print(); |
86 |
}; |
|
87 |
||
88 |
#endif // SHARE_VM_GC_G1_YOUNGLIST_HPP |