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

Ioi Lam iklam at openjdk.org
Wed Sep 4 16:42:19 UTC 2024


On Wed, 4 Sep 2024 16:25:26 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> 1. It would probably work to actually make these dumpable into the CDS archive - though we might need to also dump the full bytecode and patch that up when we load them.

With  [JEP 483: Ahead-of-Time Class Loading & Linking](https://bugs.openjdk.org/browse/JDK-8315737), we can archive these classes when `-XX:+AOTClassLinking` is enabled:


    if (k->name()->starts_with("java/lang/invoke/BoundMethodHandle$Species_")) {
      // This class is dynamically generated by the JDK
+     if (CDSConfig::is_dumping_aot_linked_classes() {
+       // This class is archived without recording the original bytecodes. That's OK because the original
+       // bytecodes are needed only for JVMTI ClassFileLoadHook. A CDS archived generated
+       // with -XX:+AOTClassLinking will not be loadable if ClassFileLoadHooks are enabled.
+       k->set_shared_classpath_index(0); 
+    } else {
        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");
    }


We can't do this when `AOTClassLinking` is disabled, or else when CFLH asks for the original bytecodes, we will get an assert in [`FileMapInfo::open_stream_for_jvmti()`](https://github.com/openjdk/jdk/blob/12d060a255b9b783488714c6c2cb73a899d3f708/src/hotspot/share/cds/filemap.cpp#L2547):

-------------

PR Comment: https://git.openjdk.org/jdk/pull/20799#issuecomment-2329533301


More information about the hotspot-dev mailing list