< prev index next >

src/hotspot/share/classfile/systemDictionary.cpp

Print this page


1070   }
1071   assert(host_klass != NULL || NULL == cp_patches,
1072          "cp_patches only found with host_klass");
1073 
1074   return k;
1075 }
1076 
1077 // Add a klass to the system from a stream (called by jni_DefineClass and
1078 // JVM_DefineClass).
1079 // Note: class_name can be NULL. In that case we do not know the name of
1080 // the class until we have parsed the stream.
1081 
1082 InstanceKlass* SystemDictionary::resolve_from_stream(Symbol* class_name,
1083                                                      Handle class_loader,
1084                                                      Handle protection_domain,
1085                                                      ClassFileStream* st,
1086                                                      TRAPS) {
1087 #if INCLUDE_CDS
1088   ResourceMark rm(THREAD);
1089   if (DumpSharedSpaces && !class_loader.is_null() &&
1090       !ArgumentsExt::using_AppCDS() && strcmp(class_name->as_C_string(), "Unnamed") != 0) {
1091     // If AppCDS is not enabled, don't define the class at dump time (except for the "Unnamed"
1092     // class, which is used by MethodHandles).
1093     THROW_MSG_NULL(vmSymbols::java_lang_ClassNotFoundException(), class_name->as_C_string());
1094   }
1095 #endif
1096 
1097   HandleMark hm(THREAD);
1098 
1099   // Classloaders that support parallelism, e.g. bootstrap classloader,
1100   // or all classloaders with UnsyncloadClass do not acquire lock here
1101   bool DoObjectLock = true;
1102   if (is_parallelCapable(class_loader)) {
1103     DoObjectLock = false;
1104   }
1105 
1106   ClassLoaderData* loader_data = register_loader(class_loader, CHECK_NULL);
1107 
1108   // Make sure we are synchronized on the class loader before we proceed
1109   Handle lockObject = compute_loader_lock_object(class_loader, THREAD);
1110   check_loader_lock_contention(lockObject, THREAD);




1070   }
1071   assert(host_klass != NULL || NULL == cp_patches,
1072          "cp_patches only found with host_klass");
1073 
1074   return k;
1075 }
1076 
1077 // Add a klass to the system from a stream (called by jni_DefineClass and
1078 // JVM_DefineClass).
1079 // Note: class_name can be NULL. In that case we do not know the name of
1080 // the class until we have parsed the stream.
1081 
1082 InstanceKlass* SystemDictionary::resolve_from_stream(Symbol* class_name,
1083                                                      Handle class_loader,
1084                                                      Handle protection_domain,
1085                                                      ClassFileStream* st,
1086                                                      TRAPS) {
1087 #if INCLUDE_CDS
1088   ResourceMark rm(THREAD);
1089   if (DumpSharedSpaces && !class_loader.is_null() &&
1090       !UseAppCDS && strcmp(class_name->as_C_string(), "Unnamed") != 0) {
1091     // If AppCDS is not enabled, don't define the class at dump time (except for the "Unnamed"
1092     // class, which is used by MethodHandles).
1093     THROW_MSG_NULL(vmSymbols::java_lang_ClassNotFoundException(), class_name->as_C_string());
1094   }
1095 #endif
1096 
1097   HandleMark hm(THREAD);
1098 
1099   // Classloaders that support parallelism, e.g. bootstrap classloader,
1100   // or all classloaders with UnsyncloadClass do not acquire lock here
1101   bool DoObjectLock = true;
1102   if (is_parallelCapable(class_loader)) {
1103     DoObjectLock = false;
1104   }
1105 
1106   ClassLoaderData* loader_data = register_loader(class_loader, CHECK_NULL);
1107 
1108   // Make sure we are synchronized on the class loader before we proceed
1109   Handle lockObject = compute_loader_lock_object(class_loader, THREAD);
1110   check_loader_lock_contention(lockObject, THREAD);


< prev index next >