src/share/vm/classfile/systemDictionary.cpp

Print this page
rev 3 : [mq]: anonk.patch

*** 932,941 **** --- 932,943 ---- // TODO consolidate the two methods with a helper routine? klassOop SystemDictionary::parse_stream(symbolHandle class_name, Handle class_loader, Handle protection_domain, ClassFileStream* st, + KlassHandle host_klass, + GrowableArray<Handle>* cp_patches, TRAPS) { symbolHandle parsed_name; // Parse the stream. Note that we do this even though this klass might // already be present in the SystemDictionary, otherwise we would not
*** 948,961 **** // java.lang.Object through resolve_or_fail, not this path. instanceKlassHandle k = ClassFileParser(st).parseClassFile(class_name, class_loader, protection_domain, parsed_name, THREAD); - // We don't redefine the class, so we just need to clean up whether there // was an error or not (don't want to modify any system dictionary // data structures). // Parsed name could be null if we threw an error before we got far // enough along to parse it -- in that case, there is nothing to clean up. --- 950,963 ---- // java.lang.Object through resolve_or_fail, not this path. instanceKlassHandle k = ClassFileParser(st).parseClassFile(class_name, class_loader, protection_domain, + cp_patches, parsed_name, THREAD); // We don't redefine the class, so we just need to clean up whether there // was an error or not (don't want to modify any system dictionary // data structures). // Parsed name could be null if we threw an error before we got far // enough along to parse it -- in that case, there is nothing to clean up.
*** 967,976 **** --- 969,1001 ---- MutexLocker mu(SystemDictionary_lock, THREAD); placeholders()->find_and_remove(p_index, p_hash, parsed_name, class_loader, THREAD); SystemDictionary_lock->notify_all(); } } + + if (host_klass.not_null() && k.not_null()) { + // If it's anonymous, initialize it now, since nobody else will. + k->set_host_klass(host_klass()); + + { + MutexLocker mu_r(Compile_lock, THREAD); + + // Add to class hierarchy, initialize vtables, and do possible + // deoptimizations. + add_to_hierarchy(k, CHECK_NULL); // No exception, but can block + + // But, do not add to system dictionary. + } + + k->eager_initialize(THREAD); + + // notify jvmti + if (JvmtiExport::should_post_class_load()) { + assert(THREAD->is_Java_thread(), "thread->is_Java_thread()"); + JvmtiExport::post_class_load((JavaThread *) THREAD, k()); + } + } return k(); } // Add a klass to the system from a stream (called by jni_DefineClass and