RFR: Workaround CacheDataStore use with source launcher [v2]
Aleksey Shipilev
shade at openjdk.org
Fri Sep 6 08:59:54 UTC 2024
> I was trying to test the simplest workload that involves javac, and that is source launcher. When I attempt to use source launcher with `-XX:CacheDataStore`, it fails with:
>
>
> $ rm -f app.cds*; build/linux-x86_64-server-release/images/jdk/bin/java -XX:CacheDataStore=app.cds -Xmx256m -Xms256m -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC HelloStream.java
> [0.001s][warning][cds] optimized module handling/full module graph: disabled due to incompatible property: jdk.module.addmods=ALL-DEFAULT
> Error occurred during initialization of VM
> CacheDataStore cannot be created because AOTClassLinking is enabled but full module graph is disabled
>
>
> Source launcher adds `--add-modules=ALL-DEFAULT`:
>
>
> $ man java
> ...
> In source-file mode, execution proceeds as follows:
>
> ...
> • The compiled classes are executed in the context of an unnamed module, as though --add-mod‐
> ules=ALL-DEFAULT is in effect. This is in addition to any other --add-module options that may be
> have been specified on the command line.
>
>
> I think we can work that around specifically for Leyden, and also leave a TODO breadcrumb in the code that we need to figure this out on CDS side. This PR does that workaround. With it, source launcher works with simple examples:
>
>
> $ build/linux-x86_64-server-release/images/jdk/bin/java -XX:CacheDataStore=app.cds -Xmx256m -Xms256m -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC HelloStream.java
> Warning: CacheDataStore cannot be used with default source launcher environment, disabling --add-modules=ALL-DEFAULT
> hello, world
Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:
Indenting
-------------
Changes:
- all: https://git.openjdk.org/leyden/pull/15/files
- new: https://git.openjdk.org/leyden/pull/15/files/5c198f7d..4e490f86
Webrevs:
- full: https://webrevs.openjdk.org/?repo=leyden&pr=15&range=01
- incr: https://webrevs.openjdk.org/?repo=leyden&pr=15&range=00-01
Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
Patch: https://git.openjdk.org/leyden/pull/15.diff
Fetch: git fetch https://git.openjdk.org/leyden.git pull/15/head:pull/15
PR: https://git.openjdk.org/leyden/pull/15
More information about the leyden-dev
mailing list