< prev index next >

src/hotspot/share/classfile/systemDictionary.cpp

Print this page

        

*** 66,75 **** --- 66,76 ---- #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" #include "oops/symbol.hpp" #include "oops/typeArrayKlass.hpp" #include "prims/jvmtiExport.hpp" + #include "prims/resolvedMethodTable.hpp" #include "prims/methodHandles.hpp" #include "runtime/arguments.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/fieldType.hpp" #include "runtime/handles.inline.hpp"
*** 989,1016 **** return k; } // Note: this method is much like resolve_from_stream, but // does not publish the classes via the SystemDictionary. ! // Handles unsafe_DefineAnonymousClass and redefineclasses ! // RedefinedClasses do not add to the class hierarchy InstanceKlass* SystemDictionary::parse_stream(Symbol* class_name, Handle class_loader, Handle protection_domain, ClassFileStream* st, const InstanceKlass* unsafe_anonymous_host, GrowableArray<Handle>* cp_patches, TRAPS) { EventClassLoad class_load_start_event; ClassLoaderData* loader_data; if (unsafe_anonymous_host != NULL) { ! // Create a new CLD for an unsafe anonymous class, that uses the same class loader ! // as the unsafe_anonymous_host guarantee(oopDesc::equals(unsafe_anonymous_host->class_loader(), class_loader()), "should be the same"); ! loader_data = ClassLoaderData::unsafe_anonymous_class_loader_data(class_loader); } else { loader_data = ClassLoaderData::class_loader_data(class_loader()); } assert(st != NULL, "invariant"); --- 990,1033 ---- return k; } // Note: this method is much like resolve_from_stream, but // does not publish the classes via the SystemDictionary. ! // Handles Lookup.defineClass nonfindable, unsafe_DefineAnonymousClass ! // and redefineclasses. RedefinedClasses do not add to the class hierarchy. InstanceKlass* SystemDictionary::parse_stream(Symbol* class_name, Handle class_loader, Handle protection_domain, ClassFileStream* st, const InstanceKlass* unsafe_anonymous_host, GrowableArray<Handle>* cp_patches, + const bool is_nonfindable, + const bool is_weaknonfindable, + const bool can_access_vm_annotations, + InstanceKlass* dynamic_nest_host, + Handle classData, TRAPS) { EventClassLoad class_load_start_event; ClassLoaderData* loader_data; + if (unsafe_anonymous_host != NULL) { ! // - for unsafe anonymous class: create a new short-lived CLD that uses the same ! // class loader as the unsafe_anonymous_host. guarantee(oopDesc::equals(unsafe_anonymous_host->class_loader(), class_loader()), "should be the same"); ! loader_data = ClassLoaderData::shortlived_class_loader_data(class_loader); ! } else if (is_nonfindable) { ! // - for weak nonfindable class: create a new short-lived CLD whose loader is ! // the Lookup class' loader. ! // - for nonfindable class: add the class to the Lookup class' loader's CLD. ! if (is_weaknonfindable) { ! loader_data = ClassLoaderData::shortlived_class_loader_data(class_loader); ! } else { ! // This nonfindable class goes into the regular CLD pool for this loader. ! loader_data = register_loader(class_loader); ! } } else { loader_data = ClassLoaderData::class_loader_data(class_loader()); } assert(st != NULL, "invariant");
*** 1025,1040 **** class_name, loader_data, protection_domain, unsafe_anonymous_host, cp_patches, CHECK_NULL); ! if (unsafe_anonymous_host != NULL && k != NULL) { ! // Unsafe anonymous classes must update ClassLoaderData holder (was unsafe_anonymous_host loader) // so that they can be unloaded when the mirror is no longer referenced. ! k->class_loader_data()->initialize_holder(Handle(THREAD, k->java_mirror())); { MutexLocker mu_r(Compile_lock, THREAD); // Add to class hierarchy, initialize vtables, and do possible --- 1042,1063 ---- class_name, loader_data, protection_domain, unsafe_anonymous_host, cp_patches, + is_nonfindable, + can_access_vm_annotations, + dynamic_nest_host, + classData, CHECK_NULL); ! if ((is_nonfindable || (unsafe_anonymous_host != NULL)) && k != NULL) { ! // Weak nonfindable and unsafe anonymous classes must update ClassLoaderData holder // so that they can be unloaded when the mirror is no longer referenced. ! if (is_weaknonfindable || (unsafe_anonymous_host != NULL)) { ! k->class_loader_data()->initialize_holder(Handle(THREAD, k->java_mirror())); ! } { MutexLocker mu_r(Compile_lock, THREAD); // Add to class hierarchy, initialize vtables, and do possible
*** 1051,1061 **** k->link_class(CHECK_NULL); if (cp_patches != NULL) { k->constants()->patch_resolved_references(cp_patches); } ! // If it's anonymous, initialize it now, since nobody else will. k->eager_initialize(CHECK_NULL); // notify jvmti if (JvmtiExport::should_post_class_load()) { assert(THREAD->is_Java_thread(), "thread->is_Java_thread()"); --- 1074,1085 ---- k->link_class(CHECK_NULL); if (cp_patches != NULL) { k->constants()->patch_resolved_references(cp_patches); } ! // Initialize it now, since nobody else will. ! // FIXME: why must we eager initialize? It should be initialized upon use. k->eager_initialize(CHECK_NULL); // notify jvmti if (JvmtiExport::should_post_class_load()) { assert(THREAD->is_Java_thread(), "thread->is_Java_thread()");
*** 1078,1087 **** --- 1102,1112 ---- InstanceKlass* SystemDictionary::resolve_from_stream(Symbol* class_name, Handle class_loader, Handle protection_domain, ClassFileStream* st, + InstanceKlass* dynamic_nest_host, TRAPS) { HandleMark hm(THREAD); // Classloaders that support parallelism, e.g. bootstrap classloader,
*** 1122,1133 **** } k = KlassFactory::create_from_stream(st, class_name, loader_data, protection_domain, ! NULL, // unsafe_anonymous_host ! NULL, // cp_patches CHECK_NULL); } assert(k != NULL, "no klass created"); Symbol* h_name = k->name(); --- 1147,1162 ---- } k = KlassFactory::create_from_stream(st, class_name, loader_data, protection_domain, ! NULL, // unsafe_anonymous_host ! NULL, // cp_patches ! false, // is_nonfindable ! false, // can_access_vm_annotations ! dynamic_nest_host, ! Handle(), // classData CHECK_NULL); } assert(k != NULL, "no klass created"); Symbol* h_name = k->name();
*** 1833,1842 **** --- 1862,1873 ---- resolution_errors()->purge_resolution_errors(); } } GCTraceTime(Debug, gc, phases) t("Trigger cleanups", gc_timer); + // Trigger cleaning the ResolvedMethodTable even if no unloading occurred. + ResolvedMethodTable::trigger_cleanup(); if (unloading_occurred) { SymbolTable::trigger_cleanup(); // Oops referenced by the protection domain cache table may get unreachable independently
< prev index next >