75 #include "runtime/orderAccess.inline.hpp" |
75 #include "runtime/orderAccess.inline.hpp" |
76 #include "runtime/signature.hpp" |
76 #include "runtime/signature.hpp" |
77 #include "services/classLoadingService.hpp" |
77 #include "services/classLoadingService.hpp" |
78 #include "services/diagnosticCommand.hpp" |
78 #include "services/diagnosticCommand.hpp" |
79 #include "services/threadService.hpp" |
79 #include "services/threadService.hpp" |
80 #include "trace/traceMacros.hpp" |
80 #include "trace/tracing.hpp" |
81 #include "utilities/macros.hpp" |
81 #include "utilities/macros.hpp" |
82 #include "utilities/ticks.hpp" |
|
83 #if INCLUDE_CDS |
82 #if INCLUDE_CDS |
84 #include "classfile/sharedClassUtil.hpp" |
83 #include "classfile/sharedClassUtil.hpp" |
85 #include "classfile/systemDictionaryShared.hpp" |
84 #include "classfile/systemDictionaryShared.hpp" |
86 #endif |
85 #endif |
87 #if INCLUDE_JVMCI |
86 #if INCLUDE_JVMCI |
88 #include "jvmci/jvmciRuntime.hpp" |
87 #include "jvmci/jvmciRuntime.hpp" |
89 #endif |
|
90 #if INCLUDE_TRACE |
|
91 #include "trace/tracing.hpp" |
|
92 #endif |
88 #endif |
93 |
89 |
94 PlaceholderTable* SystemDictionary::_placeholders = NULL; |
90 PlaceholderTable* SystemDictionary::_placeholders = NULL; |
95 Dictionary* SystemDictionary::_shared_dictionary = NULL; |
91 Dictionary* SystemDictionary::_shared_dictionary = NULL; |
96 LoaderConstraintTable* SystemDictionary::_loader_constraints = NULL; |
92 LoaderConstraintTable* SystemDictionary::_loader_constraints = NULL; |
613 } |
609 } |
614 } |
610 } |
615 return NULL; |
611 return NULL; |
616 } |
612 } |
617 |
613 |
618 static void post_class_load_event(const Ticks& start_time, |
614 static void post_class_load_event(EventClassLoad* event, |
619 InstanceKlass* k, |
615 const InstanceKlass* k, |
620 const ClassLoaderData* init_cld) { |
616 const ClassLoaderData* init_cld) { |
621 #if INCLUDE_TRACE |
617 #if INCLUDE_TRACE |
622 EventClassLoad event(UNTIMED); |
618 assert(event != NULL, "invariant"); |
623 if (event.should_commit()) { |
619 assert(k != NULL, "invariant"); |
624 event.set_starttime(start_time); |
620 if (event->should_commit()) { |
625 event.set_loadedClass(k); |
621 event->set_loadedClass(k); |
626 event.set_definingClassLoader(k->class_loader_data()); |
622 event->set_definingClassLoader(k->class_loader_data()); |
627 event.set_initiatingClassLoader(init_cld); |
623 event->set_initiatingClassLoader(init_cld); |
628 event.commit(); |
624 event->commit(); |
629 } |
625 } |
630 #endif // INCLUDE_TRACE |
626 #endif // INCLUDE_TRACE |
631 } |
627 } |
632 |
628 |
633 static void class_define_event(InstanceKlass* k, |
629 static void class_define_event(InstanceKlass* k, |
651 Handle protection_domain, |
647 Handle protection_domain, |
652 TRAPS) { |
648 TRAPS) { |
653 assert(name != NULL && !FieldType::is_array(name) && |
649 assert(name != NULL && !FieldType::is_array(name) && |
654 !FieldType::is_obj(name), "invalid class name"); |
650 !FieldType::is_obj(name), "invalid class name"); |
655 |
651 |
656 Ticks class_load_start_time = Ticks::now(); |
652 EventClassLoad class_load_start_event; |
657 |
653 |
658 HandleMark hm(THREAD); |
654 HandleMark hm(THREAD); |
659 |
655 |
660 // Fix for 4474172; see evaluation for more details |
656 // Fix for 4474172; see evaluation for more details |
661 class_loader = Handle(THREAD, java_lang_ClassLoader::non_reflection_class_loader(class_loader())); |
657 class_loader = Handle(THREAD, java_lang_ClassLoader::non_reflection_class_loader(class_loader())); |
897 |
893 |
898 if (HAS_PENDING_EXCEPTION || k == NULL) { |
894 if (HAS_PENDING_EXCEPTION || k == NULL) { |
899 return NULL; |
895 return NULL; |
900 } |
896 } |
901 |
897 |
902 post_class_load_event(class_load_start_time, k, loader_data); |
898 post_class_load_event(&class_load_start_event, k, loader_data); |
903 |
899 |
904 #ifdef ASSERT |
900 #ifdef ASSERT |
905 { |
901 { |
906 ClassLoaderData* loader_data = k->class_loader_data(); |
902 ClassLoaderData* loader_data = k->class_loader_data(); |
907 MutexLocker mu(SystemDictionary_lock, THREAD); |
903 MutexLocker mu(SystemDictionary_lock, THREAD); |
1004 ClassFileStream* st, |
1000 ClassFileStream* st, |
1005 const InstanceKlass* host_klass, |
1001 const InstanceKlass* host_klass, |
1006 GrowableArray<Handle>* cp_patches, |
1002 GrowableArray<Handle>* cp_patches, |
1007 TRAPS) { |
1003 TRAPS) { |
1008 |
1004 |
1009 Ticks class_load_start_time = Ticks::now(); |
1005 EventClassLoad class_load_start_event; |
1010 |
1006 |
1011 ClassLoaderData* loader_data; |
1007 ClassLoaderData* loader_data; |
1012 if (host_klass != NULL) { |
1008 if (host_klass != NULL) { |
1013 // Create a new CLD for anonymous class, that uses the same class loader |
1009 // Create a new CLD for anonymous class, that uses the same class loader |
1014 // as the host_klass |
1010 // as the host_klass |
1062 if (JvmtiExport::should_post_class_load()) { |
1058 if (JvmtiExport::should_post_class_load()) { |
1063 assert(THREAD->is_Java_thread(), "thread->is_Java_thread()"); |
1059 assert(THREAD->is_Java_thread(), "thread->is_Java_thread()"); |
1064 JvmtiExport::post_class_load((JavaThread *) THREAD, k); |
1060 JvmtiExport::post_class_load((JavaThread *) THREAD, k); |
1065 } |
1061 } |
1066 |
1062 |
1067 post_class_load_event(class_load_start_time, k, loader_data); |
1063 post_class_load_event(&class_load_start_event, k, loader_data); |
1068 } |
1064 } |
1069 assert(host_klass != NULL || NULL == cp_patches, |
1065 assert(host_klass != NULL || NULL == cp_patches, |
1070 "cp_patches only found with host_klass"); |
1066 "cp_patches only found with host_klass"); |
1071 |
1067 |
1072 return k; |
1068 return k; |