src/hotspot/share/classfile/systemDictionary.cpp
changeset 49348 fde3feaaa4ed
parent 49340 4e82736053ae
child 49352 0b48f0aa79ec
equal deleted inserted replaced
49347:edb65305d3ac 49348:fde3feaaa4ed
   148   _java_platform_loader = (oop)result.get_jobject();
   148   _java_platform_loader = (oop)result.get_jobject();
   149 
   149 
   150   CDS_ONLY(SystemDictionaryShared::initialize(CHECK);)
   150   CDS_ONLY(SystemDictionaryShared::initialize(CHECK);)
   151 }
   151 }
   152 
   152 
   153 ClassLoaderData* SystemDictionary::register_loader(Handle class_loader, TRAPS) {
   153 ClassLoaderData* SystemDictionary::register_loader(Handle class_loader) {
   154   if (class_loader() == NULL) return ClassLoaderData::the_null_class_loader_data();
   154   if (class_loader() == NULL) return ClassLoaderData::the_null_class_loader_data();
   155   return ClassLoaderDataGraph::find_or_create(class_loader, THREAD);
   155   return ClassLoaderDataGraph::find_or_create(class_loader);
   156 }
   156 }
   157 
   157 
   158 // ----------------------------------------------------------------------------
   158 // ----------------------------------------------------------------------------
   159 // Parallel class loading check
   159 // Parallel class loading check
   160 
   160 
   662 
   662 
   663   HandleMark hm(THREAD);
   663   HandleMark hm(THREAD);
   664 
   664 
   665   // Fix for 4474172; see evaluation for more details
   665   // Fix for 4474172; see evaluation for more details
   666   class_loader = Handle(THREAD, java_lang_ClassLoader::non_reflection_class_loader(class_loader()));
   666   class_loader = Handle(THREAD, java_lang_ClassLoader::non_reflection_class_loader(class_loader()));
   667   ClassLoaderData *loader_data = register_loader(class_loader, CHECK_NULL);
   667   ClassLoaderData* loader_data = register_loader(class_loader);
   668   Dictionary* dictionary = loader_data->dictionary();
   668   Dictionary* dictionary = loader_data->dictionary();
   669   unsigned int d_hash = dictionary->compute_hash(name);
   669   unsigned int d_hash = dictionary->compute_hash(name);
   670 
   670 
   671   // Do lookup to see if class already exist and the protection domain
   671   // Do lookup to see if class already exist and the protection domain
   672   // has the right access
   672   // has the right access
   987   ClassLoaderData* loader_data;
   987   ClassLoaderData* loader_data;
   988   if (host_klass != NULL) {
   988   if (host_klass != NULL) {
   989     // Create a new CLD for anonymous class, that uses the same class loader
   989     // Create a new CLD for anonymous class, that uses the same class loader
   990     // as the host_klass
   990     // as the host_klass
   991     guarantee(host_klass->class_loader() == class_loader(), "should be the same");
   991     guarantee(host_klass->class_loader() == class_loader(), "should be the same");
   992     loader_data = ClassLoaderData::anonymous_class_loader_data(class_loader(), CHECK_NULL);
   992     loader_data = ClassLoaderData::anonymous_class_loader_data(class_loader);
   993   } else {
   993   } else {
   994     loader_data = ClassLoaderData::class_loader_data(class_loader());
   994     loader_data = ClassLoaderData::class_loader_data(class_loader());
   995   }
   995   }
   996 
   996 
   997   assert(st != NULL, "invariant");
   997   assert(st != NULL, "invariant");
  1065   bool DoObjectLock = true;
  1065   bool DoObjectLock = true;
  1066   if (is_parallelCapable(class_loader)) {
  1066   if (is_parallelCapable(class_loader)) {
  1067     DoObjectLock = false;
  1067     DoObjectLock = false;
  1068   }
  1068   }
  1069 
  1069 
  1070   ClassLoaderData* loader_data = register_loader(class_loader, CHECK_NULL);
  1070   ClassLoaderData* loader_data = register_loader(class_loader);
  1071 
  1071 
  1072   // Make sure we are synchronized on the class loader before we proceed
  1072   // Make sure we are synchronized on the class loader before we proceed
  1073   Handle lockObject = compute_loader_lock_object(class_loader, THREAD);
  1073   Handle lockObject = compute_loader_lock_object(class_loader, THREAD);
  1074   check_loader_lock_contention(lockObject, THREAD);
  1074   check_loader_lock_contention(lockObject, THREAD);
  1075   ObjectLocker ol(lockObject, THREAD, DoObjectLock);
  1075   ObjectLocker ol(lockObject, THREAD, DoObjectLock);
  2503         tty->cr();
  2503         tty->cr();
  2504     #endif //PRODUCT
  2504     #endif //PRODUCT
  2505       }
  2505       }
  2506       (*appendix_result) = Handle(THREAD, appendix);
  2506       (*appendix_result) = Handle(THREAD, appendix);
  2507       // the target is stored in the cpCache and if a reference to this
  2507       // the target is stored in the cpCache and if a reference to this
  2508       // MethodName is dropped we need a way to make sure the
  2508       // MemberName is dropped we need a way to make sure the
  2509       // class_loader containing this method is kept alive.
  2509       // class_loader containing this method is kept alive.
  2510       // FIXME: the appendix might also preserve this dependency.
       
  2511       ClassLoaderData* this_key = accessing_klass->class_loader_data();
  2510       ClassLoaderData* this_key = accessing_klass->class_loader_data();
  2512       this_key->record_dependency(m->method_holder(), CHECK_NULL); // Can throw OOM
  2511       this_key->record_dependency(m->method_holder());
  2513       return methodHandle(THREAD, m);
  2512       return methodHandle(THREAD, m);
  2514     }
  2513     }
  2515   }
  2514   }
  2516   THROW_MSG_(vmSymbols::java_lang_LinkageError(), "bad value from MethodHandleNatives", empty);
  2515   THROW_MSG_(vmSymbols::java_lang_LinkageError(), "bad value from MethodHandleNatives", empty);
  2517   return empty;
  2516   return empty;