354 assert(is_constantPool(), "ensure C++ vtable is restored");
355 assert(on_stack(), "should always be set for shared constant pools");
356 assert(is_shared(), "should always be set for shared constant pools");
357 assert(_cache != NULL, "constant pool _cache should not be NULL");
358
359 // Only create the new resolved references array if it hasn't been attempted before
360 if (resolved_references() != NULL) return;
361
362 // restore the C++ vtable from the shared archive
363 restore_vtable();
364
365 if (SystemDictionary::Object_klass_loaded()) {
366 ClassLoaderData* loader_data = pool_holder()->class_loader_data();
367 #if INCLUDE_CDS_JAVA_HEAP
368 if (HeapShared::open_archive_heap_region_mapped() &&
369 _cache->archived_references() != NULL) {
370 oop archived = _cache->archived_references();
371 // Create handle for the archived resolved reference array object
372 Handle refs_handle(THREAD, archived);
373 set_resolved_references(loader_data->add_handle(refs_handle));
374 } else
375 #endif
376 {
377 // No mapped archived resolved reference array
378 // Recreate the object array and add to ClassLoaderData.
379 int map_length = resolved_reference_length();
380 if (map_length > 0) {
381 objArrayOop stom = oopFactory::new_objArray(SystemDictionary::Object_klass(), map_length, CHECK);
382 Handle refs_handle(THREAD, (oop)stom); // must handleize.
383 set_resolved_references(loader_data->add_handle(refs_handle));
384 }
385 }
386 }
387 }
388
389 void ConstantPool::remove_unshareable_info() {
390 // Resolved references are not in the shared archive.
391 // Save the length for restoration. It is not necessarily the same length
392 // as reference_map.length() if invokedynamic is saved. It is needed when
393 // re-creating the resolved reference array if archived heap data cannot be map
|
354 assert(is_constantPool(), "ensure C++ vtable is restored");
355 assert(on_stack(), "should always be set for shared constant pools");
356 assert(is_shared(), "should always be set for shared constant pools");
357 assert(_cache != NULL, "constant pool _cache should not be NULL");
358
359 // Only create the new resolved references array if it hasn't been attempted before
360 if (resolved_references() != NULL) return;
361
362 // restore the C++ vtable from the shared archive
363 restore_vtable();
364
365 if (SystemDictionary::Object_klass_loaded()) {
366 ClassLoaderData* loader_data = pool_holder()->class_loader_data();
367 #if INCLUDE_CDS_JAVA_HEAP
368 if (HeapShared::open_archive_heap_region_mapped() &&
369 _cache->archived_references() != NULL) {
370 oop archived = _cache->archived_references();
371 // Create handle for the archived resolved reference array object
372 Handle refs_handle(THREAD, archived);
373 set_resolved_references(loader_data->add_handle(refs_handle));
374 _cache->clear_archived_references();
375 } else
376 #endif
377 {
378 // No mapped archived resolved reference array
379 // Recreate the object array and add to ClassLoaderData.
380 int map_length = resolved_reference_length();
381 if (map_length > 0) {
382 objArrayOop stom = oopFactory::new_objArray(SystemDictionary::Object_klass(), map_length, CHECK);
383 Handle refs_handle(THREAD, (oop)stom); // must handleize.
384 set_resolved_references(loader_data->add_handle(refs_handle));
385 }
386 }
387 }
388 }
389
390 void ConstantPool::remove_unshareable_info() {
391 // Resolved references are not in the shared archive.
392 // Save the length for restoration. It is not necessarily the same length
393 // as reference_map.length() if invokedynamic is saved. It is needed when
394 // re-creating the resolved reference array if archived heap data cannot be map
|