1 /* |
1 /* |
2 * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
250 // Return true if given address is in the mapped shared space. |
250 // Return true if given address is in the mapped shared space. |
251 bool is_in_shared_space(const void* p) NOT_CDS_RETURN_(false); |
251 bool is_in_shared_space(const void* p) NOT_CDS_RETURN_(false); |
252 bool is_in_shared_region(const void* p, int idx) NOT_CDS_RETURN_(false); |
252 bool is_in_shared_region(const void* p, int idx) NOT_CDS_RETURN_(false); |
253 void print_shared_spaces() NOT_CDS_RETURN; |
253 void print_shared_spaces() NOT_CDS_RETURN; |
254 |
254 |
|
255 // The ro+rw+md+mc spaces size |
|
256 static size_t core_spaces_size() { |
|
257 return align_size_up((SharedReadOnlySize + SharedReadWriteSize + |
|
258 SharedMiscDataSize + SharedMiscCodeSize), |
|
259 os::vm_allocation_granularity()); |
|
260 } |
|
261 |
|
262 // The estimated optional space size. |
|
263 // |
|
264 // Currently the optional space only has archived class bytes. |
|
265 // The core_spaces_size is the size of all class metadata, which is a good |
|
266 // estimate of the total class bytes to be archived. Only the portion |
|
267 // containing data is written out to the archive and mapped at runtime. |
|
268 // There is no memory waste due to unused portion in optional space. |
|
269 static size_t optional_space_size() { |
|
270 return core_spaces_size(); |
|
271 } |
|
272 |
|
273 // Total shared_spaces size includes the ro, rw, md, mc and od spaces |
255 static size_t shared_spaces_size() { |
274 static size_t shared_spaces_size() { |
256 return align_size_up(SharedReadOnlySize + SharedReadWriteSize + |
275 return core_spaces_size() + optional_space_size(); |
257 SharedMiscDataSize + SharedMiscCodeSize, |
|
258 os::vm_allocation_granularity()); |
|
259 } |
276 } |
260 |
277 |
261 // Stop CDS sharing and unmap CDS regions. |
278 // Stop CDS sharing and unmap CDS regions. |
262 static void stop_sharing_and_unmap(const char* msg); |
279 static void stop_sharing_and_unmap(const char* msg); |
263 |
280 |