src/hotspot/share/classfile/systemDictionary.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File open Sdiff src/hotspot/share/classfile

src/hotspot/share/classfile/systemDictionary.cpp

Print this page




1042   }
1043   assert(host_klass != NULL || NULL == cp_patches,
1044          "cp_patches only found with host_klass");
1045 
1046   return k;
1047 }
1048 
1049 // Add a klass to the system from a stream (called by jni_DefineClass and
1050 // JVM_DefineClass).
1051 // Note: class_name can be NULL. In that case we do not know the name of
1052 // the class until we have parsed the stream.
1053 
1054 InstanceKlass* SystemDictionary::resolve_from_stream(Symbol* class_name,
1055                                                      Handle class_loader,
1056                                                      Handle protection_domain,
1057                                                      ClassFileStream* st,
1058                                                      TRAPS) {
1059 #if INCLUDE_CDS
1060   ResourceMark rm(THREAD);
1061   if (DumpSharedSpaces && !class_loader.is_null() &&
1062       !UseAppCDS && strcmp(class_name->as_C_string(), "Unnamed") != 0) {
1063     // If AppCDS is not enabled, don't define the class at dump time (except for the "Unnamed"
1064     // class, which is used by MethodHandles).







1065     THROW_MSG_NULL(vmSymbols::java_lang_ClassNotFoundException(), class_name->as_C_string());
1066   }
1067 #endif
1068 
1069   HandleMark hm(THREAD);
1070 
1071   // Classloaders that support parallelism, e.g. bootstrap classloader,
1072   // do not acquire lock here
1073   bool DoObjectLock = true;
1074   if (is_parallelCapable(class_loader)) {
1075     DoObjectLock = false;
1076   }
1077 
1078   ClassLoaderData* loader_data = register_loader(class_loader, CHECK_NULL);
1079 
1080   // Make sure we are synchronized on the class loader before we proceed
1081   Handle lockObject = compute_loader_lock_object(class_loader, THREAD);
1082   check_loader_lock_contention(lockObject, THREAD);
1083   ObjectLocker ol(lockObject, THREAD, DoObjectLock);
1084 
1085   assert(st != NULL, "invariant");
1086 
1087   // Parse the stream and create a klass.




1042   }
1043   assert(host_klass != NULL || NULL == cp_patches,
1044          "cp_patches only found with host_klass");
1045 
1046   return k;
1047 }
1048 
1049 // Add a klass to the system from a stream (called by jni_DefineClass and
1050 // JVM_DefineClass).
1051 // Note: class_name can be NULL. In that case we do not know the name of
1052 // the class until we have parsed the stream.
1053 
1054 InstanceKlass* SystemDictionary::resolve_from_stream(Symbol* class_name,
1055                                                      Handle class_loader,
1056                                                      Handle protection_domain,
1057                                                      ClassFileStream* st,
1058                                                      TRAPS) {
1059 #if INCLUDE_CDS
1060   ResourceMark rm(THREAD);
1061   if (DumpSharedSpaces && !class_loader.is_null() &&
1062       !UseAppCDS && (strcmp(class_name->as_C_string(), "Unnamed") != 0)
1063       // If AppCDS is not enabled, don't define the class at dump time (except for the "Unnamed"
1064       // class, which is used by MethodHandles).
1065 #if INCLUDE_JVMCI
1066       // Need to define the class if force initialization of JVMCI runtime. Otherwise the <clinit> of the
1067       // JVMCI class will result in ClassNotFoundException.
1068       && !Arguments::is_force_init_jvmci_runtime()) {
1069 #else
1070       ) {
1071 #endif // INCLUDE_JVMCI
1072     THROW_MSG_NULL(vmSymbols::java_lang_ClassNotFoundException(), class_name->as_C_string());
1073   }
1074 #endif // INCLUDE_CDS
1075 
1076   HandleMark hm(THREAD);
1077 
1078   // Classloaders that support parallelism, e.g. bootstrap classloader,
1079   // do not acquire lock here
1080   bool DoObjectLock = true;
1081   if (is_parallelCapable(class_loader)) {
1082     DoObjectLock = false;
1083   }
1084 
1085   ClassLoaderData* loader_data = register_loader(class_loader, CHECK_NULL);
1086 
1087   // Make sure we are synchronized on the class loader before we proceed
1088   Handle lockObject = compute_loader_lock_object(class_loader, THREAD);
1089   check_loader_lock_contention(lockObject, THREAD);
1090   ObjectLocker ol(lockObject, THREAD, DoObjectLock);
1091 
1092   assert(st != NULL, "invariant");
1093 
1094   // Parse the stream and create a klass.


src/hotspot/share/classfile/systemDictionary.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File