author | jmasa |
Sun, 19 Oct 2014 20:23:12 -0700 | |
changeset 29870 | ea8305ce32fa |
parent 29580 | a67a581cfe11 |
child 30158 | bd6094906ef8 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
28372
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
2 |
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "oops/markOop.hpp" |
|
27 |
#include "oops/oop.inline.hpp" |
|
28 |
#include "runtime/virtualspace.hpp" |
|
13195 | 29 |
#include "services/memTracker.hpp" |
1 | 30 |
|
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
22876
diff
changeset
|
31 |
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC |
1 | 32 |
|
33 |
// ReservedSpace |
|
19546
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
34 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
35 |
// Dummy constructor |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
36 |
ReservedSpace::ReservedSpace() : _base(NULL), _size(0), _noaccess_prefix(0), |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
37 |
_alignment(0), _special(false), _executable(false) { |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
38 |
} |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
39 |
|
1 | 40 |
ReservedSpace::ReservedSpace(size_t size) { |
28631 | 41 |
// Want to use large pages where possible and pad with small pages. |
42 |
size_t page_size = os::page_size_for_region_unaligned(size, 1); |
|
19546
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
43 |
bool large_pages = page_size != (size_t)os::vm_page_size(); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
44 |
// Don't force the alignment to be large page aligned, |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
45 |
// since that will waste memory. |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
46 |
size_t alignment = os::vm_allocation_granularity(); |
28372
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
47 |
initialize(size, alignment, large_pages, NULL, false); |
1 | 48 |
} |
49 |
||
50 |
ReservedSpace::ReservedSpace(size_t size, size_t alignment, |
|
823
9a5271881bc0
6716785: implicit null checks not triggering with CompressedOops
coleenp
parents:
1
diff
changeset
|
51 |
bool large, |
28372
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
52 |
char* requested_address) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
53 |
initialize(size, alignment, large, requested_address, false); |
2268 | 54 |
} |
55 |
||
56 |
ReservedSpace::ReservedSpace(size_t size, size_t alignment, |
|
57 |
bool large, |
|
58 |
bool executable) { |
|
28372
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
59 |
initialize(size, alignment, large, NULL, executable); |
1 | 60 |
} |
61 |
||
5898 | 62 |
// Helper method. |
63 |
static bool failed_to_reserve_as_requested(char* base, char* requested_address, |
|
64 |
const size_t size, bool special) |
|
65 |
{ |
|
66 |
if (base == requested_address || requested_address == NULL) |
|
67 |
return false; // did not fail |
|
68 |
||
69 |
if (base != NULL) { |
|
70 |
// Different reserve address may be acceptable in other cases |
|
71 |
// but for compressed oops heap should be at requested address. |
|
72 |
assert(UseCompressedOops, "currently requested address used only for compressed oops"); |
|
73 |
if (PrintCompressedOopsMode) { |
|
74 |
tty->cr(); |
|
10237
df347ffafa0d
7069863: G1: SIGSEGV running SPECjbb2011 and -UseBiasedLocking
johnc
parents:
7397
diff
changeset
|
75 |
tty->print_cr("Reserved memory not at requested address: " PTR_FORMAT " vs " PTR_FORMAT, base, requested_address); |
5898 | 76 |
} |
77 |
// OS ignored requested address. Try different address. |
|
78 |
if (special) { |
|
79 |
if (!os::release_memory_special(base, size)) { |
|
80 |
fatal("os::release_memory_special failed"); |
|
81 |
} |
|
82 |
} else { |
|
83 |
if (!os::release_memory(base, size)) { |
|
84 |
fatal("os::release_memory failed"); |
|
85 |
} |
|
86 |
} |
|
87 |
} |
|
88 |
return true; |
|
89 |
} |
|
90 |
||
1 | 91 |
void ReservedSpace::initialize(size_t size, size_t alignment, bool large, |
823
9a5271881bc0
6716785: implicit null checks not triggering with CompressedOops
coleenp
parents:
1
diff
changeset
|
92 |
char* requested_address, |
2268 | 93 |
bool executable) { |
1 | 94 |
const size_t granularity = os::vm_allocation_granularity(); |
10237
df347ffafa0d
7069863: G1: SIGSEGV running SPECjbb2011 and -UseBiasedLocking
johnc
parents:
7397
diff
changeset
|
95 |
assert((size & (granularity - 1)) == 0, |
1 | 96 |
"size not aligned to os::vm_allocation_granularity()"); |
10237
df347ffafa0d
7069863: G1: SIGSEGV running SPECjbb2011 and -UseBiasedLocking
johnc
parents:
7397
diff
changeset
|
97 |
assert((alignment & (granularity - 1)) == 0, |
1 | 98 |
"alignment not aligned to os::vm_allocation_granularity()"); |
99 |
assert(alignment == 0 || is_power_of_2((intptr_t)alignment), |
|
100 |
"not a power of 2"); |
|
101 |
||
10237
df347ffafa0d
7069863: G1: SIGSEGV running SPECjbb2011 and -UseBiasedLocking
johnc
parents:
7397
diff
changeset
|
102 |
alignment = MAX2(alignment, (size_t)os::vm_page_size()); |
df347ffafa0d
7069863: G1: SIGSEGV running SPECjbb2011 and -UseBiasedLocking
johnc
parents:
7397
diff
changeset
|
103 |
|
1 | 104 |
_base = NULL; |
105 |
_size = 0; |
|
106 |
_special = false; |
|
2268 | 107 |
_executable = executable; |
1 | 108 |
_alignment = 0; |
823
9a5271881bc0
6716785: implicit null checks not triggering with CompressedOops
coleenp
parents:
1
diff
changeset
|
109 |
_noaccess_prefix = 0; |
1 | 110 |
if (size == 0) { |
111 |
return; |
|
112 |
} |
|
113 |
||
114 |
// If OS doesn't support demand paging for large page memory, we need |
|
115 |
// to use reserve_memory_special() to reserve and pin the entire region. |
|
116 |
bool special = large && !os::can_commit_large_page_memory(); |
|
117 |
char* base = NULL; |
|
118 |
||
119 |
if (special) { |
|
120 |
||
19546
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
121 |
base = os::reserve_memory_special(size, alignment, requested_address, executable); |
1 | 122 |
|
123 |
if (base != NULL) { |
|
5898 | 124 |
if (failed_to_reserve_as_requested(base, requested_address, size, true)) { |
125 |
// OS ignored requested address. Try different address. |
|
126 |
return; |
|
127 |
} |
|
19546
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
128 |
// Check alignment constraints. |
10237
df347ffafa0d
7069863: G1: SIGSEGV running SPECjbb2011 and -UseBiasedLocking
johnc
parents:
7397
diff
changeset
|
129 |
assert((uintptr_t) base % alignment == 0, |
19546
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
130 |
err_msg("Large pages returned a non-aligned address, base: " |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
131 |
PTR_FORMAT " alignment: " PTR_FORMAT, |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
132 |
base, (void*)(uintptr_t)alignment)); |
1 | 133 |
_special = true; |
134 |
} else { |
|
135 |
// failed; try to reserve regular memory below |
|
5898 | 136 |
if (UseLargePages && (!FLAG_IS_DEFAULT(UseLargePages) || |
137 |
!FLAG_IS_DEFAULT(LargePageSizeInBytes))) { |
|
138 |
if (PrintCompressedOopsMode) { |
|
139 |
tty->cr(); |
|
140 |
tty->print_cr("Reserve regular memory without large pages."); |
|
141 |
} |
|
142 |
} |
|
1 | 143 |
} |
144 |
} |
|
145 |
||
146 |
if (base == NULL) { |
|
147 |
// Optimistically assume that the OSes returns an aligned base pointer. |
|
148 |
// When reserving a large address range, most OSes seem to align to at |
|
149 |
// least 64K. |
|
150 |
||
151 |
// If the memory was requested at a particular address, use |
|
152 |
// os::attempt_reserve_memory_at() to avoid over mapping something |
|
153 |
// important. If available space is not detected, return NULL. |
|
154 |
||
155 |
if (requested_address != 0) { |
|
5898 | 156 |
base = os::attempt_reserve_memory_at(size, requested_address); |
157 |
if (failed_to_reserve_as_requested(base, requested_address, size, false)) { |
|
158 |
// OS ignored requested address. Try different address. |
|
159 |
base = NULL; |
|
160 |
} |
|
1 | 161 |
} else { |
162 |
base = os::reserve_memory(size, NULL, alignment); |
|
163 |
} |
|
164 |
||
165 |
if (base == NULL) return; |
|
166 |
||
167 |
// Check alignment constraints |
|
28372
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
168 |
if ((((size_t)base) & (alignment - 1)) != 0) { |
1 | 169 |
// Base not aligned, retry |
170 |
if (!os::release_memory(base, size)) fatal("os::release_memory failed"); |
|
14840
8994c2377547
7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents:
13728
diff
changeset
|
171 |
// Make sure that size is aligned |
1 | 172 |
size = align_size_up(size, alignment); |
14840
8994c2377547
7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents:
13728
diff
changeset
|
173 |
base = os::reserve_memory_aligned(size, alignment); |
10237
df347ffafa0d
7069863: G1: SIGSEGV running SPECjbb2011 and -UseBiasedLocking
johnc
parents:
7397
diff
changeset
|
174 |
|
df347ffafa0d
7069863: G1: SIGSEGV running SPECjbb2011 and -UseBiasedLocking
johnc
parents:
7397
diff
changeset
|
175 |
if (requested_address != 0 && |
df347ffafa0d
7069863: G1: SIGSEGV running SPECjbb2011 and -UseBiasedLocking
johnc
parents:
7397
diff
changeset
|
176 |
failed_to_reserve_as_requested(base, requested_address, size, false)) { |
df347ffafa0d
7069863: G1: SIGSEGV running SPECjbb2011 and -UseBiasedLocking
johnc
parents:
7397
diff
changeset
|
177 |
// As a result of the alignment constraints, the allocated base differs |
df347ffafa0d
7069863: G1: SIGSEGV running SPECjbb2011 and -UseBiasedLocking
johnc
parents:
7397
diff
changeset
|
178 |
// from the requested address. Return back to the caller who can |
df347ffafa0d
7069863: G1: SIGSEGV running SPECjbb2011 and -UseBiasedLocking
johnc
parents:
7397
diff
changeset
|
179 |
// take remedial action (like try again without a requested address). |
df347ffafa0d
7069863: G1: SIGSEGV running SPECjbb2011 and -UseBiasedLocking
johnc
parents:
7397
diff
changeset
|
180 |
assert(_base == NULL, "should be"); |
df347ffafa0d
7069863: G1: SIGSEGV running SPECjbb2011 and -UseBiasedLocking
johnc
parents:
7397
diff
changeset
|
181 |
return; |
df347ffafa0d
7069863: G1: SIGSEGV running SPECjbb2011 and -UseBiasedLocking
johnc
parents:
7397
diff
changeset
|
182 |
} |
1 | 183 |
} |
184 |
} |
|
185 |
// Done |
|
186 |
_base = base; |
|
187 |
_size = size; |
|
10237
df347ffafa0d
7069863: G1: SIGSEGV running SPECjbb2011 and -UseBiasedLocking
johnc
parents:
7397
diff
changeset
|
188 |
_alignment = alignment; |
1 | 189 |
} |
190 |
||
191 |
||
192 |
ReservedSpace::ReservedSpace(char* base, size_t size, size_t alignment, |
|
2268 | 193 |
bool special, bool executable) { |
1 | 194 |
assert((size % os::vm_allocation_granularity()) == 0, |
195 |
"size not allocation aligned"); |
|
196 |
_base = base; |
|
197 |
_size = size; |
|
198 |
_alignment = alignment; |
|
823
9a5271881bc0
6716785: implicit null checks not triggering with CompressedOops
coleenp
parents:
1
diff
changeset
|
199 |
_noaccess_prefix = 0; |
1 | 200 |
_special = special; |
2268 | 201 |
_executable = executable; |
1 | 202 |
} |
203 |
||
204 |
||
205 |
ReservedSpace ReservedSpace::first_part(size_t partition_size, size_t alignment, |
|
206 |
bool split, bool realloc) { |
|
207 |
assert(partition_size <= size(), "partition failed"); |
|
208 |
if (split) { |
|
2268 | 209 |
os::split_reserved_memory(base(), size(), partition_size, realloc); |
1 | 210 |
} |
2268 | 211 |
ReservedSpace result(base(), partition_size, alignment, special(), |
212 |
executable()); |
|
1 | 213 |
return result; |
214 |
} |
|
215 |
||
216 |
||
217 |
ReservedSpace |
|
218 |
ReservedSpace::last_part(size_t partition_size, size_t alignment) { |
|
219 |
assert(partition_size <= size(), "partition failed"); |
|
220 |
ReservedSpace result(base() + partition_size, size() - partition_size, |
|
2268 | 221 |
alignment, special(), executable()); |
1 | 222 |
return result; |
223 |
} |
|
224 |
||
225 |
||
226 |
size_t ReservedSpace::page_align_size_up(size_t size) { |
|
227 |
return align_size_up(size, os::vm_page_size()); |
|
228 |
} |
|
229 |
||
230 |
||
231 |
size_t ReservedSpace::page_align_size_down(size_t size) { |
|
232 |
return align_size_down(size, os::vm_page_size()); |
|
233 |
} |
|
234 |
||
235 |
||
236 |
size_t ReservedSpace::allocation_align_size_up(size_t size) { |
|
237 |
return align_size_up(size, os::vm_allocation_granularity()); |
|
238 |
} |
|
239 |
||
240 |
||
241 |
size_t ReservedSpace::allocation_align_size_down(size_t size) { |
|
242 |
return align_size_down(size, os::vm_allocation_granularity()); |
|
243 |
} |
|
244 |
||
245 |
||
246 |
void ReservedSpace::release() { |
|
247 |
if (is_reserved()) { |
|
823
9a5271881bc0
6716785: implicit null checks not triggering with CompressedOops
coleenp
parents:
1
diff
changeset
|
248 |
char *real_base = _base - _noaccess_prefix; |
9a5271881bc0
6716785: implicit null checks not triggering with CompressedOops
coleenp
parents:
1
diff
changeset
|
249 |
const size_t real_size = _size + _noaccess_prefix; |
1 | 250 |
if (special()) { |
823
9a5271881bc0
6716785: implicit null checks not triggering with CompressedOops
coleenp
parents:
1
diff
changeset
|
251 |
os::release_memory_special(real_base, real_size); |
1 | 252 |
} else{ |
823
9a5271881bc0
6716785: implicit null checks not triggering with CompressedOops
coleenp
parents:
1
diff
changeset
|
253 |
os::release_memory(real_base, real_size); |
1 | 254 |
} |
255 |
_base = NULL; |
|
256 |
_size = 0; |
|
823
9a5271881bc0
6716785: implicit null checks not triggering with CompressedOops
coleenp
parents:
1
diff
changeset
|
257 |
_noaccess_prefix = 0; |
28372
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
258 |
_alignment = 0; |
1 | 259 |
_special = false; |
2268 | 260 |
_executable = false; |
1 | 261 |
} |
262 |
} |
|
263 |
||
28372
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
264 |
static size_t noaccess_prefix_size(size_t alignment) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
265 |
return lcm(os::vm_page_size(), alignment); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
266 |
} |
5898 | 267 |
|
28372
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
268 |
void ReservedHeapSpace::establish_noaccess_prefix() { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
269 |
assert(_alignment >= (size_t)os::vm_page_size(), "must be at least page size big"); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
270 |
_noaccess_prefix = noaccess_prefix_size(_alignment); |
823
9a5271881bc0
6716785: implicit null checks not triggering with CompressedOops
coleenp
parents:
1
diff
changeset
|
271 |
|
28372
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
272 |
if (base() && base() + _size > (char *)OopEncodingHeapMax) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
273 |
if (true |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
274 |
WIN64_ONLY(&& !UseLargePages) |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
275 |
AIX_ONLY(&& os::vm_page_size() != SIZE_64K)) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
276 |
// Protect memory at the base of the allocated region. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
277 |
// If special, the page was committed (only matters on windows) |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
278 |
if (!os::protect_memory(_base, _noaccess_prefix, os::MEM_PROT_NONE, _special)) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
279 |
fatal("cannot protect protection page"); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
280 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
281 |
if (PrintCompressedOopsMode) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
282 |
tty->cr(); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
283 |
tty->print_cr("Protected page at the reserved heap base: " |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
284 |
PTR_FORMAT " / " INTX_FORMAT " bytes", _base, _noaccess_prefix); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
285 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
286 |
assert(Universe::narrow_oop_use_implicit_null_checks() == true, "not initialized?"); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
287 |
} else { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
288 |
Universe::set_narrow_oop_use_implicit_null_checks(false); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
289 |
} |
5898 | 290 |
} |
823
9a5271881bc0
6716785: implicit null checks not triggering with CompressedOops
coleenp
parents:
1
diff
changeset
|
291 |
|
9a5271881bc0
6716785: implicit null checks not triggering with CompressedOops
coleenp
parents:
1
diff
changeset
|
292 |
_base += _noaccess_prefix; |
9a5271881bc0
6716785: implicit null checks not triggering with CompressedOops
coleenp
parents:
1
diff
changeset
|
293 |
_size -= _noaccess_prefix; |
28372
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
294 |
assert(((uintptr_t)_base % _alignment == 0), "must be exactly of required alignment"); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
295 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
296 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
297 |
// Tries to allocate memory of size 'size' at address requested_address with alignment 'alignment'. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
298 |
// Does not check whether the reserved memory actually is at requested_address, as the memory returned |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
299 |
// might still fulfill the wishes of the caller. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
300 |
// Assures the memory is aligned to 'alignment'. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
301 |
// NOTE: If ReservedHeapSpace already points to some reserved memory this is freed, first. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
302 |
void ReservedHeapSpace::try_reserve_heap(size_t size, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
303 |
size_t alignment, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
304 |
bool large, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
305 |
char* requested_address) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
306 |
if (_base != NULL) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
307 |
// We tried before, but we didn't like the address delivered. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
308 |
release(); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
309 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
310 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
311 |
// If OS doesn't support demand paging for large page memory, we need |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
312 |
// to use reserve_memory_special() to reserve and pin the entire region. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
313 |
bool special = large && !os::can_commit_large_page_memory(); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
314 |
char* base = NULL; |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
315 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
316 |
if (PrintCompressedOopsMode && Verbose) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
317 |
tty->print("Trying to allocate at address " PTR_FORMAT " heap of size " PTR_FORMAT ".\n", |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
318 |
requested_address, (address)size); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
319 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
320 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
321 |
if (special) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
322 |
base = os::reserve_memory_special(size, alignment, requested_address, false); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
323 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
324 |
if (base != NULL) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
325 |
// Check alignment constraints. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
326 |
assert((uintptr_t) base % alignment == 0, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
327 |
err_msg("Large pages returned a non-aligned address, base: " |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
328 |
PTR_FORMAT " alignment: " PTR_FORMAT, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
329 |
base, (void*)(uintptr_t)alignment)); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
330 |
_special = true; |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
331 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
332 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
333 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
334 |
if (base == NULL) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
335 |
// Failed; try to reserve regular memory below |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
336 |
if (UseLargePages && (!FLAG_IS_DEFAULT(UseLargePages) || |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
337 |
!FLAG_IS_DEFAULT(LargePageSizeInBytes))) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
338 |
if (PrintCompressedOopsMode) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
339 |
tty->cr(); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
340 |
tty->print_cr("Reserve regular memory without large pages."); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
341 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
342 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
343 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
344 |
// Optimistically assume that the OSes returns an aligned base pointer. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
345 |
// When reserving a large address range, most OSes seem to align to at |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
346 |
// least 64K. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
347 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
348 |
// If the memory was requested at a particular address, use |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
349 |
// os::attempt_reserve_memory_at() to avoid over mapping something |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
350 |
// important. If available space is not detected, return NULL. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
351 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
352 |
if (requested_address != 0) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
353 |
base = os::attempt_reserve_memory_at(size, requested_address); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
354 |
} else { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
355 |
base = os::reserve_memory(size, NULL, alignment); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
356 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
357 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
358 |
if (base == NULL) { return; } |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
359 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
360 |
// Done |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
361 |
_base = base; |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
362 |
_size = size; |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
363 |
_alignment = alignment; |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
364 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
365 |
// Check alignment constraints |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
366 |
if ((((size_t)base) & (alignment - 1)) != 0) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
367 |
// Base not aligned, retry. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
368 |
release(); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
369 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
370 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
371 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
372 |
void ReservedHeapSpace::try_reserve_range(char *highest_start, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
373 |
char *lowest_start, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
374 |
size_t attach_point_alignment, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
375 |
char *aligned_heap_base_min_address, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
376 |
char *upper_bound, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
377 |
size_t size, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
378 |
size_t alignment, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
379 |
bool large) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
380 |
const size_t attach_range = highest_start - lowest_start; |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
381 |
// Cap num_attempts at possible number. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
382 |
// At least one is possible even for 0 sized attach range. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
383 |
const uint64_t num_attempts_possible = (attach_range / attach_point_alignment) + 1; |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
384 |
const uint64_t num_attempts_to_try = MIN2((uint64_t)HeapSearchSteps, num_attempts_possible); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
385 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
386 |
const size_t stepsize = (attach_range == 0) ? // Only one try. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
387 |
(size_t) highest_start : align_size_up(attach_range / num_attempts_to_try, attach_point_alignment); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
388 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
389 |
// Try attach points from top to bottom. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
390 |
char* attach_point = highest_start; |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
391 |
while (attach_point >= lowest_start && |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
392 |
attach_point <= highest_start && // Avoid wrap around. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
393 |
((_base == NULL) || |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
394 |
(_base < aligned_heap_base_min_address || _base + size > upper_bound))) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
395 |
try_reserve_heap(size, alignment, large, attach_point); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
396 |
attach_point -= stepsize; |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
397 |
} |
823
9a5271881bc0
6716785: implicit null checks not triggering with CompressedOops
coleenp
parents:
1
diff
changeset
|
398 |
} |
9a5271881bc0
6716785: implicit null checks not triggering with CompressedOops
coleenp
parents:
1
diff
changeset
|
399 |
|
28372
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
400 |
#define SIZE_64K ((uint64_t) UCONST64( 0x10000)) |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
401 |
#define SIZE_256M ((uint64_t) UCONST64( 0x10000000)) |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
402 |
#define SIZE_32G ((uint64_t) UCONST64( 0x800000000)) |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
403 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
404 |
// Helper for heap allocation. Returns an array with addresses |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
405 |
// (OS-specific) which are suited for disjoint base mode. Array is |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
406 |
// NULL terminated. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
407 |
static char** get_attach_addresses_for_disjoint_mode() { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
408 |
static uint64_t addresses[] = { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
409 |
2 * SIZE_32G, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
410 |
3 * SIZE_32G, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
411 |
4 * SIZE_32G, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
412 |
8 * SIZE_32G, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
413 |
10 * SIZE_32G, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
414 |
1 * SIZE_64K * SIZE_32G, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
415 |
2 * SIZE_64K * SIZE_32G, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
416 |
3 * SIZE_64K * SIZE_32G, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
417 |
4 * SIZE_64K * SIZE_32G, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
418 |
16 * SIZE_64K * SIZE_32G, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
419 |
32 * SIZE_64K * SIZE_32G, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
420 |
34 * SIZE_64K * SIZE_32G, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
421 |
0 |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
422 |
}; |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
423 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
424 |
// Sort out addresses smaller than HeapBaseMinAddress. This assumes |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
425 |
// the array is sorted. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
426 |
uint i = 0; |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
427 |
while (addresses[i] != 0 && |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
428 |
(addresses[i] < OopEncodingHeapMax || addresses[i] < HeapBaseMinAddress)) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
429 |
i++; |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
430 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
431 |
uint start = i; |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
432 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
433 |
// Avoid more steps than requested. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
434 |
i = 0; |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
435 |
while (addresses[start+i] != 0) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
436 |
if (i == HeapSearchSteps) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
437 |
addresses[start+i] = 0; |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
438 |
break; |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
439 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
440 |
i++; |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
441 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
442 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
443 |
return (char**) &addresses[start]; |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
444 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
445 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
446 |
void ReservedHeapSpace::initialize_compressed_heap(const size_t size, size_t alignment, bool large) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
447 |
guarantee(size + noaccess_prefix_size(alignment) <= OopEncodingHeapMax, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
448 |
"can not allocate compressed oop heap for this size"); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
449 |
guarantee(alignment == MAX2(alignment, (size_t)os::vm_page_size()), "alignment too small"); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
450 |
assert(HeapBaseMinAddress > 0, "sanity"); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
451 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
452 |
const size_t granularity = os::vm_allocation_granularity(); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
453 |
assert((size & (granularity - 1)) == 0, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
454 |
"size not aligned to os::vm_allocation_granularity()"); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
455 |
assert((alignment & (granularity - 1)) == 0, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
456 |
"alignment not aligned to os::vm_allocation_granularity()"); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
457 |
assert(alignment == 0 || is_power_of_2((intptr_t)alignment), |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
458 |
"not a power of 2"); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
459 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
460 |
// The necessary attach point alignment for generated wish addresses. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
461 |
// This is needed to increase the chance of attaching for mmap and shmat. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
462 |
const size_t os_attach_point_alignment = |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
463 |
AIX_ONLY(SIZE_256M) // Known shm boundary alignment. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
464 |
NOT_AIX(os::vm_allocation_granularity()); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
465 |
const size_t attach_point_alignment = lcm(alignment, os_attach_point_alignment); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
466 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
467 |
char *aligned_heap_base_min_address = (char *)align_ptr_up((void *)HeapBaseMinAddress, alignment); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
468 |
size_t noaccess_prefix = ((aligned_heap_base_min_address + size) > (char*)OopEncodingHeapMax) ? |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
469 |
noaccess_prefix_size(alignment) : 0; |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
470 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
471 |
// Attempt to alloc at user-given address. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
472 |
if (!FLAG_IS_DEFAULT(HeapBaseMinAddress)) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
473 |
try_reserve_heap(size + noaccess_prefix, alignment, large, aligned_heap_base_min_address); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
474 |
if (_base != aligned_heap_base_min_address) { // Enforce this exact address. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
475 |
release(); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
476 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
477 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
478 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
479 |
// Keep heap at HeapBaseMinAddress. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
480 |
if (_base == NULL) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
481 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
482 |
// Try to allocate the heap at addresses that allow efficient oop compression. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
483 |
// Different schemes are tried, in order of decreasing optimization potential. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
484 |
// |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
485 |
// For this, try_reserve_heap() is called with the desired heap base addresses. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
486 |
// A call into the os layer to allocate at a given address can return memory |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
487 |
// at a different address than requested. Still, this might be memory at a useful |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
488 |
// address. try_reserve_heap() always returns this allocated memory, as only here |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
489 |
// the criteria for a good heap are checked. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
490 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
491 |
// Attempt to allocate so that we can run without base and scale (32-Bit unscaled compressed oops). |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
492 |
// Give it several tries from top of range to bottom. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
493 |
if (aligned_heap_base_min_address + size <= (char *)UnscaledOopHeapMax) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
494 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
495 |
// Calc address range within we try to attach (range of possible start addresses). |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
496 |
char* const highest_start = (char *)align_ptr_down((char *)UnscaledOopHeapMax - size, attach_point_alignment); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
497 |
char* const lowest_start = (char *)align_ptr_up ( aligned_heap_base_min_address , attach_point_alignment); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
498 |
try_reserve_range(highest_start, lowest_start, attach_point_alignment, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
499 |
aligned_heap_base_min_address, (char *)UnscaledOopHeapMax, size, alignment, large); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
500 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
501 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
502 |
// zerobased: Attempt to allocate in the lower 32G. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
503 |
// But leave room for the compressed class pointers, which is allocated above |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
504 |
// the heap. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
505 |
char *zerobased_max = (char *)OopEncodingHeapMax; |
28946
24261e03ba4c
8072434: 8064457: introduces performance regressions in 9-b47
goetz
parents:
28631
diff
changeset
|
506 |
const size_t class_space = align_size_up(CompressedClassSpaceSize, alignment); |
28372
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
507 |
// For small heaps, save some space for compressed class pointer |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
508 |
// space so it can be decoded with no base. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
509 |
if (UseCompressedClassPointers && !UseSharedSpaces && |
28946
24261e03ba4c
8072434: 8064457: introduces performance regressions in 9-b47
goetz
parents:
28631
diff
changeset
|
510 |
OopEncodingHeapMax <= KlassEncodingMetaspaceMax && |
24261e03ba4c
8072434: 8064457: introduces performance regressions in 9-b47
goetz
parents:
28631
diff
changeset
|
511 |
(uint64_t)(aligned_heap_base_min_address + size + class_space) <= KlassEncodingMetaspaceMax) { |
28372
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
512 |
zerobased_max = (char *)OopEncodingHeapMax - class_space; |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
513 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
514 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
515 |
// Give it several tries from top of range to bottom. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
516 |
if (aligned_heap_base_min_address + size <= zerobased_max && // Zerobased theoretical possible. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
517 |
((_base == NULL) || // No previous try succeeded. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
518 |
(_base + size > zerobased_max))) { // Unscaled delivered an arbitrary address. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
519 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
520 |
// Calc address range within we try to attach (range of possible start addresses). |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
521 |
char *const highest_start = (char *)align_ptr_down(zerobased_max - size, attach_point_alignment); |
29580
a67a581cfe11
8073315: Enable gcc -Wtype-limits and fix upcoming issues.
goetz
parents:
28946
diff
changeset
|
522 |
// Need to be careful about size being guaranteed to be less |
a67a581cfe11
8073315: Enable gcc -Wtype-limits and fix upcoming issues.
goetz
parents:
28946
diff
changeset
|
523 |
// than UnscaledOopHeapMax due to type constraints. |
a67a581cfe11
8073315: Enable gcc -Wtype-limits and fix upcoming issues.
goetz
parents:
28946
diff
changeset
|
524 |
char *lowest_start = aligned_heap_base_min_address; |
a67a581cfe11
8073315: Enable gcc -Wtype-limits and fix upcoming issues.
goetz
parents:
28946
diff
changeset
|
525 |
uint64_t unscaled_end = UnscaledOopHeapMax - size; |
a67a581cfe11
8073315: Enable gcc -Wtype-limits and fix upcoming issues.
goetz
parents:
28946
diff
changeset
|
526 |
if (unscaled_end < UnscaledOopHeapMax) { // unscaled_end wrapped if size is large |
a67a581cfe11
8073315: Enable gcc -Wtype-limits and fix upcoming issues.
goetz
parents:
28946
diff
changeset
|
527 |
lowest_start = MAX2(lowest_start, (char*)unscaled_end); |
a67a581cfe11
8073315: Enable gcc -Wtype-limits and fix upcoming issues.
goetz
parents:
28946
diff
changeset
|
528 |
} |
28372
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
529 |
lowest_start = (char *)align_ptr_up(lowest_start, attach_point_alignment); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
530 |
try_reserve_range(highest_start, lowest_start, attach_point_alignment, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
531 |
aligned_heap_base_min_address, zerobased_max, size, alignment, large); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
532 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
533 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
534 |
// Now we go for heaps with base != 0. We need a noaccess prefix to efficiently |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
535 |
// implement null checks. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
536 |
noaccess_prefix = noaccess_prefix_size(alignment); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
537 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
538 |
// Try to attach at addresses that are aligned to OopEncodingHeapMax. Disjointbase mode. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
539 |
char** addresses = get_attach_addresses_for_disjoint_mode(); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
540 |
int i = 0; |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
541 |
while (addresses[i] && // End of array not yet reached. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
542 |
((_base == NULL) || // No previous try succeeded. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
543 |
(_base + size > (char *)OopEncodingHeapMax && // Not zerobased or unscaled address. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
544 |
!Universe::is_disjoint_heap_base_address((address)_base)))) { // Not disjoint address. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
545 |
char* const attach_point = addresses[i]; |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
546 |
assert(attach_point >= aligned_heap_base_min_address, "Flag support broken"); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
547 |
try_reserve_heap(size + noaccess_prefix, alignment, large, attach_point); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
548 |
i++; |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
549 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
550 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
551 |
// Last, desperate try without any placement. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
552 |
if (_base == NULL) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
553 |
if (PrintCompressedOopsMode && Verbose) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
554 |
tty->print("Trying to allocate at address NULL heap of size " PTR_FORMAT ".\n", (address)size + noaccess_prefix); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
555 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
556 |
initialize(size + noaccess_prefix, alignment, large, NULL, false); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
557 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
558 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
559 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
560 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
561 |
ReservedHeapSpace::ReservedHeapSpace(size_t size, size_t alignment, bool large) : ReservedSpace() { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
562 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
563 |
if (size == 0) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
564 |
return; |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
565 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
566 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
567 |
// Heap size should be aligned to alignment, too. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
568 |
guarantee(is_size_aligned(size, alignment), "set by caller"); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
569 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
570 |
if (UseCompressedOops) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
571 |
initialize_compressed_heap(size, alignment, large); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
572 |
if (_size > size) { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
573 |
// We allocated heap with noaccess prefix. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
574 |
// It can happen we get a zerobased/unscaled heap with noaccess prefix, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
575 |
// if we had to try at arbitrary address. |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
576 |
establish_noaccess_prefix(); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
577 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
578 |
} else { |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
579 |
initialize(size, alignment, large, NULL, false); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
580 |
} |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
581 |
|
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
582 |
assert(markOopDesc::encode_pointer_as_mark(_base)->decode_pointer() == _base, |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
583 |
"area must be distinguishable from marks for mark-sweep"); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
584 |
assert(markOopDesc::encode_pointer_as_mark(&_base[size])->decode_pointer() == &_base[size], |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
585 |
"area must be distinguishable from marks for mark-sweep"); |
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
586 |
|
13195 | 587 |
if (base() > 0) { |
588 |
MemTracker::record_virtual_memory_type((address)base(), mtJavaHeap); |
|
589 |
} |
|
823
9a5271881bc0
6716785: implicit null checks not triggering with CompressedOops
coleenp
parents:
1
diff
changeset
|
590 |
} |
9a5271881bc0
6716785: implicit null checks not triggering with CompressedOops
coleenp
parents:
1
diff
changeset
|
591 |
|
2268 | 592 |
// Reserve space for code segment. Same as Java heap only we mark this as |
593 |
// executable. |
|
594 |
ReservedCodeSpace::ReservedCodeSpace(size_t r_size, |
|
595 |
size_t rs_align, |
|
596 |
bool large) : |
|
597 |
ReservedSpace(r_size, rs_align, large, /*executable*/ true) { |
|
13195 | 598 |
MemTracker::record_virtual_memory_type((address)base(), mtCode); |
2268 | 599 |
} |
600 |
||
1 | 601 |
// VirtualSpace |
602 |
||
603 |
VirtualSpace::VirtualSpace() { |
|
604 |
_low_boundary = NULL; |
|
605 |
_high_boundary = NULL; |
|
606 |
_low = NULL; |
|
607 |
_high = NULL; |
|
608 |
_lower_high = NULL; |
|
609 |
_middle_high = NULL; |
|
610 |
_upper_high = NULL; |
|
611 |
_lower_high_boundary = NULL; |
|
612 |
_middle_high_boundary = NULL; |
|
613 |
_upper_high_boundary = NULL; |
|
614 |
_lower_alignment = 0; |
|
615 |
_middle_alignment = 0; |
|
616 |
_upper_alignment = 0; |
|
823
9a5271881bc0
6716785: implicit null checks not triggering with CompressedOops
coleenp
parents:
1
diff
changeset
|
617 |
_special = false; |
2268 | 618 |
_executable = false; |
1 | 619 |
} |
620 |
||
621 |
||
622 |
bool VirtualSpace::initialize(ReservedSpace rs, size_t committed_size) { |
|
28631 | 623 |
const size_t max_commit_granularity = os::page_size_for_region_unaligned(rs.size(), 1); |
20402
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
624 |
return initialize_with_granularity(rs, committed_size, max_commit_granularity); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
625 |
} |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
626 |
|
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
627 |
bool VirtualSpace::initialize_with_granularity(ReservedSpace rs, size_t committed_size, size_t max_commit_granularity) { |
1 | 628 |
if(!rs.is_reserved()) return false; // allocation failed. |
629 |
assert(_low_boundary == NULL, "VirtualSpace already initialized"); |
|
20402
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
630 |
assert(max_commit_granularity > 0, "Granularity must be non-zero."); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
631 |
|
1 | 632 |
_low_boundary = rs.base(); |
633 |
_high_boundary = low_boundary() + rs.size(); |
|
634 |
||
635 |
_low = low_boundary(); |
|
636 |
_high = low(); |
|
637 |
||
638 |
_special = rs.special(); |
|
2268 | 639 |
_executable = rs.executable(); |
1 | 640 |
|
641 |
// When a VirtualSpace begins life at a large size, make all future expansion |
|
642 |
// and shrinking occur aligned to a granularity of large pages. This avoids |
|
643 |
// fragmentation of physical addresses that inhibits the use of large pages |
|
644 |
// by the OS virtual memory system. Empirically, we see that with a 4MB |
|
645 |
// page size, the only spaces that get handled this way are codecache and |
|
646 |
// the heap itself, both of which provide a substantial performance |
|
647 |
// boost in many benchmarks when covered by large pages. |
|
648 |
// |
|
649 |
// No attempt is made to force large page alignment at the very top and |
|
650 |
// bottom of the space if they are not aligned so already. |
|
651 |
_lower_alignment = os::vm_page_size(); |
|
20402
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
652 |
_middle_alignment = max_commit_granularity; |
1 | 653 |
_upper_alignment = os::vm_page_size(); |
654 |
||
655 |
// End of each region |
|
656 |
_lower_high_boundary = (char*) round_to((intptr_t) low_boundary(), middle_alignment()); |
|
657 |
_middle_high_boundary = (char*) round_down((intptr_t) high_boundary(), middle_alignment()); |
|
658 |
_upper_high_boundary = high_boundary(); |
|
659 |
||
660 |
// High address of each region |
|
661 |
_lower_high = low_boundary(); |
|
662 |
_middle_high = lower_high_boundary(); |
|
663 |
_upper_high = middle_high_boundary(); |
|
664 |
||
665 |
// commit to initial size |
|
666 |
if (committed_size > 0) { |
|
667 |
if (!expand_by(committed_size)) { |
|
668 |
return false; |
|
669 |
} |
|
670 |
} |
|
671 |
return true; |
|
672 |
} |
|
673 |
||
674 |
||
675 |
VirtualSpace::~VirtualSpace() { |
|
676 |
release(); |
|
677 |
} |
|
678 |
||
679 |
||
680 |
void VirtualSpace::release() { |
|
823
9a5271881bc0
6716785: implicit null checks not triggering with CompressedOops
coleenp
parents:
1
diff
changeset
|
681 |
// This does not release memory it never reserved. |
9a5271881bc0
6716785: implicit null checks not triggering with CompressedOops
coleenp
parents:
1
diff
changeset
|
682 |
// Caller must release via rs.release(); |
1 | 683 |
_low_boundary = NULL; |
684 |
_high_boundary = NULL; |
|
685 |
_low = NULL; |
|
686 |
_high = NULL; |
|
687 |
_lower_high = NULL; |
|
688 |
_middle_high = NULL; |
|
689 |
_upper_high = NULL; |
|
690 |
_lower_high_boundary = NULL; |
|
691 |
_middle_high_boundary = NULL; |
|
692 |
_upper_high_boundary = NULL; |
|
693 |
_lower_alignment = 0; |
|
694 |
_middle_alignment = 0; |
|
695 |
_upper_alignment = 0; |
|
696 |
_special = false; |
|
2268 | 697 |
_executable = false; |
1 | 698 |
} |
699 |
||
700 |
||
701 |
size_t VirtualSpace::committed_size() const { |
|
702 |
return pointer_delta(high(), low(), sizeof(char)); |
|
703 |
} |
|
704 |
||
705 |
||
706 |
size_t VirtualSpace::reserved_size() const { |
|
707 |
return pointer_delta(high_boundary(), low_boundary(), sizeof(char)); |
|
708 |
} |
|
709 |
||
710 |
||
711 |
size_t VirtualSpace::uncommitted_size() const { |
|
712 |
return reserved_size() - committed_size(); |
|
713 |
} |
|
714 |
||
19989
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
715 |
size_t VirtualSpace::actual_committed_size() const { |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
716 |
// Special VirtualSpaces commit all reserved space up front. |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
717 |
if (special()) { |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
718 |
return reserved_size(); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
719 |
} |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
720 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
721 |
size_t committed_low = pointer_delta(_lower_high, _low_boundary, sizeof(char)); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
722 |
size_t committed_middle = pointer_delta(_middle_high, _lower_high_boundary, sizeof(char)); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
723 |
size_t committed_high = pointer_delta(_upper_high, _middle_high_boundary, sizeof(char)); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
724 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
725 |
#ifdef ASSERT |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
726 |
size_t lower = pointer_delta(_lower_high_boundary, _low_boundary, sizeof(char)); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
727 |
size_t middle = pointer_delta(_middle_high_boundary, _lower_high_boundary, sizeof(char)); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
728 |
size_t upper = pointer_delta(_upper_high_boundary, _middle_high_boundary, sizeof(char)); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
729 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
730 |
if (committed_high > 0) { |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
731 |
assert(committed_low == lower, "Must be"); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
732 |
assert(committed_middle == middle, "Must be"); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
733 |
} |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
734 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
735 |
if (committed_middle > 0) { |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
736 |
assert(committed_low == lower, "Must be"); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
737 |
} |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
738 |
if (committed_middle < middle) { |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
739 |
assert(committed_high == 0, "Must be"); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
740 |
} |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
741 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
742 |
if (committed_low < lower) { |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
743 |
assert(committed_high == 0, "Must be"); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
744 |
assert(committed_middle == 0, "Must be"); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
745 |
} |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
746 |
#endif |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
747 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
748 |
return committed_low + committed_middle + committed_high; |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
749 |
} |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
750 |
|
1 | 751 |
|
752 |
bool VirtualSpace::contains(const void* p) const { |
|
753 |
return low() <= (const char*) p && (const char*) p < high(); |
|
754 |
} |
|
755 |
||
756 |
/* |
|
757 |
First we need to determine if a particular virtual space is using large |
|
758 |
pages. This is done at the initialize function and only virtual spaces |
|
759 |
that are larger than LargePageSizeInBytes use large pages. Once we |
|
760 |
have determined this, all expand_by and shrink_by calls must grow and |
|
761 |
shrink by large page size chunks. If a particular request |
|
762 |
is within the current large page, the call to commit and uncommit memory |
|
763 |
can be ignored. In the case that the low and high boundaries of this |
|
764 |
space is not large page aligned, the pages leading to the first large |
|
765 |
page address and the pages after the last large page address must be |
|
766 |
allocated with default pages. |
|
767 |
*/ |
|
768 |
bool VirtualSpace::expand_by(size_t bytes, bool pre_touch) { |
|
769 |
if (uncommitted_size() < bytes) return false; |
|
770 |
||
771 |
if (special()) { |
|
772 |
// don't commit memory if the entire space is pinned in memory |
|
773 |
_high += bytes; |
|
774 |
return true; |
|
775 |
} |
|
776 |
||
777 |
char* previous_high = high(); |
|
778 |
char* unaligned_new_high = high() + bytes; |
|
779 |
assert(unaligned_new_high <= high_boundary(), |
|
780 |
"cannot expand by more than upper boundary"); |
|
781 |
||
782 |
// Calculate where the new high for each of the regions should be. If |
|
783 |
// the low_boundary() and high_boundary() are LargePageSizeInBytes aligned |
|
784 |
// then the unaligned lower and upper new highs would be the |
|
785 |
// lower_high() and upper_high() respectively. |
|
786 |
char* unaligned_lower_new_high = |
|
787 |
MIN2(unaligned_new_high, lower_high_boundary()); |
|
788 |
char* unaligned_middle_new_high = |
|
789 |
MIN2(unaligned_new_high, middle_high_boundary()); |
|
790 |
char* unaligned_upper_new_high = |
|
791 |
MIN2(unaligned_new_high, upper_high_boundary()); |
|
792 |
||
793 |
// Align the new highs based on the regions alignment. lower and upper |
|
794 |
// alignment will always be default page size. middle alignment will be |
|
795 |
// LargePageSizeInBytes if the actual size of the virtual space is in |
|
796 |
// fact larger than LargePageSizeInBytes. |
|
797 |
char* aligned_lower_new_high = |
|
798 |
(char*) round_to((intptr_t) unaligned_lower_new_high, lower_alignment()); |
|
799 |
char* aligned_middle_new_high = |
|
800 |
(char*) round_to((intptr_t) unaligned_middle_new_high, middle_alignment()); |
|
801 |
char* aligned_upper_new_high = |
|
802 |
(char*) round_to((intptr_t) unaligned_upper_new_high, upper_alignment()); |
|
803 |
||
804 |
// Determine which regions need to grow in this expand_by call. |
|
805 |
// If you are growing in the lower region, high() must be in that |
|
22551 | 806 |
// region so calculate the size based on high(). For the middle and |
1 | 807 |
// upper regions, determine the starting point of growth based on the |
808 |
// location of high(). By getting the MAX of the region's low address |
|
22551 | 809 |
// (or the previous region's high address) and high(), we can tell if it |
1 | 810 |
// is an intra or inter region growth. |
811 |
size_t lower_needs = 0; |
|
812 |
if (aligned_lower_new_high > lower_high()) { |
|
813 |
lower_needs = |
|
814 |
pointer_delta(aligned_lower_new_high, lower_high(), sizeof(char)); |
|
815 |
} |
|
816 |
size_t middle_needs = 0; |
|
817 |
if (aligned_middle_new_high > middle_high()) { |
|
818 |
middle_needs = |
|
819 |
pointer_delta(aligned_middle_new_high, middle_high(), sizeof(char)); |
|
820 |
} |
|
821 |
size_t upper_needs = 0; |
|
822 |
if (aligned_upper_new_high > upper_high()) { |
|
823 |
upper_needs = |
|
824 |
pointer_delta(aligned_upper_new_high, upper_high(), sizeof(char)); |
|
825 |
} |
|
826 |
||
827 |
// Check contiguity. |
|
828 |
assert(low_boundary() <= lower_high() && |
|
829 |
lower_high() <= lower_high_boundary(), |
|
830 |
"high address must be contained within the region"); |
|
831 |
assert(lower_high_boundary() <= middle_high() && |
|
832 |
middle_high() <= middle_high_boundary(), |
|
833 |
"high address must be contained within the region"); |
|
834 |
assert(middle_high_boundary() <= upper_high() && |
|
835 |
upper_high() <= upper_high_boundary(), |
|
836 |
"high address must be contained within the region"); |
|
837 |
||
838 |
// Commit regions |
|
839 |
if (lower_needs > 0) { |
|
840 |
assert(low_boundary() <= lower_high() && |
|
841 |
lower_high() + lower_needs <= lower_high_boundary(), |
|
842 |
"must not expand beyond region"); |
|
2268 | 843 |
if (!os::commit_memory(lower_high(), lower_needs, _executable)) { |
18069
e6d4971c8650
8013057: assert(_needs_gc || SafepointSynchronize::is_at_safepoint()) failed: only read at safepoint
dcubed
parents:
17113
diff
changeset
|
844 |
debug_only(warning("INFO: os::commit_memory(" PTR_FORMAT |
e6d4971c8650
8013057: assert(_needs_gc || SafepointSynchronize::is_at_safepoint()) failed: only read at safepoint
dcubed
parents:
17113
diff
changeset
|
845 |
", lower_needs=" SIZE_FORMAT ", %d) failed", |
e6d4971c8650
8013057: assert(_needs_gc || SafepointSynchronize::is_at_safepoint()) failed: only read at safepoint
dcubed
parents:
17113
diff
changeset
|
846 |
lower_high(), lower_needs, _executable);) |
1 | 847 |
return false; |
848 |
} else { |
|
849 |
_lower_high += lower_needs; |
|
18069
e6d4971c8650
8013057: assert(_needs_gc || SafepointSynchronize::is_at_safepoint()) failed: only read at safepoint
dcubed
parents:
17113
diff
changeset
|
850 |
} |
1 | 851 |
} |
852 |
if (middle_needs > 0) { |
|
853 |
assert(lower_high_boundary() <= middle_high() && |
|
854 |
middle_high() + middle_needs <= middle_high_boundary(), |
|
855 |
"must not expand beyond region"); |
|
2268 | 856 |
if (!os::commit_memory(middle_high(), middle_needs, middle_alignment(), |
857 |
_executable)) { |
|
18069
e6d4971c8650
8013057: assert(_needs_gc || SafepointSynchronize::is_at_safepoint()) failed: only read at safepoint
dcubed
parents:
17113
diff
changeset
|
858 |
debug_only(warning("INFO: os::commit_memory(" PTR_FORMAT |
e6d4971c8650
8013057: assert(_needs_gc || SafepointSynchronize::is_at_safepoint()) failed: only read at safepoint
dcubed
parents:
17113
diff
changeset
|
859 |
", middle_needs=" SIZE_FORMAT ", " SIZE_FORMAT |
e6d4971c8650
8013057: assert(_needs_gc || SafepointSynchronize::is_at_safepoint()) failed: only read at safepoint
dcubed
parents:
17113
diff
changeset
|
860 |
", %d) failed", middle_high(), middle_needs, |
e6d4971c8650
8013057: assert(_needs_gc || SafepointSynchronize::is_at_safepoint()) failed: only read at safepoint
dcubed
parents:
17113
diff
changeset
|
861 |
middle_alignment(), _executable);) |
1 | 862 |
return false; |
863 |
} |
|
864 |
_middle_high += middle_needs; |
|
865 |
} |
|
866 |
if (upper_needs > 0) { |
|
867 |
assert(middle_high_boundary() <= upper_high() && |
|
868 |
upper_high() + upper_needs <= upper_high_boundary(), |
|
869 |
"must not expand beyond region"); |
|
2268 | 870 |
if (!os::commit_memory(upper_high(), upper_needs, _executable)) { |
18069
e6d4971c8650
8013057: assert(_needs_gc || SafepointSynchronize::is_at_safepoint()) failed: only read at safepoint
dcubed
parents:
17113
diff
changeset
|
871 |
debug_only(warning("INFO: os::commit_memory(" PTR_FORMAT |
e6d4971c8650
8013057: assert(_needs_gc || SafepointSynchronize::is_at_safepoint()) failed: only read at safepoint
dcubed
parents:
17113
diff
changeset
|
872 |
", upper_needs=" SIZE_FORMAT ", %d) failed", |
e6d4971c8650
8013057: assert(_needs_gc || SafepointSynchronize::is_at_safepoint()) failed: only read at safepoint
dcubed
parents:
17113
diff
changeset
|
873 |
upper_high(), upper_needs, _executable);) |
1 | 874 |
return false; |
875 |
} else { |
|
876 |
_upper_high += upper_needs; |
|
877 |
} |
|
878 |
} |
|
879 |
||
880 |
if (pre_touch || AlwaysPreTouch) { |
|
28208 | 881 |
os::pretouch_memory(previous_high, unaligned_new_high); |
1 | 882 |
} |
883 |
||
884 |
_high += bytes; |
|
885 |
return true; |
|
886 |
} |
|
887 |
||
888 |
// A page is uncommitted if the contents of the entire page is deemed unusable. |
|
889 |
// Continue to decrement the high() pointer until it reaches a page boundary |
|
890 |
// in which case that particular page can now be uncommitted. |
|
891 |
void VirtualSpace::shrink_by(size_t size) { |
|
892 |
if (committed_size() < size) |
|
893 |
fatal("Cannot shrink virtual space to negative size"); |
|
894 |
||
895 |
if (special()) { |
|
896 |
// don't uncommit if the entire space is pinned in memory |
|
897 |
_high -= size; |
|
898 |
return; |
|
899 |
} |
|
900 |
||
901 |
char* unaligned_new_high = high() - size; |
|
902 |
assert(unaligned_new_high >= low_boundary(), "cannot shrink past lower boundary"); |
|
903 |
||
904 |
// Calculate new unaligned address |
|
905 |
char* unaligned_upper_new_high = |
|
906 |
MAX2(unaligned_new_high, middle_high_boundary()); |
|
907 |
char* unaligned_middle_new_high = |
|
908 |
MAX2(unaligned_new_high, lower_high_boundary()); |
|
909 |
char* unaligned_lower_new_high = |
|
910 |
MAX2(unaligned_new_high, low_boundary()); |
|
911 |
||
912 |
// Align address to region's alignment |
|
913 |
char* aligned_upper_new_high = |
|
914 |
(char*) round_to((intptr_t) unaligned_upper_new_high, upper_alignment()); |
|
915 |
char* aligned_middle_new_high = |
|
916 |
(char*) round_to((intptr_t) unaligned_middle_new_high, middle_alignment()); |
|
917 |
char* aligned_lower_new_high = |
|
918 |
(char*) round_to((intptr_t) unaligned_lower_new_high, lower_alignment()); |
|
919 |
||
920 |
// Determine which regions need to shrink |
|
921 |
size_t upper_needs = 0; |
|
922 |
if (aligned_upper_new_high < upper_high()) { |
|
923 |
upper_needs = |
|
924 |
pointer_delta(upper_high(), aligned_upper_new_high, sizeof(char)); |
|
925 |
} |
|
926 |
size_t middle_needs = 0; |
|
927 |
if (aligned_middle_new_high < middle_high()) { |
|
928 |
middle_needs = |
|
929 |
pointer_delta(middle_high(), aligned_middle_new_high, sizeof(char)); |
|
930 |
} |
|
931 |
size_t lower_needs = 0; |
|
932 |
if (aligned_lower_new_high < lower_high()) { |
|
933 |
lower_needs = |
|
934 |
pointer_delta(lower_high(), aligned_lower_new_high, sizeof(char)); |
|
935 |
} |
|
936 |
||
937 |
// Check contiguity. |
|
938 |
assert(middle_high_boundary() <= upper_high() && |
|
939 |
upper_high() <= upper_high_boundary(), |
|
940 |
"high address must be contained within the region"); |
|
941 |
assert(lower_high_boundary() <= middle_high() && |
|
942 |
middle_high() <= middle_high_boundary(), |
|
943 |
"high address must be contained within the region"); |
|
944 |
assert(low_boundary() <= lower_high() && |
|
945 |
lower_high() <= lower_high_boundary(), |
|
946 |
"high address must be contained within the region"); |
|
947 |
||
948 |
// Uncommit |
|
949 |
if (upper_needs > 0) { |
|
950 |
assert(middle_high_boundary() <= aligned_upper_new_high && |
|
951 |
aligned_upper_new_high + upper_needs <= upper_high_boundary(), |
|
952 |
"must not shrink beyond region"); |
|
953 |
if (!os::uncommit_memory(aligned_upper_new_high, upper_needs)) { |
|
954 |
debug_only(warning("os::uncommit_memory failed")); |
|
955 |
return; |
|
956 |
} else { |
|
957 |
_upper_high -= upper_needs; |
|
958 |
} |
|
959 |
} |
|
960 |
if (middle_needs > 0) { |
|
961 |
assert(lower_high_boundary() <= aligned_middle_new_high && |
|
962 |
aligned_middle_new_high + middle_needs <= middle_high_boundary(), |
|
963 |
"must not shrink beyond region"); |
|
964 |
if (!os::uncommit_memory(aligned_middle_new_high, middle_needs)) { |
|
965 |
debug_only(warning("os::uncommit_memory failed")); |
|
966 |
return; |
|
967 |
} else { |
|
968 |
_middle_high -= middle_needs; |
|
969 |
} |
|
970 |
} |
|
971 |
if (lower_needs > 0) { |
|
972 |
assert(low_boundary() <= aligned_lower_new_high && |
|
973 |
aligned_lower_new_high + lower_needs <= lower_high_boundary(), |
|
974 |
"must not shrink beyond region"); |
|
975 |
if (!os::uncommit_memory(aligned_lower_new_high, lower_needs)) { |
|
976 |
debug_only(warning("os::uncommit_memory failed")); |
|
977 |
return; |
|
978 |
} else { |
|
979 |
_lower_high -= lower_needs; |
|
980 |
} |
|
981 |
} |
|
982 |
||
983 |
_high -= size; |
|
984 |
} |
|
985 |
||
986 |
#ifndef PRODUCT |
|
987 |
void VirtualSpace::check_for_contiguity() { |
|
988 |
// Check contiguity. |
|
989 |
assert(low_boundary() <= lower_high() && |
|
990 |
lower_high() <= lower_high_boundary(), |
|
991 |
"high address must be contained within the region"); |
|
992 |
assert(lower_high_boundary() <= middle_high() && |
|
993 |
middle_high() <= middle_high_boundary(), |
|
994 |
"high address must be contained within the region"); |
|
995 |
assert(middle_high_boundary() <= upper_high() && |
|
996 |
upper_high() <= upper_high_boundary(), |
|
997 |
"high address must be contained within the region"); |
|
998 |
assert(low() >= low_boundary(), "low"); |
|
999 |
assert(low_boundary() <= lower_high_boundary(), "lower high boundary"); |
|
1000 |
assert(upper_high_boundary() <= high_boundary(), "upper high boundary"); |
|
1001 |
assert(high() <= upper_high(), "upper high"); |
|
1002 |
} |
|
1003 |
||
19993
b1d392324718
8024752: Log TraceMetadata* output to gclog_or_tty instead of tty
stefank
parents:
19989
diff
changeset
|
1004 |
void VirtualSpace::print_on(outputStream* out) { |
b1d392324718
8024752: Log TraceMetadata* output to gclog_or_tty instead of tty
stefank
parents:
19989
diff
changeset
|
1005 |
out->print ("Virtual space:"); |
b1d392324718
8024752: Log TraceMetadata* output to gclog_or_tty instead of tty
stefank
parents:
19989
diff
changeset
|
1006 |
if (special()) out->print(" (pinned in memory)"); |
b1d392324718
8024752: Log TraceMetadata* output to gclog_or_tty instead of tty
stefank
parents:
19989
diff
changeset
|
1007 |
out->cr(); |
b1d392324718
8024752: Log TraceMetadata* output to gclog_or_tty instead of tty
stefank
parents:
19989
diff
changeset
|
1008 |
out->print_cr(" - committed: " SIZE_FORMAT, committed_size()); |
b1d392324718
8024752: Log TraceMetadata* output to gclog_or_tty instead of tty
stefank
parents:
19989
diff
changeset
|
1009 |
out->print_cr(" - reserved: " SIZE_FORMAT, reserved_size()); |
b1d392324718
8024752: Log TraceMetadata* output to gclog_or_tty instead of tty
stefank
parents:
19989
diff
changeset
|
1010 |
out->print_cr(" - [low, high]: [" INTPTR_FORMAT ", " INTPTR_FORMAT "]", low(), high()); |
b1d392324718
8024752: Log TraceMetadata* output to gclog_or_tty instead of tty
stefank
parents:
19989
diff
changeset
|
1011 |
out->print_cr(" - [low_b, high_b]: [" INTPTR_FORMAT ", " INTPTR_FORMAT "]", low_boundary(), high_boundary()); |
1 | 1012 |
} |
1013 |
||
19993
b1d392324718
8024752: Log TraceMetadata* output to gclog_or_tty instead of tty
stefank
parents:
19989
diff
changeset
|
1014 |
void VirtualSpace::print() { |
b1d392324718
8024752: Log TraceMetadata* output to gclog_or_tty instead of tty
stefank
parents:
19989
diff
changeset
|
1015 |
print_on(tty); |
b1d392324718
8024752: Log TraceMetadata* output to gclog_or_tty instead of tty
stefank
parents:
19989
diff
changeset
|
1016 |
} |
19546
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1017 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1018 |
/////////////// Unit tests /////////////// |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1019 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1020 |
#ifndef PRODUCT |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1021 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1022 |
#define test_log(...) \ |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1023 |
do {\ |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1024 |
if (VerboseInternalVMTests) { \ |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1025 |
tty->print_cr(__VA_ARGS__); \ |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1026 |
tty->flush(); \ |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1027 |
}\ |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1028 |
} while (false) |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1029 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1030 |
class TestReservedSpace : AllStatic { |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1031 |
public: |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1032 |
static void small_page_write(void* addr, size_t size) { |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1033 |
size_t page_size = os::vm_page_size(); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1034 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1035 |
char* end = (char*)addr + size; |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1036 |
for (char* p = (char*)addr; p < end; p += page_size) { |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1037 |
*p = 1; |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1038 |
} |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1039 |
} |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1040 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1041 |
static void release_memory_for_test(ReservedSpace rs) { |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1042 |
if (rs.special()) { |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1043 |
guarantee(os::release_memory_special(rs.base(), rs.size()), "Shouldn't fail"); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1044 |
} else { |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1045 |
guarantee(os::release_memory(rs.base(), rs.size()), "Shouldn't fail"); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1046 |
} |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1047 |
} |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1048 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1049 |
static void test_reserved_space1(size_t size, size_t alignment) { |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1050 |
test_log("test_reserved_space1(%p)", (void*) (uintptr_t) size); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1051 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1052 |
assert(is_size_aligned(size, alignment), "Incorrect input parameters"); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1053 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1054 |
ReservedSpace rs(size, // size |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1055 |
alignment, // alignment |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1056 |
UseLargePages, // large |
28372
ce0aad4b8c44
8064457: Introduce compressed oops mode disjoint base and improve compressed heap handling.
goetz
parents:
28208
diff
changeset
|
1057 |
(char *)NULL); // requested_address |
19546
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1058 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1059 |
test_log(" rs.special() == %d", rs.special()); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1060 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1061 |
assert(rs.base() != NULL, "Must be"); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1062 |
assert(rs.size() == size, "Must be"); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1063 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1064 |
assert(is_ptr_aligned(rs.base(), alignment), "aligned sizes should always give aligned addresses"); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1065 |
assert(is_size_aligned(rs.size(), alignment), "aligned sizes should always give aligned addresses"); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1066 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1067 |
if (rs.special()) { |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1068 |
small_page_write(rs.base(), size); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1069 |
} |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1070 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1071 |
release_memory_for_test(rs); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1072 |
} |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1073 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1074 |
static void test_reserved_space2(size_t size) { |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1075 |
test_log("test_reserved_space2(%p)", (void*)(uintptr_t)size); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1076 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1077 |
assert(is_size_aligned(size, os::vm_allocation_granularity()), "Must be at least AG aligned"); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1078 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1079 |
ReservedSpace rs(size); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1080 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1081 |
test_log(" rs.special() == %d", rs.special()); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1082 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1083 |
assert(rs.base() != NULL, "Must be"); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1084 |
assert(rs.size() == size, "Must be"); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1085 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1086 |
if (rs.special()) { |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1087 |
small_page_write(rs.base(), size); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1088 |
} |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1089 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1090 |
release_memory_for_test(rs); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1091 |
} |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1092 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1093 |
static void test_reserved_space3(size_t size, size_t alignment, bool maybe_large) { |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1094 |
test_log("test_reserved_space3(%p, %p, %d)", |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1095 |
(void*)(uintptr_t)size, (void*)(uintptr_t)alignment, maybe_large); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1096 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1097 |
assert(is_size_aligned(size, os::vm_allocation_granularity()), "Must be at least AG aligned"); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1098 |
assert(is_size_aligned(size, alignment), "Must be at least aligned against alignment"); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1099 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1100 |
bool large = maybe_large && UseLargePages && size >= os::large_page_size(); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1101 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1102 |
ReservedSpace rs(size, alignment, large, false); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1103 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1104 |
test_log(" rs.special() == %d", rs.special()); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1105 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1106 |
assert(rs.base() != NULL, "Must be"); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1107 |
assert(rs.size() == size, "Must be"); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1108 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1109 |
if (rs.special()) { |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1110 |
small_page_write(rs.base(), size); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1111 |
} |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1112 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1113 |
release_memory_for_test(rs); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1114 |
} |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1115 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1116 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1117 |
static void test_reserved_space1() { |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1118 |
size_t size = 2 * 1024 * 1024; |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1119 |
size_t ag = os::vm_allocation_granularity(); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1120 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1121 |
test_reserved_space1(size, ag); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1122 |
test_reserved_space1(size * 2, ag); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1123 |
test_reserved_space1(size * 10, ag); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1124 |
} |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1125 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1126 |
static void test_reserved_space2() { |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1127 |
size_t size = 2 * 1024 * 1024; |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1128 |
size_t ag = os::vm_allocation_granularity(); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1129 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1130 |
test_reserved_space2(size * 1); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1131 |
test_reserved_space2(size * 2); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1132 |
test_reserved_space2(size * 10); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1133 |
test_reserved_space2(ag); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1134 |
test_reserved_space2(size - ag); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1135 |
test_reserved_space2(size); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1136 |
test_reserved_space2(size + ag); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1137 |
test_reserved_space2(size * 2); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1138 |
test_reserved_space2(size * 2 - ag); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1139 |
test_reserved_space2(size * 2 + ag); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1140 |
test_reserved_space2(size * 3); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1141 |
test_reserved_space2(size * 3 - ag); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1142 |
test_reserved_space2(size * 3 + ag); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1143 |
test_reserved_space2(size * 10); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1144 |
test_reserved_space2(size * 10 + size / 2); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1145 |
} |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1146 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1147 |
static void test_reserved_space3() { |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1148 |
size_t ag = os::vm_allocation_granularity(); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1149 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1150 |
test_reserved_space3(ag, ag , false); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1151 |
test_reserved_space3(ag * 2, ag , false); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1152 |
test_reserved_space3(ag * 3, ag , false); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1153 |
test_reserved_space3(ag * 2, ag * 2, false); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1154 |
test_reserved_space3(ag * 4, ag * 2, false); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1155 |
test_reserved_space3(ag * 8, ag * 2, false); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1156 |
test_reserved_space3(ag * 4, ag * 4, false); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1157 |
test_reserved_space3(ag * 8, ag * 4, false); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1158 |
test_reserved_space3(ag * 16, ag * 4, false); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1159 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1160 |
if (UseLargePages) { |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1161 |
size_t lp = os::large_page_size(); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1162 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1163 |
// Without large pages |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1164 |
test_reserved_space3(lp, ag * 4, false); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1165 |
test_reserved_space3(lp * 2, ag * 4, false); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1166 |
test_reserved_space3(lp * 4, ag * 4, false); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1167 |
test_reserved_space3(lp, lp , false); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1168 |
test_reserved_space3(lp * 2, lp , false); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1169 |
test_reserved_space3(lp * 3, lp , false); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1170 |
test_reserved_space3(lp * 2, lp * 2, false); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1171 |
test_reserved_space3(lp * 4, lp * 2, false); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1172 |
test_reserved_space3(lp * 8, lp * 2, false); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1173 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1174 |
// With large pages |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1175 |
test_reserved_space3(lp, ag * 4 , true); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1176 |
test_reserved_space3(lp * 2, ag * 4, true); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1177 |
test_reserved_space3(lp * 4, ag * 4, true); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1178 |
test_reserved_space3(lp, lp , true); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1179 |
test_reserved_space3(lp * 2, lp , true); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1180 |
test_reserved_space3(lp * 3, lp , true); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1181 |
test_reserved_space3(lp * 2, lp * 2, true); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1182 |
test_reserved_space3(lp * 4, lp * 2, true); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1183 |
test_reserved_space3(lp * 8, lp * 2, true); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1184 |
} |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1185 |
} |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1186 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1187 |
static void test_reserved_space() { |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1188 |
test_reserved_space1(); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1189 |
test_reserved_space2(); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1190 |
test_reserved_space3(); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1191 |
} |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1192 |
}; |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1193 |
|
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1194 |
void TestReservedSpace_test() { |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1195 |
TestReservedSpace::test_reserved_space(); |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1196 |
} |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1197 |
|
19989
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1198 |
#define assert_equals(actual, expected) \ |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1199 |
assert(actual == expected, \ |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1200 |
err_msg("Got " SIZE_FORMAT " expected " \ |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1201 |
SIZE_FORMAT, actual, expected)); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1202 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1203 |
#define assert_ge(value1, value2) \ |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1204 |
assert(value1 >= value2, \ |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1205 |
err_msg("'" #value1 "': " SIZE_FORMAT " '" \ |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1206 |
#value2 "': " SIZE_FORMAT, value1, value2)); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1207 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1208 |
#define assert_lt(value1, value2) \ |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1209 |
assert(value1 < value2, \ |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1210 |
err_msg("'" #value1 "': " SIZE_FORMAT " '" \ |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1211 |
#value2 "': " SIZE_FORMAT, value1, value2)); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1212 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1213 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1214 |
class TestVirtualSpace : AllStatic { |
20402
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1215 |
enum TestLargePages { |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1216 |
Default, |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1217 |
Disable, |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1218 |
Reserve, |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1219 |
Commit |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1220 |
}; |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1221 |
|
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1222 |
static ReservedSpace reserve_memory(size_t reserve_size_aligned, TestLargePages mode) { |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1223 |
switch(mode) { |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1224 |
default: |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1225 |
case Default: |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1226 |
case Reserve: |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1227 |
return ReservedSpace(reserve_size_aligned); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1228 |
case Disable: |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1229 |
case Commit: |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1230 |
return ReservedSpace(reserve_size_aligned, |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1231 |
os::vm_allocation_granularity(), |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1232 |
/* large */ false, /* exec */ false); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1233 |
} |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1234 |
} |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1235 |
|
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1236 |
static bool initialize_virtual_space(VirtualSpace& vs, ReservedSpace rs, TestLargePages mode) { |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1237 |
switch(mode) { |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1238 |
default: |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1239 |
case Default: |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1240 |
case Reserve: |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1241 |
return vs.initialize(rs, 0); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1242 |
case Disable: |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1243 |
return vs.initialize_with_granularity(rs, 0, os::vm_page_size()); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1244 |
case Commit: |
28631 | 1245 |
return vs.initialize_with_granularity(rs, 0, os::page_size_for_region_unaligned(rs.size(), 1)); |
20402
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1246 |
} |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1247 |
} |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1248 |
|
19989
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1249 |
public: |
20402
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1250 |
static void test_virtual_space_actual_committed_space(size_t reserve_size, size_t commit_size, |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1251 |
TestLargePages mode = Default) { |
19989
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1252 |
size_t granularity = os::vm_allocation_granularity(); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1253 |
size_t reserve_size_aligned = align_size_up(reserve_size, granularity); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1254 |
|
20402
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1255 |
ReservedSpace reserved = reserve_memory(reserve_size_aligned, mode); |
19989
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1256 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1257 |
assert(reserved.is_reserved(), "Must be"); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1258 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1259 |
VirtualSpace vs; |
20402
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1260 |
bool initialized = initialize_virtual_space(vs, reserved, mode); |
19989
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1261 |
assert(initialized, "Failed to initialize VirtualSpace"); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1262 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1263 |
vs.expand_by(commit_size, false); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1264 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1265 |
if (vs.special()) { |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1266 |
assert_equals(vs.actual_committed_size(), reserve_size_aligned); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1267 |
} else { |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1268 |
assert_ge(vs.actual_committed_size(), commit_size); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1269 |
// Approximate the commit granularity. |
20402
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1270 |
// Make sure that we don't commit using large pages |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1271 |
// if large pages has been disabled for this VirtualSpace. |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1272 |
size_t commit_granularity = (mode == Disable || !UseLargePages) ? |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1273 |
os::vm_page_size() : os::large_page_size(); |
19989
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1274 |
assert_lt(vs.actual_committed_size(), commit_size + commit_granularity); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1275 |
} |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1276 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1277 |
reserved.release(); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1278 |
} |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1279 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1280 |
static void test_virtual_space_actual_committed_space_one_large_page() { |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1281 |
if (!UseLargePages) { |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1282 |
return; |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1283 |
} |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1284 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1285 |
size_t large_page_size = os::large_page_size(); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1286 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1287 |
ReservedSpace reserved(large_page_size, large_page_size, true, false); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1288 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1289 |
assert(reserved.is_reserved(), "Must be"); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1290 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1291 |
VirtualSpace vs; |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1292 |
bool initialized = vs.initialize(reserved, 0); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1293 |
assert(initialized, "Failed to initialize VirtualSpace"); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1294 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1295 |
vs.expand_by(large_page_size, false); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1296 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1297 |
assert_equals(vs.actual_committed_size(), large_page_size); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1298 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1299 |
reserved.release(); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1300 |
} |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1301 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1302 |
static void test_virtual_space_actual_committed_space() { |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1303 |
test_virtual_space_actual_committed_space(4 * K, 0); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1304 |
test_virtual_space_actual_committed_space(4 * K, 4 * K); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1305 |
test_virtual_space_actual_committed_space(8 * K, 0); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1306 |
test_virtual_space_actual_committed_space(8 * K, 4 * K); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1307 |
test_virtual_space_actual_committed_space(8 * K, 8 * K); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1308 |
test_virtual_space_actual_committed_space(12 * K, 0); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1309 |
test_virtual_space_actual_committed_space(12 * K, 4 * K); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1310 |
test_virtual_space_actual_committed_space(12 * K, 8 * K); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1311 |
test_virtual_space_actual_committed_space(12 * K, 12 * K); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1312 |
test_virtual_space_actual_committed_space(64 * K, 0); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1313 |
test_virtual_space_actual_committed_space(64 * K, 32 * K); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1314 |
test_virtual_space_actual_committed_space(64 * K, 64 * K); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1315 |
test_virtual_space_actual_committed_space(2 * M, 0); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1316 |
test_virtual_space_actual_committed_space(2 * M, 4 * K); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1317 |
test_virtual_space_actual_committed_space(2 * M, 64 * K); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1318 |
test_virtual_space_actual_committed_space(2 * M, 1 * M); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1319 |
test_virtual_space_actual_committed_space(2 * M, 2 * M); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1320 |
test_virtual_space_actual_committed_space(10 * M, 0); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1321 |
test_virtual_space_actual_committed_space(10 * M, 4 * K); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1322 |
test_virtual_space_actual_committed_space(10 * M, 8 * K); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1323 |
test_virtual_space_actual_committed_space(10 * M, 1 * M); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1324 |
test_virtual_space_actual_committed_space(10 * M, 2 * M); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1325 |
test_virtual_space_actual_committed_space(10 * M, 5 * M); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1326 |
test_virtual_space_actual_committed_space(10 * M, 10 * M); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1327 |
} |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1328 |
|
20402
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1329 |
static void test_virtual_space_disable_large_pages() { |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1330 |
if (!UseLargePages) { |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1331 |
return; |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1332 |
} |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1333 |
// These test cases verify that if we force VirtualSpace to disable large pages |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1334 |
test_virtual_space_actual_committed_space(10 * M, 0, Disable); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1335 |
test_virtual_space_actual_committed_space(10 * M, 4 * K, Disable); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1336 |
test_virtual_space_actual_committed_space(10 * M, 8 * K, Disable); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1337 |
test_virtual_space_actual_committed_space(10 * M, 1 * M, Disable); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1338 |
test_virtual_space_actual_committed_space(10 * M, 2 * M, Disable); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1339 |
test_virtual_space_actual_committed_space(10 * M, 5 * M, Disable); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1340 |
test_virtual_space_actual_committed_space(10 * M, 10 * M, Disable); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1341 |
|
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1342 |
test_virtual_space_actual_committed_space(10 * M, 0, Reserve); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1343 |
test_virtual_space_actual_committed_space(10 * M, 4 * K, Reserve); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1344 |
test_virtual_space_actual_committed_space(10 * M, 8 * K, Reserve); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1345 |
test_virtual_space_actual_committed_space(10 * M, 1 * M, Reserve); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1346 |
test_virtual_space_actual_committed_space(10 * M, 2 * M, Reserve); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1347 |
test_virtual_space_actual_committed_space(10 * M, 5 * M, Reserve); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1348 |
test_virtual_space_actual_committed_space(10 * M, 10 * M, Reserve); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1349 |
|
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1350 |
test_virtual_space_actual_committed_space(10 * M, 0, Commit); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1351 |
test_virtual_space_actual_committed_space(10 * M, 4 * K, Commit); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1352 |
test_virtual_space_actual_committed_space(10 * M, 8 * K, Commit); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1353 |
test_virtual_space_actual_committed_space(10 * M, 1 * M, Commit); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1354 |
test_virtual_space_actual_committed_space(10 * M, 2 * M, Commit); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1355 |
test_virtual_space_actual_committed_space(10 * M, 5 * M, Commit); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1356 |
test_virtual_space_actual_committed_space(10 * M, 10 * M, Commit); |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1357 |
} |
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1358 |
|
19989
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1359 |
static void test_virtual_space() { |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1360 |
test_virtual_space_actual_committed_space(); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1361 |
test_virtual_space_actual_committed_space_one_large_page(); |
20402
9def9d6d969a
8025526: VirtualSpace should support per-instance disabling of large pages
mgerdin
parents:
19993
diff
changeset
|
1362 |
test_virtual_space_disable_large_pages(); |
19989
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1363 |
} |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1364 |
}; |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1365 |
|
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1366 |
void TestVirtualSpace_test() { |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1367 |
TestVirtualSpace::test_virtual_space(); |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1368 |
} |
0fc247fb59bc
8024638: Count and expose the amount of committed memory in the metaspaces
stefank
parents:
19546
diff
changeset
|
1369 |
|
19546
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1370 |
#endif // PRODUCT |
f6b7c9e96ea3
8007074: SIGSEGV at ParMarkBitMap::verify_clear()
stefank
parents:
18069
diff
changeset
|
1371 |
|
1 | 1372 |
#endif |