src/share/vm/classfile/systemDictionary.cpp

Print this page
rev 9245 : [mq]: class_loading_log


  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/classLoaderData.inline.hpp"
  27 #include "classfile/dictionary.hpp"
  28 #include "classfile/javaClasses.inline.hpp"
  29 #include "classfile/loaderConstraints.hpp"
  30 #include "classfile/placeholders.hpp"
  31 #include "classfile/resolutionErrors.hpp"
  32 #include "classfile/stringTable.hpp"
  33 #include "classfile/systemDictionary.hpp"
  34 #include "classfile/vmSymbols.hpp"
  35 #include "code/codeCache.hpp"
  36 #include "compiler/compileBroker.hpp"
  37 #include "gc/shared/gcLocker.hpp"
  38 #include "interpreter/bytecodeStream.hpp"
  39 #include "interpreter/interpreter.hpp"

  40 #include "memory/filemap.hpp"
  41 #include "memory/oopFactory.hpp"
  42 #include "oops/instanceKlass.hpp"
  43 #include "oops/instanceRefKlass.hpp"
  44 #include "oops/klass.inline.hpp"
  45 #include "oops/methodData.hpp"
  46 #include "oops/objArrayKlass.hpp"
  47 #include "oops/objArrayOop.inline.hpp"
  48 #include "oops/oop.inline.hpp"
  49 #include "oops/typeArrayKlass.hpp"
  50 #include "prims/jvmtiEnvBase.hpp"
  51 #include "prims/methodHandles.hpp"
  52 #include "runtime/arguments.hpp"
  53 #include "runtime/biasedLocking.hpp"
  54 #include "runtime/fieldType.hpp"
  55 #include "runtime/handles.inline.hpp"
  56 #include "runtime/java.hpp"
  57 #include "runtime/javaCalls.hpp"
  58 #include "runtime/mutexLocker.hpp"
  59 #include "runtime/orderAccess.inline.hpp"


1228     // Shared classes are all currently loaded by either the bootstrap or
1229     // internal parallel class loaders, so this will never cause a deadlock
1230     // on a custom class loader lock.
1231 
1232     ClassLoaderData* loader_data = ClassLoaderData::class_loader_data(class_loader());
1233     {
1234       Handle lockObject = compute_loader_lock_object(class_loader, THREAD);
1235       check_loader_lock_contention(lockObject, THREAD);
1236       ObjectLocker ol(lockObject, THREAD, true);
1237       ik->restore_unshareable_info(loader_data, protection_domain, CHECK_(nh));
1238     }
1239 
1240     if (TraceClassLoading) {
1241       ResourceMark rm;
1242       tty->print("[Loaded %s", ik->external_name());
1243       tty->print(" from shared objects file");
1244       if (class_loader.not_null()) {
1245         tty->print(" by %s", loader_data->loader_name());
1246       }
1247       tty->print_cr("]");







1248     }
1249 
1250     if (DumpLoadedClassList != NULL && classlist_file->is_open()) {
1251       // Only dump the classes that can be stored into CDS archive
1252       if (SystemDictionaryShared::is_sharing_possible(loader_data)) {
1253         ResourceMark rm(THREAD);
1254         classlist_file->print_cr("%s", ik->name()->as_C_string());
1255         classlist_file->flush();
1256       }
1257     }
1258 
1259     // notify a class loaded from shared object
1260     ClassLoadingService::notify_class_loaded(ik(), true /* shared class */);
1261   }
1262   return ik;
1263 }
1264 #endif // INCLUDE_CDS
1265 
1266 instanceKlassHandle SystemDictionary::load_instance_class(Symbol* class_name, Handle class_loader, TRAPS) {
1267   instanceKlassHandle nh = instanceKlassHandle(); // null Handle




  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/classLoaderData.inline.hpp"
  27 #include "classfile/dictionary.hpp"
  28 #include "classfile/javaClasses.inline.hpp"
  29 #include "classfile/loaderConstraints.hpp"
  30 #include "classfile/placeholders.hpp"
  31 #include "classfile/resolutionErrors.hpp"
  32 #include "classfile/stringTable.hpp"
  33 #include "classfile/systemDictionary.hpp"
  34 #include "classfile/vmSymbols.hpp"
  35 #include "code/codeCache.hpp"
  36 #include "compiler/compileBroker.hpp"
  37 #include "gc/shared/gcLocker.hpp"
  38 #include "interpreter/bytecodeStream.hpp"
  39 #include "interpreter/interpreter.hpp"
  40 #include "logging/log.hpp"
  41 #include "memory/filemap.hpp"
  42 #include "memory/oopFactory.hpp"
  43 #include "oops/instanceKlass.hpp"
  44 #include "oops/instanceRefKlass.hpp"
  45 #include "oops/klass.inline.hpp"
  46 #include "oops/methodData.hpp"
  47 #include "oops/objArrayKlass.hpp"
  48 #include "oops/objArrayOop.inline.hpp"
  49 #include "oops/oop.inline.hpp"
  50 #include "oops/typeArrayKlass.hpp"
  51 #include "prims/jvmtiEnvBase.hpp"
  52 #include "prims/methodHandles.hpp"
  53 #include "runtime/arguments.hpp"
  54 #include "runtime/biasedLocking.hpp"
  55 #include "runtime/fieldType.hpp"
  56 #include "runtime/handles.inline.hpp"
  57 #include "runtime/java.hpp"
  58 #include "runtime/javaCalls.hpp"
  59 #include "runtime/mutexLocker.hpp"
  60 #include "runtime/orderAccess.inline.hpp"


1229     // Shared classes are all currently loaded by either the bootstrap or
1230     // internal parallel class loaders, so this will never cause a deadlock
1231     // on a custom class loader lock.
1232 
1233     ClassLoaderData* loader_data = ClassLoaderData::class_loader_data(class_loader());
1234     {
1235       Handle lockObject = compute_loader_lock_object(class_loader, THREAD);
1236       check_loader_lock_contention(lockObject, THREAD);
1237       ObjectLocker ol(lockObject, THREAD, true);
1238       ik->restore_unshareable_info(loader_data, protection_domain, CHECK_(nh));
1239     }
1240 
1241     if (TraceClassLoading) {
1242       ResourceMark rm;
1243       tty->print("[Loaded %s", ik->external_name());
1244       tty->print(" from shared objects file");
1245       if (class_loader.not_null()) {
1246         tty->print(" by %s", loader_data->loader_name());
1247       }
1248       tty->print_cr("]");
1249     }
1250 
1251     if (log_is_enabled(Debug, classload)) {
1252       ik()->print_loading_log(LogLevel::Debug, loader_data, NULL);
1253     }
1254     if (log_is_enabled(Trace, classload)) {
1255       ik()->print_loading_log(LogLevel::Trace, loader_data, NULL);
1256     }
1257 
1258     if (DumpLoadedClassList != NULL && classlist_file->is_open()) {
1259       // Only dump the classes that can be stored into CDS archive
1260       if (SystemDictionaryShared::is_sharing_possible(loader_data)) {
1261         ResourceMark rm(THREAD);
1262         classlist_file->print_cr("%s", ik->name()->as_C_string());
1263         classlist_file->flush();
1264       }
1265     }
1266 
1267     // notify a class loaded from shared object
1268     ClassLoadingService::notify_class_loaded(ik(), true /* shared class */);
1269   }
1270   return ik;
1271 }
1272 #endif // INCLUDE_CDS
1273 
1274 instanceKlassHandle SystemDictionary::load_instance_class(Symbol* class_name, Handle class_loader, TRAPS) {
1275   instanceKlassHandle nh = instanceKlassHandle(); // null Handle