8267347: CDS record_linking_constraint asserts with unregistered class

Reviewed-by: minqi, ccheung
This commit is contained in:
Ioi Lam 2021-05-24 21:52:13 +00:00
parent a5467ae7bb
commit 209769b5ad
5 changed files with 156 additions and 22 deletions

View file

@ -1855,8 +1855,6 @@ void SystemDictionaryShared::record_linking_constraint(Symbol* name, InstanceKla
// either of these two loaders. The check itself does not
// try to resolve T.
oop klass_loader = klass->class_loader();
assert(klass_loader != NULL, "should not be called for boot loader");
assert(loader1 != loader2, "must be");
if (!is_system_class_loader(klass_loader) &&
!is_platform_class_loader(klass_loader)) {
@ -1872,6 +1870,17 @@ void SystemDictionaryShared::record_linking_constraint(Symbol* name, InstanceKla
return;
}
if (DumpSharedSpaces && !is_builtin(klass)) {
// During static dump, unregistered classes (those intended for
// custom loaders) are loaded by the boot loader. Need to
// exclude these for the same reason as above.
// This should be fixed by JDK-8261941.
return;
}
assert(klass_loader != NULL, "should not be called for boot loader");
assert(loader1 != loader2, "must be");
if (DynamicDumpSharedSpaces && Thread::current()->is_VM_thread()) {
// We are re-laying out the vtable/itables of the *copy* of
// a class during the final stage of dynamic dumping. The