diff -r aa73af640c61 -r 4be3504cc03b hotspot/src/share/vm/classfile/systemDictionary.cpp --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp Thu Nov 12 14:03:14 2015 +0100 +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp Tue Aug 18 11:27:23 2015 -0700 @@ -322,6 +322,17 @@ Handle protection_domain, bool is_superclass, TRAPS) { +#if INCLUDE_CDS + if (DumpSharedSpaces) { + // Special processing for CDS dump time. + Klass* k = SystemDictionaryShared::dump_time_resolve_super_or_fail(child_name, + class_name, class_loader, protection_domain, is_superclass, CHECK_NULL); + if (k) { + return k; + } + } +#endif // INCLUDE_CDS + // Double-check, if child class is already loaded, just return super-class,interface // Don't add a placedholder if already loaded, i.e. already in system dictionary // Make sure there's a placeholder for the *child* before resolving. @@ -1079,12 +1090,30 @@ // // Note: "name" is updated. - instanceKlassHandle k = ClassFileParser(st).parseClassFile(class_name, - loader_data, - protection_domain, - parsed_name, - verify, - THREAD); + instanceKlassHandle k; + +#if INCLUDE_CDS + k = SystemDictionaryShared::lookup_from_stream(class_name, + class_loader, + protection_domain, + st, + verify, + CHECK_NULL); +#endif + + if (k.not_null()) { + parsed_name = k->name(); + } else { + if (st->buffer() == NULL) { + return NULL; + } + k = ClassFileParser(st).parseClassFile(class_name, + loader_data, + protection_domain, + parsed_name, + verify, + THREAD); + } const char* pkg = "java/"; if (!HAS_PENDING_EXCEPTION && @@ -1201,8 +1230,13 @@ if (ik->super() != NULL) { Symbol* cn = ik->super()->name(); - resolve_super_or_fail(class_name, cn, - class_loader, protection_domain, true, CHECK_(nh)); + Klass *s = resolve_super_or_fail(class_name, cn, + class_loader, protection_domain, true, CHECK_(nh)); + if (s != ik->super()) { + // The dynamically resolved super class is not the same as the one we used during dump time, + // so we cannot use ik. + return nh; + } } Array* interfaces = ik->local_interfaces(); @@ -1215,7 +1249,12 @@ // reinitialized yet (they will be once the interface classes // are loaded) Symbol* name = k->name(); - resolve_super_or_fail(class_name, name, class_loader, protection_domain, false, CHECK_(nh)); + Klass* i = resolve_super_or_fail(class_name, name, class_loader, protection_domain, false, CHECK_(nh)); + if (k != i) { + // The dynamically resolved interface class is not the same as the one we used during dump time, + // so we cannot use ik. + return nh; + } } // Adjust methods to recover missing data. They need addresses for