743 do {
744 cld->set_next(next);
745 ClassLoaderData* exchanged = (ClassLoaderData*)Atomic::cmpxchg_ptr(cld, list_head, next);
746 if (exchanged == next) {
747 if (log_is_enabled(Debug, class, loader, data)) {
748 PauseNoSafepointVerifier pnsv(&no_safepoints); // Need safe points for JavaCalls::call_virtual
749 log_creation(loader, cld, CHECK_NULL);
750 }
751 return cld;
752 }
753 next = exchanged;
754 } while (true);
755 }
756
757 void ClassLoaderDataGraph::log_creation(Handle loader, ClassLoaderData* cld, TRAPS) {
758 Handle string;
759 if (loader.not_null()) {
760 // Include the result of loader.toString() in the output. This allows
761 // the user of the log to identify the class loader instance.
762 JavaValue result(T_OBJECT);
763 KlassHandle spec_klass(THREAD, SystemDictionary::ClassLoader_klass());
764 JavaCalls::call_virtual(&result,
765 loader,
766 spec_klass,
767 vmSymbols::toString_name(),
768 vmSymbols::void_string_signature(),
769 CHECK);
770 assert(result.get_type() == T_OBJECT, "just checking");
771 string = Handle(THREAD, (oop)result.get_jobject());
772 }
773
774 ResourceMark rm;
775 outputStream* log = Log(class, loader, data)::debug_stream();
776 log->print("create class loader data " INTPTR_FORMAT, p2i(cld));
777 log->print(" for instance " INTPTR_FORMAT " of %s", p2i((void *)cld->class_loader()),
778 cld->loader_name());
779
780 if (string.not_null()) {
781 log->print(": ");
782 java_lang_String::print(string(), log);
783 }
|
743 do {
744 cld->set_next(next);
745 ClassLoaderData* exchanged = (ClassLoaderData*)Atomic::cmpxchg_ptr(cld, list_head, next);
746 if (exchanged == next) {
747 if (log_is_enabled(Debug, class, loader, data)) {
748 PauseNoSafepointVerifier pnsv(&no_safepoints); // Need safe points for JavaCalls::call_virtual
749 log_creation(loader, cld, CHECK_NULL);
750 }
751 return cld;
752 }
753 next = exchanged;
754 } while (true);
755 }
756
757 void ClassLoaderDataGraph::log_creation(Handle loader, ClassLoaderData* cld, TRAPS) {
758 Handle string;
759 if (loader.not_null()) {
760 // Include the result of loader.toString() in the output. This allows
761 // the user of the log to identify the class loader instance.
762 JavaValue result(T_OBJECT);
763 Klass* spec_klass = SystemDictionary::ClassLoader_klass();
764 JavaCalls::call_virtual(&result,
765 loader,
766 spec_klass,
767 vmSymbols::toString_name(),
768 vmSymbols::void_string_signature(),
769 CHECK);
770 assert(result.get_type() == T_OBJECT, "just checking");
771 string = Handle(THREAD, (oop)result.get_jobject());
772 }
773
774 ResourceMark rm;
775 outputStream* log = Log(class, loader, data)::debug_stream();
776 log->print("create class loader data " INTPTR_FORMAT, p2i(cld));
777 log->print(" for instance " INTPTR_FORMAT " of %s", p2i((void *)cld->class_loader()),
778 cld->loader_name());
779
780 if (string.not_null()) {
781 log->print(": ");
782 java_lang_String::print(string(), log);
783 }
|