hotspot/src/share/vm/oops/instanceKlass.cpp
changeset 47103 a993ec29ec75
parent 46968 9119841280f4
equal deleted inserted replaced
47098:e704f55561c3 47103:a993ec29ec75
   745       const char* className = external_name();
   745       const char* className = external_name();
   746       size_t msglen = strlen(desc) + strlen(className) + 1;
   746       size_t msglen = strlen(desc) + strlen(className) + 1;
   747       char* message = NEW_RESOURCE_ARRAY(char, msglen);
   747       char* message = NEW_RESOURCE_ARRAY(char, msglen);
   748       if (NULL == message) {
   748       if (NULL == message) {
   749         // Out of memory: can't create detailed error message
   749         // Out of memory: can't create detailed error message
   750         THROW_MSG(vmSymbols::java_lang_NoClassDefFoundError(), className);
   750           THROW_MSG(vmSymbols::java_lang_NoClassDefFoundError(), className);
   751       } else {
   751       } else {
   752         jio_snprintf(message, msglen, "%s%s", desc, className);
   752         jio_snprintf(message, msglen, "%s%s", desc, className);
   753         THROW_MSG(vmSymbols::java_lang_NoClassDefFoundError(), message);
   753           THROW_MSG(vmSymbols::java_lang_NoClassDefFoundError(), message);
   754       }
   754       }
   755     }
   755     }
   756 
   756 
   757     // Step 6
   757     // Step 6
   758     set_init_state(being_initialized);
   758     set_init_state(being_initialized);
  2065   for (int i = 0; i < methods()->length(); i++) {
  2065   for (int i = 0; i < methods()->length(); i++) {
  2066     Method* m = methods()->at(i);
  2066     Method* m = methods()->at(i);
  2067     m->remove_unshareable_info();
  2067     m->remove_unshareable_info();
  2068   }
  2068   }
  2069 
  2069 
       
  2070   // do array classes also.
       
  2071   if (array_klasses() != NULL) {
       
  2072     array_klasses()->remove_unshareable_info();
       
  2073   }
       
  2074 
  2070   // These are not allocated from metaspace, but they should should all be empty
  2075   // These are not allocated from metaspace, but they should should all be empty
  2071   // during dump time, so we don't need to worry about them in InstanceKlass::metaspace_pointers_do().
  2076   // during dump time, so we don't need to worry about them in InstanceKlass::iterate().
  2072   guarantee(_source_debug_extension == NULL, "must be");
  2077   guarantee(_source_debug_extension == NULL, "must be");
  2073   guarantee(_oop_map_cache == NULL, "must be");
       
  2074   guarantee(_init_thread == NULL, "must be");
       
  2075   guarantee(_oop_map_cache == NULL, "must be");
       
  2076   guarantee(_jni_ids == NULL, "must be");
       
  2077   guarantee(_methods_jmethod_ids == NULL, "must be");
       
  2078   guarantee(_dep_context == DependencyContext::EMPTY, "must be");
  2078   guarantee(_dep_context == DependencyContext::EMPTY, "must be");
  2079   guarantee(_osr_nmethods_head == NULL, "must be");
  2079   guarantee(_osr_nmethods_head == NULL, "must be");
  2080 
  2080 
  2081 #if INCLUDE_JVMTI
  2081 #if INCLUDE_JVMTI
  2082   guarantee(_breakpoints == NULL, "must be");
  2082   guarantee(_breakpoints == NULL, "must be");
  2083   guarantee(_previous_versions == NULL, "must be");
  2083   guarantee(_previous_versions == NULL, "must be");
  2084 #endif
  2084 #endif
  2085 }
  2085 
  2086 
  2086  _init_thread = NULL;
  2087 static void restore_unshareable_in_class(Klass* k, TRAPS) {
  2087  _methods_jmethod_ids = NULL;
  2088   // Array classes have null protection domain.
  2088  _jni_ids = NULL;
  2089   // --> see ArrayKlass::complete_create_array_klass()
  2089  _oop_map_cache = NULL;
  2090   k->restore_unshareable_info(ClassLoaderData::the_null_class_loader_data(), Handle(), CHECK);
  2090 }
       
  2091 
       
  2092 void InstanceKlass::remove_java_mirror() {
       
  2093   Klass::remove_java_mirror();
       
  2094 
       
  2095   // do array classes also.
       
  2096   if (array_klasses() != NULL) {
       
  2097     array_klasses()->remove_java_mirror();
       
  2098   }
  2091 }
  2099 }
  2092 
  2100 
  2093 void InstanceKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) {
  2101 void InstanceKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) {
  2094   set_package(loader_data, CHECK);
  2102   set_package(loader_data, CHECK);
  2095   Klass::restore_unshareable_info(loader_data, protection_domain, CHECK);
  2103   Klass::restore_unshareable_info(loader_data, protection_domain, CHECK);
  2112   }
  2120   }
  2113 
  2121 
  2114   // restore constant pool resolved references
  2122   // restore constant pool resolved references
  2115   constants()->restore_unshareable_info(CHECK);
  2123   constants()->restore_unshareable_info(CHECK);
  2116 
  2124 
  2117   array_klasses_do(restore_unshareable_in_class, CHECK);
  2125   if (array_klasses() != NULL) {
       
  2126     // Array classes have null protection domain.
       
  2127     // --> see ArrayKlass::complete_create_array_klass()
       
  2128     array_klasses()->restore_unshareable_info(ClassLoaderData::the_null_class_loader_data(), Handle(), CHECK);
       
  2129   }
  2118 }
  2130 }
  2119 
  2131 
  2120 // returns true IFF is_in_error_state() has been changed as a result of this call.
  2132 // returns true IFF is_in_error_state() has been changed as a result of this call.
  2121 bool InstanceKlass::check_sharing_error_state() {
  2133 bool InstanceKlass::check_sharing_error_state() {
  2122   assert(DumpSharedSpaces, "should only be called during dumping");
  2134   assert(DumpSharedSpaces, "should only be called during dumping");