RFR: 8367366: Do not support -XX:+AOTClassLinking for dynamic CDS archive [v2]

Ashutosh Mehra asmehra at openjdk.org
Tue Sep 16 20:43:52 UTC 2025


On Tue, 16 Sep 2025 20:32:12 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> @iklam 
>>> java -XX:ArchiveClassesAtExit=foo.jsa -cp HelloWorld.jar -XX:AOTMode=on -XX:AOTCache=hw.aot HelloWorld
>> 
>> What would this command do? Generate `hw.aot` or `foo.jsa`? I think this is, as you said, a convoluted case and it is best to not allow the user to mix the two workflows.
>
> Here's a more elaborate example. It works today as `base.aot` is essentially a static CDS archive. 
> 
> 
> $ java -XX:AOTCacheOutput=base.aot --version
> $ java -cp HelloWorld.jar -XX:AOTCache=base.aot -XX:ArchiveClassesAtExit=dyn.jsa HelloWorld
> $ java -Xlog:cds -cp HelloWorld.jar -XX:SharedArchiveFile=dyn.jsa HelloWorld
> ...
> [0.003s][info][cds] Opened shared archive file base.aot.
> ...
> [0.003s][info][cds] Opened shared archive file dyn.jsa.
> ...
> Hello World
> 
> 
> I agree that we should disallow this combination. In JEP 483 we explicitly disallowed mixing `-XX:AOTxxx` with classical CDS flags such as `-XX:SharedArchiveFile`. We should have also disallowed `-XX:ArchiveClassesAtExit` and other flags used by the dynamic archive.
> 
> This will simplify AOT implementation and also will avoid future incompatibility -- there's no guarantee that the above would work when more optimizations are added to AOT.
> 
> Maybe I should do it in a follow-up PR? I want to make this PR simple in order to unblock #26375

I get that now. The AOTCache has already been created, and is now used as the base archive for the dynamic archive.

> This will simplify AOT implementation and also will avoid future incompatibility -- there's no guarantee that the above would work when more optimizations are added to AOT.
> 
> Maybe I should do it in a follow-up PR? I want to make this PR simple in order to unblock https://github.com/openjdk/jdk/pull/26375

Yup, a follow-up PR should be fine.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27242#discussion_r2353608306


More information about the hotspot-dev mailing list