From d4dfa0127f4d51c8127c5d4dfe3b58c09500e80f Mon Sep 17 00:00:00 2001 From: Matias Saavedra Silva <matsaave@openjdk.org> Date: Wed, 4 Sep 2024 20:49:32 +0000 Subject: [PATCH] 8338530: CDS warning Skipping java/lang/invoke/BoundMethodHandle$Species_LLLL Reviewed-by: iklam, ccheung --- .../share/classfile/systemDictionaryShared.cpp | 13 ++++++++++--- .../dumpingWithAgent/DumpingWithJavaAgent.java | 3 ++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/hotspot/share/classfile/systemDictionaryShared.cpp b/src/hotspot/share/classfile/systemDictionaryShared.cpp index 8bb06e6dca4..ce7f862a7b6 100644 --- a/src/hotspot/share/classfile/systemDictionaryShared.cpp +++ b/src/hotspot/share/classfile/systemDictionaryShared.cpp @@ -274,9 +274,16 @@ bool SystemDictionaryShared::check_for_exclusion_impl(InstanceKlass* k) { return warn_excluded(k, "Has been redefined"); } 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 - // agent during dump time). - return warn_excluded(k, "Unsupported location"); + if (k->name()->starts_with("java/lang/invoke/BoundMethodHandle$Species_")) { + // This class is dynamically generated by the JDK + 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) { // We cannot include signed classes in the archive because the certificates diff --git a/test/hotspot/jtreg/runtime/cds/appcds/jvmti/dumpingWithAgent/DumpingWithJavaAgent.java b/test/hotspot/jtreg/runtime/cds/appcds/jvmti/dumpingWithAgent/DumpingWithJavaAgent.java index c814a9a4065..74ddfcebe1b 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/jvmti/dumpingWithAgent/DumpingWithJavaAgent.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/jvmti/dumpingWithAgent/DumpingWithJavaAgent.java @@ -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. * * 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[1]); 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. output = TestCommon.testDump(appJar, TestCommon.list("Hello"),