RFR: 8355638: Allow -Xlog:aot to be used as an alias for -Xlog:cds when using AOT cache [v6]
Johan Sjölen
jsjolen at openjdk.org
Fri May 9 08:49:52 UTC 2025
On Thu, 8 May 2025 02:59:35 GMT, Ioi Lam <iklam at openjdk.org> wrote:
>> *Specification:*
>>
>> When the JVM is started with any of the following options: AOTCache, AOTCacheOutput, AOTConfiguration, AOTMode:
>>
>> - Any `-Xlog` options that starts with the `aot` tag should also match any `LogTagSets` whose first tag is `LogTag::_cds`
>> - When printing a `LogTagSet` whose first tag is `LogTag::_cds`, if its `tags` decoration is to be printed, then the first tag in the decoration should be printed as `aot`.
>>
>> *Examples:*
>>
>> Control case -- this is an example of an old "cds" log. The decoration should be printed as "cds" to be backwards compatible
>>
>> $ java -Xshare:auto -Xlog:cds --version | grep trying
>> [0.003s][info][cds] trying to map /jdk3/bld/vox/images/jdk/lib/server/classes.jsa
>>
>>
>> "aot" can be used to select the "cds" log, but the log will be printed with "aot" as its decoration
>>
>> $ java -XX:AOTMode=auto -Xlog:aot --version | grep trying
>> [0.015s][info][aot] trying to map /jdk3/bld/vox/images/jdk/lib/server/classes.jsa
>>
>>
>> When using new -XX:AOT flags, even if you specify -Xlog:cds, the output will use "aot" decoration
>>
>> $ java -XX:AOTMode=auto -Xlog:cds --version | grep tryi
>> [0.004s][info][aot] trying to map /jdk3/bld/vox/images/jdk/lib/server/classes.jsa
>>
>>
>> When using new -XX:AOT flags, error messages should be logged with "aot" decoration even when no -Xlog flags are specified
>>
>> $ java -XX:AOTMode=auto -XX:AOTCache=nofile.aot --version
>> [0.009s][error][aot] An error has occurred while processing the AOT cache. Run with -Xlog:aot for details.
>> [0.009s][error][aot] Loading AOT cache failed: nofile.aot
>> java 25-internal 2025-09-16
>> Java(TM) SE Runtime Environment (build 25-internal-adhoc.iklam.vox)
>> Java HotSpot(TM) 64-Bit Server VM (build 25-internal-adhoc.iklam.vox, mixed mode)
>
> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
>
> Removed checks for error message that got removed from the PR
> > > This seems like a hack in the UL system. Did you consider confining this in the CDS / AOT code instead?
> > > Something like this pseudo code:
> > > ```
> > > bool aot_log_is_enabled(Level, ...) {
> > > return log_is_enabled(Level, aot, link) ||
> > > log_is_enabled(Level, cds, link);
> > > }
> > > void aot_log_info(...) {}
> > > ...
> > > if (aot_log_is_enabled(Info, link) {
> > > ResourceMark rm;
> > > aot_log_info(link)("%s %s %p", class_category_name(ik), ik->external_name(), ik);
> > > }
> > > ```
> >
> >
> > OK I'll try that. I think most `cds` logs are obscure and can be changed to `aot`. I'll implement a few macros for the style you suggested above, and use them on the "user facing" logs -- e.g, those that report errors for trouble shooting purposes.
>
> @stefank @jdksjolen could you check out #25136 for the new approach?
>
> That PR has much more changes than this PR, but we need to change those eventually anyway to complete the `[cds]` to `[aot]` transition.
Personally, I was fine with a **temporary** hack. Now, we do have a 'proper' solution, so let's go with that.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/24895#issuecomment-2865705250
More information about the hotspot-runtime-dev
mailing list