Mercurial > hg > graal-compiler
annotate src/share/vm/gc_implementation/g1/heapRegionType.hpp @ 20795:ae52ee069062
8062063: Usage of UseHugeTLBFS, UseLargePagesInMetaspace and huge SurvivorAlignmentInBytes cause crashes in CMBitMapClosure::do_bit
Summary: Making sure committed memory is cleared when re-committed, even if using large pages.
Reviewed-by: jwilhelm, tschatzl
author | sjohanss |
---|---|
date | Mon, 12 Jan 2015 15:24:29 +0100 |
parents | c02ec279b062 |
children |
rev | line source |
---|---|
20481
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
1 /* |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
4 * |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
8 * |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
13 * accompanied this code). |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
14 * |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
18 * |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
21 * questions. |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
22 * |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
23 */ |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
24 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONTYPE_HPP |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONTYPE_HPP |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
27 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
28 #include "memory/allocation.hpp" |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
29 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
30 #define hrt_assert_is_valid(tag) \ |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
31 assert(is_valid((tag)), err_msg("invalid HR type: %u", (uint) (tag))) |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
32 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
33 class HeapRegionType VALUE_OBJ_CLASS_SPEC { |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
34 private: |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
35 // We encode the value of the heap region type so the generation can be |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
36 // determined quickly. The tag is split into two parts: |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
37 // |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
38 // major type (young, humongous) : top N-1 bits |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
39 // minor type (eden / survivor, starts / cont hum, etc.) : bottom 1 bit |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
40 // |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
41 // If there's need to increase the number of minor types in the |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
42 // future, we'll have to increase the size of the latter and hence |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
43 // decrease the size of the former. |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
44 // |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
45 // 0000 0 [ 0] Free |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
46 // |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
47 // 0001 0 Young Mask |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
48 // 0001 0 [ 2] Eden |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
49 // 0001 1 [ 3] Survivor |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
50 // |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
51 // 0010 0 Humongous Mask |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
52 // 0010 0 [ 4] Humongous Starts |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
53 // 0010 1 [ 5] Humongous Continues |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
54 // |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
55 // 01000 [ 8] Old |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
56 typedef enum { |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
57 FreeTag = 0, |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
58 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
59 YoungMask = 2, |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
60 EdenTag = YoungMask, |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
61 SurvTag = YoungMask + 1, |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
62 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
63 HumMask = 4, |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
64 HumStartsTag = HumMask, |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
65 HumContTag = HumMask + 1, |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
66 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
67 OldTag = 8 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
68 } Tag; |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
69 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
70 volatile Tag _tag; |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
71 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
72 static bool is_valid(Tag tag); |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
73 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
74 Tag get() const { |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
75 hrt_assert_is_valid(_tag); |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
76 return _tag; |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
77 } |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
78 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
79 // Sets the type to 'tag'. |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
80 void set(Tag tag) { |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
81 hrt_assert_is_valid(tag); |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
82 hrt_assert_is_valid(_tag); |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
83 _tag = tag; |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
84 } |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
85 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
86 // Sets the type to 'tag', expecting the type to be 'before'. This |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
87 // is available for when we want to add sanity checking to the type |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
88 // transition. |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
89 void set_from(Tag tag, Tag before) { |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
90 hrt_assert_is_valid(tag); |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
91 hrt_assert_is_valid(before); |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
92 hrt_assert_is_valid(_tag); |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
93 assert(_tag == before, |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
94 err_msg("HR tag: %u, expected: %u new tag; %u", _tag, before, tag)); |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
95 _tag = tag; |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
96 } |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
97 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
98 public: |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
99 // Queries |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
100 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
101 bool is_free() const { return get() == FreeTag; } |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
102 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
103 bool is_young() const { return (get() & YoungMask) != 0; } |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
104 bool is_eden() const { return get() == EdenTag; } |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
105 bool is_survivor() const { return get() == SurvTag; } |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
106 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
107 bool is_humongous() const { return (get() & HumMask) != 0; } |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
108 bool is_starts_humongous() const { return get() == HumStartsTag; } |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
109 bool is_continues_humongous() const { return get() == HumContTag; } |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
110 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
111 bool is_old() const { return get() == OldTag; } |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
112 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
113 // Setters |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
114 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
115 void set_free() { set(FreeTag); } |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
116 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
117 void set_eden() { set_from(EdenTag, FreeTag); } |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
118 void set_eden_pre_gc() { set_from(EdenTag, SurvTag); } |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
119 void set_survivor() { set_from(SurvTag, FreeTag); } |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
120 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
121 void set_starts_humongous() { set_from(HumStartsTag, FreeTag); } |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
122 void set_continues_humongous() { set_from(HumContTag, FreeTag); } |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
123 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
124 void set_old() { set(OldTag); } |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
125 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
126 // Misc |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
127 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
128 const char* get_str() const; |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
129 const char* get_short_str() const; |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
130 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
131 HeapRegionType() : _tag(FreeTag) { hrt_assert_is_valid(_tag); } |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
132 }; |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
133 |
c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
brutisso
parents:
diff
changeset
|
134 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONTYPE_HPP |