RFR: 8324259: Classes used by CDS at runtime should be archived
Ioi Lam
iklam at openjdk.org
Sat Sep 28 23:38:35 UTC 2024
On Fri, 27 Sep 2024 19:37:20 GMT, Matias Saavedra Silva <matsaave at openjdk.org> wrote:
> The following classes are not included in the archive at dumptime but are used at runtime when loading the archive:
>
> [0.248s][info][class,load] java.nio.file.FileSystems source: jrt:/java.base loader: boot_loader
> [0.248s][info][class,load] java.nio.file.FileSystems$DefaultFileSystemHolder source: jrt:/java.base loader: boot_loader
> [0.249s][info][class,load] java.nio.file.FileSystems$DefaultFileSystemHolder$1 source: jrt:/java.base loader: boot_loader
> [0.254s][info][class,load] java.net.URI$Parser source: jrt:/java.base loader: boot_loader
>
> This patch makes a dummy call at dumptime to archive these classes. Verified with tier 1-5 tests.
Changes requested by iklam (Reviewer).
src/hotspot/share/cds/metaspaceShared.cpp line 800:
> 798: // Dummy call to load classes used at CDS runtime
> 799: JavaValue result(T_OBJECT);
> 800: Handle path_string = java_lang_String::create_from_str("", CHECK);
The `path_string` will be used to create a `Path` object. I think it's better to avoid using an empty string, but use something like `"dummy.jar"` instead.
https://github.com/openjdk/jdk/blob/73ebb848fdb66861e912ea747c039ddd1f7a5f48/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java#L228-L239
-------------
PR Review: https://git.openjdk.org/jdk/pull/21232#pullrequestreview-2335492356
PR Review Comment: https://git.openjdk.org/jdk/pull/21232#discussion_r1779817893
More information about the hotspot-runtime-dev
mailing list