8338530: CDS warning Skipping java/lang/invoke/BoundMethodHandle$Species_LLLL

Reviewed-by: iklam, ccheung
This commit is contained in:
Matias Saavedra Silva 2024-09-04 20:49:32 +00:00
parent b8d560b6cd
commit d4dfa0127f
2 changed files with 12 additions and 4 deletions
src/hotspot/share/classfile
test/hotspot/jtreg/runtime/cds/appcds/jvmti/dumpingWithAgent

@ -274,9 +274,16 @@ bool SystemDictionaryShared::check_for_exclusion_impl(InstanceKlass* k) {
return warn_excluded(k, "Has been redefined"); return warn_excluded(k, "Has been redefined");
} }
if (!k->is_hidden() && k->shared_classpath_index() < 0 && is_builtin(k)) { if (!k->is_hidden() && k->shared_classpath_index() < 0 && is_builtin(k)) {
// These are classes loaded from unsupported locations (such as those loaded by JVMTI native if (k->name()->starts_with("java/lang/invoke/BoundMethodHandle$Species_")) {
// agent during dump time). // This class is dynamically generated by the JDK
return warn_excluded(k, "Unsupported location"); ResourceMark rm;
log_info(cds)("Skipping %s because it is dynamically generated", k->name()->as_C_string());
return true; // exclude without warning
} else {
// These are classes loaded from unsupported locations (such as those loaded by JVMTI native
// agent during dump time).
return warn_excluded(k, "Unsupported location");
}
} }
if (k->signers() != nullptr) { if (k->signers() != nullptr) {
// We cannot include signed classes in the archive because the certificates // We cannot include signed classes in the archive because the certificates

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -76,6 +76,7 @@ public class DumpingWithJavaAgent {
output.shouldContain(warningMessages[0]); output.shouldContain(warningMessages[0]);
output.shouldContain(warningMessages[1]); output.shouldContain(warningMessages[1]);
output.shouldContain("inside SimpleAgent"); output.shouldContain("inside SimpleAgent");
output.shouldContain("Skipping java/lang/invoke/BoundMethodHandle$Species_LLLL because it is dynamically generated");
// CDS dumping with a java agent with the AllowArchvingWithJavaAgent diagnostic option. // CDS dumping with a java agent with the AllowArchvingWithJavaAgent diagnostic option.
output = TestCommon.testDump(appJar, TestCommon.list("Hello"), output = TestCommon.testDump(appJar, TestCommon.list("Hello"),