1 /*
2 * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
147 return _core_spaces_size;
148 }
149 static void initialize_dumptime_shared_and_meta_spaces() NOT_CDS_RETURN;
150 static void initialize_runtime_shared_and_meta_spaces() NOT_CDS_RETURN;
151
152 // Delta of this object from the bottom of the archive.
153 static uintx object_delta(void* obj) {
154 assert(DumpSharedSpaces, "supported only for dumping");
155 assert(shared_rs()->contains(obj), "must be");
156 address base_address = address(shared_rs()->base());
157 uintx delta = address(obj) - base_address;
158 return delta;
159 }
160
161 static void set_archive_loading_failed() {
162 _archive_loading_failed = true;
163 }
164 static bool map_shared_spaces(FileMapInfo* mapinfo) NOT_CDS_RETURN_(false);
165 static void initialize_shared_spaces() NOT_CDS_RETURN;
166
167 // Return true if given address is in the mapped shared space.
168 static bool is_in_shared_space(const void* p) NOT_CDS_RETURN_(false);
169
170 // Return true if given address is in the shared region corresponding to the idx
171 static bool is_in_shared_region(const void* p, int idx) NOT_CDS_RETURN_(false);
172
173 static bool is_heap_region(int idx) {
174 CDS_JAVA_HEAP_ONLY(return (idx >= MetaspaceShared::first_string &&
175 idx < MetaspaceShared::first_open_archive_heap_region +
176 MetaspaceShared::max_open_archive_heap_region));
177 NOT_CDS_JAVA_HEAP_RETURN_(false);
178 }
179 static bool is_string_region(int idx) {
180 CDS_JAVA_HEAP_ONLY(return (idx >= MetaspaceShared::first_string &&
181 idx < MetaspaceShared::first_string + MetaspaceShared::max_strings));
182 NOT_CDS_JAVA_HEAP_RETURN_(false);
183 }
184 static bool is_open_archive_heap_region(int idx) {
185 CDS_JAVA_HEAP_ONLY(return (idx >= MetaspaceShared::first_open_archive_heap_region &&
186 idx < MetaspaceShared::first_open_archive_heap_region +
187 MetaspaceShared::max_open_archive_heap_region));
188 NOT_CDS_JAVA_HEAP_RETURN_(false);
|
1 /*
2 * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
147 return _core_spaces_size;
148 }
149 static void initialize_dumptime_shared_and_meta_spaces() NOT_CDS_RETURN;
150 static void initialize_runtime_shared_and_meta_spaces() NOT_CDS_RETURN;
151
152 // Delta of this object from the bottom of the archive.
153 static uintx object_delta(void* obj) {
154 assert(DumpSharedSpaces, "supported only for dumping");
155 assert(shared_rs()->contains(obj), "must be");
156 address base_address = address(shared_rs()->base());
157 uintx delta = address(obj) - base_address;
158 return delta;
159 }
160
161 static void set_archive_loading_failed() {
162 _archive_loading_failed = true;
163 }
164 static bool map_shared_spaces(FileMapInfo* mapinfo) NOT_CDS_RETURN_(false);
165 static void initialize_shared_spaces() NOT_CDS_RETURN;
166
167 // Return true if given address is in the shared metaspace regions (i.e., excluding any
168 // mapped shared heap regions.)
169 static bool is_in_shared_metaspace(const void* p) {
170 // If no shared metaspace regions are mapped, MetaspceObj::_shared_metaspace_{base,top} will
171 // both be NULL and all values of p will be rejected quickly.
172 return (p < MetaspaceObj::_shared_metaspace_top && p >= MetaspaceObj::_shared_metaspace_base);
173 }
174
175 // Return true if given address is in the shared region corresponding to the idx
176 static bool is_in_shared_region(const void* p, int idx) NOT_CDS_RETURN_(false);
177
178 static bool is_heap_region(int idx) {
179 CDS_JAVA_HEAP_ONLY(return (idx >= MetaspaceShared::first_string &&
180 idx < MetaspaceShared::first_open_archive_heap_region +
181 MetaspaceShared::max_open_archive_heap_region));
182 NOT_CDS_JAVA_HEAP_RETURN_(false);
183 }
184 static bool is_string_region(int idx) {
185 CDS_JAVA_HEAP_ONLY(return (idx >= MetaspaceShared::first_string &&
186 idx < MetaspaceShared::first_string + MetaspaceShared::max_strings));
187 NOT_CDS_JAVA_HEAP_RETURN_(false);
188 }
189 static bool is_open_archive_heap_region(int idx) {
190 CDS_JAVA_HEAP_ONLY(return (idx >= MetaspaceShared::first_open_archive_heap_region &&
191 idx < MetaspaceShared::first_open_archive_heap_region +
192 MetaspaceShared::max_open_archive_heap_region));
193 NOT_CDS_JAVA_HEAP_RETURN_(false);
|