0 /*
1 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 *
4 * This code is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 only, as
6 * published by the Free Software Foundation.
7 *
8 * This code is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * version 2 for more details (a copy is included in the LICENSE file that
12 * accompanied this code).
13 *
14 * You should have received a copy of the GNU General Public License version
15 * 2 along with this work; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
|
0 /*
1 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 *
4 * This code is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 only, as
6 * published by the Free Software Foundation.
7 *
8 * This code is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * version 2 for more details (a copy is included in the LICENSE file that
12 * accompanied this code).
13 *
14 * You should have received a copy of the GNU General Public License version
15 * 2 along with this work; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
|
309 }
310 }
311 #endif
312
313 // CDS support. Create a new resolved_references array.
314 void ConstantPool::restore_unshareable_info(TRAPS) {
315 assert(is_constantPool(), "ensure C++ vtable is restored");
316 assert(on_stack(), "should always be set for shared constant pools");
317 assert(is_shared(), "should always be set for shared constant pools");
318 assert(_cache != NULL, "constant pool _cache should not be NULL");
319
320 // Only create the new resolved references array if it hasn't been attempted before
321 if (resolved_references() != NULL) return;
322
323 // restore the C++ vtable from the shared archive
324 restore_vtable();
325
326 if (SystemDictionary::Object_klass_loaded()) {
327 ClassLoaderData* loader_data = pool_holder()->class_loader_data();
328 #if INCLUDE_CDS_JAVA_HEAP
329 if (MetaspaceShared::open_archive_heap_region_mapped()) {
330 oop archived = _cache->archived_references();
331 if (archived != NULL) {
332 // Create handle for the archived resolved reference array object
333 Handle refs_handle(THREAD, archived);
334 set_resolved_references(loader_data->add_handle(refs_handle));
335 }
336 } else
337 #endif
338 {
339 // No mapped archived resolved reference array
340 // Recreate the object array and add to ClassLoaderData.
341 int map_length = resolved_reference_length();
342 if (map_length > 0) {
343 objArrayOop stom = oopFactory::new_objArray(SystemDictionary::Object_klass(), map_length, CHECK);
344 Handle refs_handle(THREAD, (oop)stom); // must handleize.
345 set_resolved_references(loader_data->add_handle(refs_handle));
346 }
347 }
348 }
349 }
350
351 void ConstantPool::remove_unshareable_info() {
352 // Resolved references are not in the shared archive.
353 // Save the length for restoration. It is not necessarily the same length
354 // as reference_map.length() if invokedynamic is saved. It is needed when
|
309 }
310 }
311 #endif
312
313 // CDS support. Create a new resolved_references array.
314 void ConstantPool::restore_unshareable_info(TRAPS) {
315 assert(is_constantPool(), "ensure C++ vtable is restored");
316 assert(on_stack(), "should always be set for shared constant pools");
317 assert(is_shared(), "should always be set for shared constant pools");
318 assert(_cache != NULL, "constant pool _cache should not be NULL");
319
320 // Only create the new resolved references array if it hasn't been attempted before
321 if (resolved_references() != NULL) return;
322
323 // restore the C++ vtable from the shared archive
324 restore_vtable();
325
326 if (SystemDictionary::Object_klass_loaded()) {
327 ClassLoaderData* loader_data = pool_holder()->class_loader_data();
328 #if INCLUDE_CDS_JAVA_HEAP
329 if (MetaspaceShared::open_archive_heap_region_mapped() &&
330 _cache->archived_references() != NULL) {
331 oop archived = _cache->archived_references();
332 // Create handle for the archived resolved reference array object
333 Handle refs_handle(THREAD, archived);
334 set_resolved_references(loader_data->add_handle(refs_handle));
335 } else
336 #endif
337 {
338 // No mapped archived resolved reference array
339 // Recreate the object array and add to ClassLoaderData.
340 int map_length = resolved_reference_length();
341 if (map_length > 0) {
342 objArrayOop stom = oopFactory::new_objArray(SystemDictionary::Object_klass(), map_length, CHECK);
343 Handle refs_handle(THREAD, (oop)stom); // must handleize.
344 set_resolved_references(loader_data->add_handle(refs_handle));
345 }
346 }
347 }
348 }
349
350 void ConstantPool::remove_unshareable_info() {
351 // Resolved references are not in the shared archive.
352 // Save the length for restoration. It is not necessarily the same length
353 // as reference_map.length() if invokedynamic is saved. It is needed when
|