--- old/src/share/vm/classfile/systemDictionary.cpp 2015-10-29 21:53:04.993570297 -0700 +++ new/src/share/vm/classfile/systemDictionary.cpp 2015-10-29 21:53:04.885566218 -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 + // 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. @@ -1071,6 +1082,35 @@ check_loader_lock_contention(lockObject, THREAD); ObjectLocker ol(lockObject, THREAD, DoObjectLock); +#if INCLUDE_CDS + instanceKlassHandle sk = + SystemDictionaryShared::resolve_from_shared_space(class_name, + class_loader, + protection_domain, + st, + verify, + CHECK_NULL); + if (sk.not_null()) { + assert(MetaspaceShared::is_in_shared_space(sk()), "must be"); + + // Make sure we have an entry in the SystemDictionary on success + debug_only( { + Symbol* h_name = sk->name(); + ClassLoaderData *defining_loader_data = sk->class_loader_data(); + + MutexLocker mu(SystemDictionary_lock, THREAD); + + Klass* check = find_class(h_name, loader_data); + assert(check == sk(), "should be present in the dictionary"); + + Klass* check2 = find_class(h_name, defining_loader_data); + assert(check == check2, "name inconsistancy in SystemDictionary"); + } ); + + return sk(); + } +#endif + TempNewSymbol parsed_name = NULL; // Parse the stream. Note that we do this even though this klass might @@ -1201,8 +1241,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 +1260,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