author | tschatzl |
Fri, 29 Nov 2019 10:20:17 +0100 | |
changeset 59321 | 5775e4825e58 |
parent 53244 | 9807daeb47c4 |
permissions | -rw-r--r-- |
26696
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
53116
diff
changeset
|
2 |
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. |
26696
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
4 |
* |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
8 |
* |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
13 |
* accompanied this code). |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
14 |
* |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
18 |
* |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
21 |
* questions. |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
22 |
* |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
23 |
*/ |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
24 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
53116
diff
changeset
|
25 |
#ifndef SHARE_GC_G1_HEAPREGIONTYPE_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
53116
diff
changeset
|
26 |
#define SHARE_GC_G1_HEAPREGIONTYPE_HPP |
26696
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
27 |
|
36098
e056a98ac7ca
8149650: Create a trace event for G1 heap region type transitions
david
parents:
33105
diff
changeset
|
28 |
#include "gc/g1/g1HeapRegionTraceType.hpp" |
26696
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
29 |
|
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
30 |
#define hrt_assert_is_valid(tag) \ |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32623
diff
changeset
|
31 |
assert(is_valid((tag)), "invalid HR type: %u", (uint) (tag)) |
26696
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
32 |
|
49392
2956d0ece7a9
8199282: Remove ValueObj class for allocation subclassing for gc code
coleenp
parents:
47602
diff
changeset
|
33 |
class HeapRegionType { |
47602
d4380ee1cbe9
8187403: [Unknown generation] is shown in Stack Memory on HSDB
ysuenaga
parents:
47216
diff
changeset
|
34 |
friend class VMStructs; |
d4380ee1cbe9
8187403: [Unknown generation] is shown in Stack Memory on HSDB
ysuenaga
parents:
47216
diff
changeset
|
35 |
|
26696
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
36 |
private: |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
37 |
// We encode the value of the heap region type so the generation can be |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
38 |
// determined quickly. The tag is split into two parts: |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
39 |
// |
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31346
diff
changeset
|
40 |
// major type (young, old, humongous, archive) : top N-1 bits |
26696
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
41 |
// minor type (eden / survivor, starts / cont hum, etc.) : bottom 1 bit |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
42 |
// |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
43 |
// If there's need to increase the number of minor types in the |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
44 |
// future, we'll have to increase the size of the latter and hence |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
45 |
// decrease the size of the former. |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
46 |
// |
46810
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
47 |
// 00000 0 [ 0] Free |
26696
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
48 |
// |
46810
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
49 |
// 00001 0 [ 2] Young Mask |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
50 |
// 00001 0 [ 2] Eden |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
51 |
// 00001 1 [ 3] Survivor |
26696
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
52 |
// |
46810
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
53 |
// 00010 0 [ 4] Humongous Mask |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
54 |
// 00100 0 [ 8] Pinned Mask |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
55 |
// 00110 0 [12] Starts Humongous |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
56 |
// 00110 1 [13] Continues Humongous |
26696
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
57 |
// |
46810
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
58 |
// 01000 0 [16] Old Mask |
31346
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
59 |
// |
46810
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
60 |
// 10000 0 [32] Archive Mask |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
61 |
// 11100 0 [56] Open Archive |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
62 |
// 11100 1 [57] Closed Archive |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
63 |
// |
26696
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
64 |
typedef enum { |
26846
7d4376f8560e
8058495: G1: normalize names for isHumongous() and friends
tonyp
parents:
26696
diff
changeset
|
65 |
FreeTag = 0, |
26696
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
66 |
|
26846
7d4376f8560e
8058495: G1: normalize names for isHumongous() and friends
tonyp
parents:
26696
diff
changeset
|
67 |
YoungMask = 2, |
7d4376f8560e
8058495: G1: normalize names for isHumongous() and friends
tonyp
parents:
26696
diff
changeset
|
68 |
EdenTag = YoungMask, |
7d4376f8560e
8058495: G1: normalize names for isHumongous() and friends
tonyp
parents:
26696
diff
changeset
|
69 |
SurvTag = YoungMask + 1, |
26696
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
70 |
|
26846
7d4376f8560e
8058495: G1: normalize names for isHumongous() and friends
tonyp
parents:
26696
diff
changeset
|
71 |
HumongousMask = 4, |
31346
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
72 |
PinnedMask = 8, |
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
73 |
StartsHumongousTag = HumongousMask | PinnedMask, |
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
74 |
ContinuesHumongousTag = HumongousMask | PinnedMask + 1, |
26696
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
75 |
|
31346
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
76 |
OldMask = 16, |
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
77 |
OldTag = OldMask, |
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
78 |
|
46810
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
79 |
// Archive regions are regions with immutable content (i.e. not reclaimed, and |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
80 |
// not allocated into during regular operation). They differ in the kind of references |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
81 |
// allowed for the contained objects: |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
82 |
// - Closed archive regions form a separate self-contained (closed) object graph |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
83 |
// within the set of all of these regions. No references outside of closed |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
84 |
// archive regions are allowed. |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
85 |
// - Open archive regions have no restrictions on the references of their objects. |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
86 |
// Objects within these regions are allowed to have references to objects |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
87 |
// contained in any other kind of regions. |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
88 |
ArchiveMask = 32, |
51494
1906adbef2dc
8208498: Put archive regions into a first-class HeapRegionSet
tschatzl
parents:
49392
diff
changeset
|
89 |
OpenArchiveTag = ArchiveMask | PinnedMask, |
1906adbef2dc
8208498: Put archive regions into a first-class HeapRegionSet
tschatzl
parents:
49392
diff
changeset
|
90 |
ClosedArchiveTag = ArchiveMask | PinnedMask + 1 |
26696
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
91 |
} Tag; |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
92 |
|
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
93 |
volatile Tag _tag; |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
94 |
|
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
95 |
static bool is_valid(Tag tag); |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
96 |
|
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
97 |
Tag get() const { |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
98 |
hrt_assert_is_valid(_tag); |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
99 |
return _tag; |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
100 |
} |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
101 |
|
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
102 |
// Sets the type to 'tag'. |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
103 |
void set(Tag tag) { |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
104 |
hrt_assert_is_valid(tag); |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
105 |
hrt_assert_is_valid(_tag); |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
106 |
_tag = tag; |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
107 |
} |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
108 |
|
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
109 |
// Sets the type to 'tag', expecting the type to be 'before'. This |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
110 |
// is available for when we want to add sanity checking to the type |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
111 |
// transition. |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
112 |
void set_from(Tag tag, Tag before) { |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
113 |
hrt_assert_is_valid(tag); |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
114 |
hrt_assert_is_valid(before); |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
115 |
hrt_assert_is_valid(_tag); |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32623
diff
changeset
|
116 |
assert(_tag == before, "HR tag: %u, expected: %u new tag; %u", _tag, before, tag); |
26696
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
117 |
_tag = tag; |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
118 |
} |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
119 |
|
53116
bb03098c4dde
8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents:
51494
diff
changeset
|
120 |
// Private constructor used static constants |
bb03098c4dde
8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents:
51494
diff
changeset
|
121 |
HeapRegionType(Tag t) : _tag(t) { hrt_assert_is_valid(_tag); } |
bb03098c4dde
8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents:
51494
diff
changeset
|
122 |
|
26696
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
123 |
public: |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
124 |
// Queries |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
125 |
|
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
126 |
bool is_free() const { return get() == FreeTag; } |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
127 |
|
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
128 |
bool is_young() const { return (get() & YoungMask) != 0; } |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
129 |
bool is_eden() const { return get() == EdenTag; } |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
130 |
bool is_survivor() const { return get() == SurvTag; } |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
131 |
|
26846
7d4376f8560e
8058495: G1: normalize names for isHumongous() and friends
tonyp
parents:
26696
diff
changeset
|
132 |
bool is_humongous() const { return (get() & HumongousMask) != 0; } |
7d4376f8560e
8058495: G1: normalize names for isHumongous() and friends
tonyp
parents:
26696
diff
changeset
|
133 |
bool is_starts_humongous() const { return get() == StartsHumongousTag; } |
7d4376f8560e
8058495: G1: normalize names for isHumongous() and friends
tonyp
parents:
26696
diff
changeset
|
134 |
bool is_continues_humongous() const { return get() == ContinuesHumongousTag; } |
26696
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
135 |
|
46810
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
136 |
bool is_archive() const { return (get() & ArchiveMask) != 0; } |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
137 |
bool is_open_archive() const { return get() == OpenArchiveTag; } |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
138 |
bool is_closed_archive() const { return get() == ClosedArchiveTag; } |
31346
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
139 |
|
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
140 |
// is_old regions may or may not also be pinned |
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
141 |
bool is_old() const { return (get() & OldMask) != 0; } |
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
142 |
|
42589
037b433e8069
8166811: Missing memory fences between memory allocation and refinement
kbarrett
parents:
36098
diff
changeset
|
143 |
bool is_old_or_humongous() const { return (get() & (OldMask | HumongousMask)) != 0; } |
037b433e8069
8166811: Missing memory fences between memory allocation and refinement
kbarrett
parents:
36098
diff
changeset
|
144 |
|
51494
1906adbef2dc
8208498: Put archive regions into a first-class HeapRegionSet
tschatzl
parents:
49392
diff
changeset
|
145 |
bool is_old_or_humongous_or_archive() const { return (get() & (OldMask | HumongousMask | ArchiveMask)) != 0; } |
1906adbef2dc
8208498: Put archive regions into a first-class HeapRegionSet
tschatzl
parents:
49392
diff
changeset
|
146 |
|
31346
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
147 |
// is_pinned regions may be archive or humongous |
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
148 |
bool is_pinned() const { return (get() & PinnedMask) != 0; } |
26696
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
149 |
|
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
150 |
// Setters |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
151 |
|
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
152 |
void set_free() { set(FreeTag); } |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
153 |
|
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
154 |
void set_eden() { set_from(EdenTag, FreeTag); } |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
155 |
void set_eden_pre_gc() { set_from(EdenTag, SurvTag); } |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
156 |
void set_survivor() { set_from(SurvTag, FreeTag); } |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
157 |
|
26846
7d4376f8560e
8058495: G1: normalize names for isHumongous() and friends
tonyp
parents:
26696
diff
changeset
|
158 |
void set_starts_humongous() { set_from(StartsHumongousTag, FreeTag); } |
7d4376f8560e
8058495: G1: normalize names for isHumongous() and friends
tonyp
parents:
26696
diff
changeset
|
159 |
void set_continues_humongous() { set_from(ContinuesHumongousTag, FreeTag); } |
26696
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
160 |
|
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
161 |
void set_old() { set(OldTag); } |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
162 |
|
46810
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
163 |
// Change the current region type to be of an old region type if not already done so. |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
164 |
// Returns whether the region type has been changed or not. |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
165 |
bool relabel_as_old() { |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
166 |
//assert(!is_free(), "Should not try to move Free region"); |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
167 |
assert(!is_humongous(), "Should not try to move Humongous region"); |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
168 |
if (is_old()) { |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
169 |
return false; |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
170 |
} |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
171 |
if (is_eden()) { |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
172 |
set_from(OldTag, EdenTag); |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
173 |
return true; |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
174 |
} else if (is_free()) { |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
175 |
set_from(OldTag, FreeTag); |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
176 |
return true; |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
177 |
} else { |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
178 |
set_from(OldTag, SurvTag); |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
179 |
return true; |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
180 |
} |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
181 |
} |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
182 |
void set_open_archive() { set_from(OpenArchiveTag, FreeTag); } |
7dad333205cd
8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents:
42589
diff
changeset
|
183 |
void set_closed_archive() { set_from(ClosedArchiveTag, FreeTag); } |
31346
a70d45c06136
8042668: GC Support for shared heap ranges in CDS
jiangli
parents:
30764
diff
changeset
|
184 |
|
26696
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
185 |
// Misc |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
186 |
|
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
187 |
const char* get_str() const; |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
188 |
const char* get_short_str() const; |
36098
e056a98ac7ca
8149650: Create a trace event for G1 heap region type transitions
david
parents:
33105
diff
changeset
|
189 |
G1HeapRegionTraceType::Type get_trace_type(); |
26696
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
190 |
|
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
191 |
HeapRegionType() : _tag(FreeTag) { hrt_assert_is_valid(_tag); } |
53116
bb03098c4dde
8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents:
51494
diff
changeset
|
192 |
|
bb03098c4dde
8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents:
51494
diff
changeset
|
193 |
static const HeapRegionType Eden; |
bb03098c4dde
8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents:
51494
diff
changeset
|
194 |
static const HeapRegionType Survivor; |
bb03098c4dde
8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents:
51494
diff
changeset
|
195 |
static const HeapRegionType Old; |
bb03098c4dde
8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents:
51494
diff
changeset
|
196 |
static const HeapRegionType Humongous; |
26696
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
197 |
}; |
623a25e6c686
8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff
changeset
|
198 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
53116
diff
changeset
|
199 |
#endif // SHARE_GC_G1_HEAPREGIONTYPE_HPP |