hotspot/src/share/vm/classfile/systemDictionary.cpp
changeset 1550 be2fc37a817f
parent 670 ddf3e9583f2f
child 2020 68d27ca96f33
child 1890 9ce941df84eb
equal deleted inserted replaced
1549:710f8deef989 1550:be2fc37a817f
   935 // TODO consolidate the two methods with a helper routine?
   935 // TODO consolidate the two methods with a helper routine?
   936 klassOop SystemDictionary::parse_stream(symbolHandle class_name,
   936 klassOop SystemDictionary::parse_stream(symbolHandle class_name,
   937                                         Handle class_loader,
   937                                         Handle class_loader,
   938                                         Handle protection_domain,
   938                                         Handle protection_domain,
   939                                         ClassFileStream* st,
   939                                         ClassFileStream* st,
       
   940                                         KlassHandle host_klass,
       
   941                                         GrowableArray<Handle>* cp_patches,
   940                                         TRAPS) {
   942                                         TRAPS) {
   941   symbolHandle parsed_name;
   943   symbolHandle parsed_name;
   942 
   944 
   943   // Parse the stream. Note that we do this even though this klass might
   945   // Parse the stream. Note that we do this even though this klass might
   944   // already be present in the SystemDictionary, otherwise we would not
   946   // already be present in the SystemDictionary, otherwise we would not
   951   //   java.lang.Object through resolve_or_fail, not this path.
   953   //   java.lang.Object through resolve_or_fail, not this path.
   952 
   954 
   953   instanceKlassHandle k = ClassFileParser(st).parseClassFile(class_name,
   955   instanceKlassHandle k = ClassFileParser(st).parseClassFile(class_name,
   954                                                              class_loader,
   956                                                              class_loader,
   955                                                              protection_domain,
   957                                                              protection_domain,
       
   958                                                              cp_patches,
   956                                                              parsed_name,
   959                                                              parsed_name,
   957                                                              THREAD);
   960                                                              THREAD);
   958 
       
   959 
   961 
   960   // We don't redefine the class, so we just need to clean up whether there
   962   // We don't redefine the class, so we just need to clean up whether there
   961   // was an error or not (don't want to modify any system dictionary
   963   // was an error or not (don't want to modify any system dictionary
   962   // data structures).
   964   // data structures).
   963   // Parsed name could be null if we threw an error before we got far
   965   // Parsed name could be null if we threw an error before we got far
   968     int p_index = placeholders()->hash_to_index(p_hash);
   970     int p_index = placeholders()->hash_to_index(p_hash);
   969     {
   971     {
   970     MutexLocker mu(SystemDictionary_lock, THREAD);
   972     MutexLocker mu(SystemDictionary_lock, THREAD);
   971     placeholders()->find_and_remove(p_index, p_hash, parsed_name, class_loader, THREAD);
   973     placeholders()->find_and_remove(p_index, p_hash, parsed_name, class_loader, THREAD);
   972     SystemDictionary_lock->notify_all();
   974     SystemDictionary_lock->notify_all();
       
   975     }
       
   976   }
       
   977 
       
   978   if (host_klass.not_null() && k.not_null()) {
       
   979     assert(AnonymousClasses, "");
       
   980     // If it's anonymous, initialize it now, since nobody else will.
       
   981     k->set_host_klass(host_klass());
       
   982 
       
   983     {
       
   984       MutexLocker mu_r(Compile_lock, THREAD);
       
   985 
       
   986       // Add to class hierarchy, initialize vtables, and do possible
       
   987       // deoptimizations.
       
   988       add_to_hierarchy(k, CHECK_NULL); // No exception, but can block
       
   989 
       
   990       // But, do not add to system dictionary.
       
   991     }
       
   992 
       
   993     k->eager_initialize(THREAD);
       
   994 
       
   995     // notify jvmti
       
   996     if (JvmtiExport::should_post_class_load()) {
       
   997         assert(THREAD->is_Java_thread(), "thread->is_Java_thread()");
       
   998         JvmtiExport::post_class_load((JavaThread *) THREAD, k());
   973     }
   999     }
   974   }
  1000   }
   975 
  1001 
   976   return k();
  1002   return k();
   977 }
  1003 }