320 Symbol* class_name, |
320 Symbol* class_name, |
321 Handle class_loader, |
321 Handle class_loader, |
322 Handle protection_domain, |
322 Handle protection_domain, |
323 bool is_superclass, |
323 bool is_superclass, |
324 TRAPS) { |
324 TRAPS) { |
|
325 #if INCLUDE_CDS |
|
326 if (DumpSharedSpaces) { |
|
327 // Special processing for CDS dump time. |
|
328 Klass* k = SystemDictionaryShared::dump_time_resolve_super_or_fail(child_name, |
|
329 class_name, class_loader, protection_domain, is_superclass, CHECK_NULL); |
|
330 if (k) { |
|
331 return k; |
|
332 } |
|
333 } |
|
334 #endif // INCLUDE_CDS |
|
335 |
325 // Double-check, if child class is already loaded, just return super-class,interface |
336 // Double-check, if child class is already loaded, just return super-class,interface |
326 // Don't add a placedholder if already loaded, i.e. already in system dictionary |
337 // Don't add a placedholder if already loaded, i.e. already in system dictionary |
327 // Make sure there's a placeholder for the *child* before resolving. |
338 // Make sure there's a placeholder for the *child* before resolving. |
328 // Used as a claim that this thread is currently loading superclass/classloader |
339 // Used as a claim that this thread is currently loading superclass/classloader |
329 // Used here for ClassCircularity checks and also for heap verification |
340 // Used here for ClassCircularity checks and also for heap verification |
1077 // already be present in the SystemDictionary, otherwise we would not |
1088 // already be present in the SystemDictionary, otherwise we would not |
1078 // throw potential ClassFormatErrors. |
1089 // throw potential ClassFormatErrors. |
1079 // |
1090 // |
1080 // Note: "name" is updated. |
1091 // Note: "name" is updated. |
1081 |
1092 |
1082 instanceKlassHandle k = ClassFileParser(st).parseClassFile(class_name, |
1093 instanceKlassHandle k; |
1083 loader_data, |
1094 |
1084 protection_domain, |
1095 #if INCLUDE_CDS |
1085 parsed_name, |
1096 k = SystemDictionaryShared::lookup_from_stream(class_name, |
1086 verify, |
1097 class_loader, |
1087 THREAD); |
1098 protection_domain, |
|
1099 st, |
|
1100 verify, |
|
1101 CHECK_NULL); |
|
1102 #endif |
|
1103 |
|
1104 if (k.not_null()) { |
|
1105 parsed_name = k->name(); |
|
1106 } else { |
|
1107 if (st->buffer() == NULL) { |
|
1108 return NULL; |
|
1109 } |
|
1110 k = ClassFileParser(st).parseClassFile(class_name, |
|
1111 loader_data, |
|
1112 protection_domain, |
|
1113 parsed_name, |
|
1114 verify, |
|
1115 THREAD); |
|
1116 } |
1088 |
1117 |
1089 const char* pkg = "java/"; |
1118 const char* pkg = "java/"; |
1090 if (!HAS_PENDING_EXCEPTION && |
1119 if (!HAS_PENDING_EXCEPTION && |
1091 !class_loader.is_null() && |
1120 !class_loader.is_null() && |
1092 parsed_name != NULL && |
1121 parsed_name != NULL && |
1199 // are shared, add them to the main system dictionary and reset |
1228 // are shared, add them to the main system dictionary and reset |
1200 // their hierarchy references (supers, subs, and interfaces). |
1229 // their hierarchy references (supers, subs, and interfaces). |
1201 |
1230 |
1202 if (ik->super() != NULL) { |
1231 if (ik->super() != NULL) { |
1203 Symbol* cn = ik->super()->name(); |
1232 Symbol* cn = ik->super()->name(); |
1204 resolve_super_or_fail(class_name, cn, |
1233 Klass *s = resolve_super_or_fail(class_name, cn, |
1205 class_loader, protection_domain, true, CHECK_(nh)); |
1234 class_loader, protection_domain, true, CHECK_(nh)); |
|
1235 if (s != ik->super()) { |
|
1236 // The dynamically resolved super class is not the same as the one we used during dump time, |
|
1237 // so we cannot use ik. |
|
1238 return nh; |
|
1239 } |
1206 } |
1240 } |
1207 |
1241 |
1208 Array<Klass*>* interfaces = ik->local_interfaces(); |
1242 Array<Klass*>* interfaces = ik->local_interfaces(); |
1209 int num_interfaces = interfaces->length(); |
1243 int num_interfaces = interfaces->length(); |
1210 for (int index = 0; index < num_interfaces; index++) { |
1244 for (int index = 0; index < num_interfaces; index++) { |
1213 // Note: can not use InstanceKlass::cast here because |
1247 // Note: can not use InstanceKlass::cast here because |
1214 // interfaces' InstanceKlass's C++ vtbls haven't been |
1248 // interfaces' InstanceKlass's C++ vtbls haven't been |
1215 // reinitialized yet (they will be once the interface classes |
1249 // reinitialized yet (they will be once the interface classes |
1216 // are loaded) |
1250 // are loaded) |
1217 Symbol* name = k->name(); |
1251 Symbol* name = k->name(); |
1218 resolve_super_or_fail(class_name, name, class_loader, protection_domain, false, CHECK_(nh)); |
1252 Klass* i = resolve_super_or_fail(class_name, name, class_loader, protection_domain, false, CHECK_(nh)); |
|
1253 if (k != i) { |
|
1254 // The dynamically resolved interface class is not the same as the one we used during dump time, |
|
1255 // so we cannot use ik. |
|
1256 return nh; |
|
1257 } |
1219 } |
1258 } |
1220 |
1259 |
1221 // Adjust methods to recover missing data. They need addresses for |
1260 // Adjust methods to recover missing data. They need addresses for |
1222 // interpreter entry points and their default native method address |
1261 // interpreter entry points and their default native method address |
1223 // must be reset. |
1262 // must be reset. |