src/hotspot/share/oops/instanceKlass.cpp
changeset 54927 1512d88b24c6
parent 54847 59ea39bb2809
child 55254 36cb654a690f
child 58678 9cf78a70fa4f
equal deleted inserted replaced
54926:d4e7ccaf1445 54927:1512d88b24c6
   449 
   449 
   450   assert(NULL == _methods, "underlying memory not zeroed?");
   450   assert(NULL == _methods, "underlying memory not zeroed?");
   451   assert(is_instance_klass(), "is layout incorrect?");
   451   assert(is_instance_klass(), "is layout incorrect?");
   452   assert(size_helper() == parser.layout_size(), "incorrect size_helper?");
   452   assert(size_helper() == parser.layout_size(), "incorrect size_helper?");
   453 
   453 
   454   if (DumpSharedSpaces) {
   454   if (DumpSharedSpaces || DynamicDumpSharedSpaces) {
   455     SystemDictionaryShared::init_dumptime_info(this);
   455     SystemDictionaryShared::init_dumptime_info(this);
   456   }
   456   }
   457 }
   457 }
   458 
   458 
   459 void InstanceKlass::deallocate_methods(ClassLoaderData* loader_data,
   459 void InstanceKlass::deallocate_methods(ClassLoaderData* loader_data,
   599   if (annotations() != NULL && !annotations()->is_shared()) {
   599   if (annotations() != NULL && !annotations()->is_shared()) {
   600     MetadataFactory::free_metadata(loader_data, annotations());
   600     MetadataFactory::free_metadata(loader_data, annotations());
   601   }
   601   }
   602   set_annotations(NULL);
   602   set_annotations(NULL);
   603 
   603 
   604   if (DumpSharedSpaces) {
   604   if (DumpSharedSpaces || DynamicDumpSharedSpaces) {
   605     SystemDictionaryShared::remove_dumptime_info(this);
   605     SystemDictionaryShared::remove_dumptime_info(this);
   606   }
   606   }
   607 }
   607 }
   608 
   608 
   609 bool InstanceKlass::should_be_initialized() const {
   609 bool InstanceKlass::should_be_initialized() const {
  2223   // We store the fingerprint into the InstanceKlass only in the following 2 cases:
  2223   // We store the fingerprint into the InstanceKlass only in the following 2 cases:
  2224   if (CalculateClassFingerprint) {
  2224   if (CalculateClassFingerprint) {
  2225     // (1) We are running AOT to generate a shared library.
  2225     // (1) We are running AOT to generate a shared library.
  2226     return true;
  2226     return true;
  2227   }
  2227   }
  2228   if (DumpSharedSpaces) {
  2228   if (DumpSharedSpaces || DynamicDumpSharedSpaces) {
  2229     // (2) We are running -Xshare:dump to create a shared archive
  2229     // (2) We are running -Xshare:dump or -XX:ArchiveClassesAtExit to create a shared archive
  2230     return true;
  2230     return true;
  2231   }
  2231   }
  2232   if (UseAOT && is_unsafe_anonymous) {
  2232   if (UseAOT && is_unsafe_anonymous) {
  2233     // (3) We are using AOT code from a shared library and see an unsafe anonymous class
  2233     // (3) We are using AOT code from a shared library and see an unsafe anonymous class
  2234     return true;
  2234     return true;
  2344   // do array classes also.
  2344   // do array classes also.
  2345   if (array_klasses() != NULL) {
  2345   if (array_klasses() != NULL) {
  2346     array_klasses()->remove_unshareable_info();
  2346     array_klasses()->remove_unshareable_info();
  2347   }
  2347   }
  2348 
  2348 
  2349   // These are not allocated from metaspace, but they should should all be empty
  2349   // These are not allocated from metaspace. They are safe to set to NULL.
  2350   // during dump time, so we don't need to worry about them in InstanceKlass::iterate().
  2350   _source_debug_extension = NULL;
  2351   guarantee(_source_debug_extension == NULL, "must be");
  2351   _dep_context = NULL;
  2352   guarantee(_dep_context == NULL, "must be");
  2352   _osr_nmethods_head = NULL;
  2353   guarantee(_osr_nmethods_head == NULL, "must be");
       
  2354 
       
  2355 #if INCLUDE_JVMTI
  2353 #if INCLUDE_JVMTI
  2356   guarantee(_breakpoints == NULL, "must be");
  2354   _breakpoints = NULL;
  2357   guarantee(_previous_versions == NULL, "must be");
  2355   _previous_versions = NULL;
  2358   _cached_class_file = NULL;
  2356   _cached_class_file = NULL;
  2359 #endif
  2357 #endif
  2360 
  2358 
  2361   _init_thread = NULL;
  2359   _init_thread = NULL;
  2362   _methods_jmethod_ids = NULL;
  2360   _methods_jmethod_ids = NULL;
  2472     JvmtiExport::post_class_unload(ik);
  2470     JvmtiExport::post_class_unload(ik);
  2473   }
  2471   }
  2474 
  2472 
  2475   // notify ClassLoadingService of class unload
  2473   // notify ClassLoadingService of class unload
  2476   ClassLoadingService::notify_class_unloaded(ik);
  2474   ClassLoadingService::notify_class_unloaded(ik);
       
  2475 
       
  2476   if (DumpSharedSpaces || DynamicDumpSharedSpaces) {
       
  2477     SystemDictionaryShared::remove_dumptime_info(ik);
       
  2478   }
  2477 
  2479 
  2478   if (log_is_enabled(Info, class, unload)) {
  2480   if (log_is_enabled(Info, class, unload)) {
  2479     ResourceMark rm;
  2481     ResourceMark rm;
  2480     log_info(class, unload)("unloading class %s " INTPTR_FORMAT, ik->external_name(), p2i(ik));
  2482     log_info(class, unload)("unloading class %s " INTPTR_FORMAT, ik->external_name(), p2i(ik));
  2481   }
  2483   }
  3420     } else {
  3422     } else {
  3421       oop class_loader = loader_data->class_loader();
  3423       oop class_loader = loader_data->class_loader();
  3422       info_stream.print(" source: %s", class_loader->klass()->external_name());
  3424       info_stream.print(" source: %s", class_loader->klass()->external_name());
  3423     }
  3425     }
  3424   } else {
  3426   } else {
  3425     info_stream.print(" source: shared objects file");
  3427     assert(this->is_shared(), "must be");
       
  3428     if (MetaspaceShared::is_shared_dynamic((void*)this)) {
       
  3429       info_stream.print(" source: shared objects file (top)");
       
  3430     } else {
       
  3431       info_stream.print(" source: shared objects file");
       
  3432     }
  3426   }
  3433   }
  3427 
  3434 
  3428   msg.info("%s", info_stream.as_string());
  3435   msg.info("%s", info_stream.as_string());
  3429 
  3436 
  3430   if (log_is_enabled(Debug, class, load)) {
  3437   if (log_is_enabled(Debug, class, load)) {