Summary
-------
We create aliases for existing CDS command-line flags under the "AOT" umbrella to
make them more intuitive to users of upcoming AOT optimizations.
Problem
-------
Many of planned AOT (ahead-of-time) optimization in Project Leyden are based
on the existing [CDS technology in HotSpot](https://docs.oracle.com/en/java/javase/22/vm/class-data-sharing.html). However, many command-line flags related
to CDS, as well as the name CDS itself (which ostensibly stands for Class Data Sharing)
look out of place. It's better to have alternative names for these options that are
grouped under "AOT", so that they will be consistent with future command-line
options that will be introduced by Project Leyden.
Solution
--------
Add new command options that are mapped to existing options:
- `-XX:AOTCache=<file>.aot`
- `-XX:AOTMode=off/auto/on/record/create`
- `-XX:AOTConfiguration=<file>.aotconfig`
Specification
-------------
[1] The three options listed above are all of the type `ccstr`, which means they can be assigned in the command-line to a text string.
[2] `AOTMode` can have the values of `off`, `auto`, `on`, `record`, or `create`. The other two options can be assigned to arbitrary file names (provided the current user has read and/or write access to these files). It's recommended (but not required) to use `.aot` and `.aotconfig` as file extensions for `AOTCache` and `AOTConfiguration`, respectively.
[3] If `AOTMode` is not assigned, it has the default value of `auto`.
[4] When `-XX:AOTCache=<file>.aot` is specified, and `AOTMode` is `auto`, the JVM behaves as if "`-Xshare:auto -XX:SharedArchiveFile=<file>.aot`" are specified. I.e., the JVM tries to load `<file>.aot` as a CDS archive. If the loading fails (e.g., we have a mismatch in the classpath), the JVM prints a warning and continues execution without using `<file>.aot`
[5] When "`-XX:AOTCache=<file>.aot -XX:AOTMode=on`" are specified, the JVM behaves as if "`-Xshare:on -XX:SharedArchiveFile=<file>.aot`" are specified. I.e., the JVM tries to load `<file>.aot` as a CDS archive. If the loading fails (e.g., we have a mismatch in the classpath), the JVM prints an error message and exits.
[6] When `-XX:AOTMode=off` is specified, the JVM behaves as if "`-Xshare:off` is specified. No CDS archive will be loaded by the JVM.
[7] When `-XX:AOTMode=record` is specified, `-XX:AOTConfiguration=<file>.aotconfig` must be specified and `-XX:AOTCache=<file>.aot` must NOT be specified. The JVM behaves as if "`-Xshare:off -XX:DumpLoadedClassList=<file>.aotconfig`" are specified. I.e., we perform a training run and record profiling information into `<file>.aotconfig`.
[8] When `-XX:AOTMode=create` is specified, both `-XX:AOTConfiguration=<file>.aotconfig` and `-XX:AOTCache=<file>.aot` must be specified. The JVM behaves as if "`-Xshare:dump -XX:SharedClassListFile=<file>.aotconfig -XX:SharedArchiveFile=<file>.aot`" are specified. I.e., we create the AOT cache `<file>.aot` using the profiling information stored in `<file>.aotconfig`.
[9] To avoid confusion, we forbid the simultaneous use of the new flag with the corresponding "old" flags. I.e., if any of the three flags listed above are used in the command-line, then none of the following flags can appear anywhere in the command-line
- `-Xshare:on`
- `-Xshare:auto`
- `-Xshare:off`
- `-Xshare:dump`
- `-XX:DumpLoadedClassList=<file>`
- `-XX:SharedClassListFile=<file>`
- `-XX:SharedArchiveFile=<file>`