On Wed, 26 Nov 2025 20:35:11 GMT, Mat Carter <[email protected]> wrote:
>> Add jdk.management.AOTCacheMXBean. The interface provides a single action
>> that when called will cause any hosted JVM currently recording AOT
>> information will stop recording. Existing functionality is preserved: when
>> stopped the JVM will create the required artifacts based on the execution
>> mode. Conveniently as the application running on the JVM has not stopped (as
>> was previously the only way to stop recording), the application will resume
>> execution after the artifacts have been generated.
>>
>> The interface will return TRUE if a recording was successfully stopped, in
>> all other cases (not recording etc.) will return FALSE
>>
>> It follows that invoking the action on a JVM that is recording, twice in
>> succession, should (baring internal errors) produce the following two
>> responses:
>>
>> TRUE
>> FALSE
>>
>> Passes tier1 on linux (x64) and windows (x64)
>
> Mat Carter has updated the pull request incrementally with one additional
> commit since the last revision:
>
> Fixed spaces and CRLF
src/jdk.management/share/classes/jdk/management/HotSpotAOTCacheMXBean.java line
37:
> 35: * <p> The management interface is registered with the platform {@link
> MBeanServer
> 36: * MBeanServer}. The {@link ObjectName ObjectName} that uniquely
> identifies the management
> 37: * interface within the {@code MBeanServer} is:
> "jdk.management:type=HotSpotAOTCache".
Drop the colon after "is", and put the object name in `{@code ...}` rather than
double quotes.
src/jdk.management/share/classes/jdk/management/HotSpotAOTCacheMXBean.java line
44:
> 42: * {@code HotSpotAOTCacheMXBean} defines one operation at this time to
> 43: * end the AOT recording. More operations and/or properties may be added
> in a
> 44: * future release.
Drop this paragraph. It's obvious that there's only one operation, and
uncertain statements about future releases add no value.
src/jdk.management/share/classes/jdk/management/HotSpotAOTCacheMXBean.java line
50:
> 48: public interface HotSpotAOTCacheMXBean extends PlatformManagedObject {
> 49: /**
> 50: * If an AOT recording is in progress, ends the recording. This
> operation completes
s/operation completes/method returns/
src/jdk.management/share/classes/jdk/management/HotSpotAOTCacheMXBean.java line
53:
> 51: * after the AOT artifacts have been completely written.
> 52: *
> 53: * <p>The JVM will start recording AOT artifacts upon start-up if
> certain JVM options are
s/certain/appropriate/ -- "certain" suggests that you're not going to tell the
reader what they are.
src/jdk.management/share/classes/jdk/management/HotSpotAOTCacheMXBean.java line
57:
> 55: * the {@code endRecording} method is called. Examples:
> 56: *
> 57: * <p> java -XX:AOTCacheOutput=app.aot ....
Put this command, and the others below, in `{@code ...}`, and precede them with
a dollar prompt (`$`) so that they look more like command lines.
src/jdk.management/share/classes/jdk/management/HotSpotAOTCacheMXBean.java line
63:
> 61: * that will be used to generate the AOT cache file app.aot. In a
> future execution of this application,
> 62: * -XX:AOTCache=app.aot can be provided to improve the application's
> 63: * start-up and warm-up performance.
Tighten and clarify: `The JVM records optimization information for the current
application in the AOT cache file {@code app.aot}. in a future run of the
application, the option {@code -XX:AOTCache=app.aot} will cause the JVM to use
the cache to improve the application's startup and warmup performance.`
src/jdk.management/share/classes/jdk/management/HotSpotAOTCacheMXBean.java line
69:
> 67: *
> 68: * <blockquote>
> 69: * The JVM will record optimization information about the current
> application
`The JVM records optimization information for the current application in the
AOT configuration file {@code app.aotconfig}. ...`
src/jdk.management/share/classes/jdk/management/HotSpotAOTCacheMXBean.java line
84:
> 82: *
> 83: * <p> There are also no APIs to querying whether the AOT recording is
> in progress, or what AOT
> 84: * artifacts are being recorded.
Drop "Note:", it's meaningless. Merge these two paragraphs. s/to querying/to
query/. s/the AOT/an AOT/.
src/jdk.management/share/classes/jdk/management/HotSpotAOTCacheMXBean.java line
92:
> 90: * procedures rely on an external agent to select the correct moment to
> end training.
> 91: * In this way the selected length of training produces the correct set
> of AOT
> 92: * optimizations in the AOT archive, without interfering with the
> application code.
You seem to be saying here that using this method from within an application is
not necessarily the best approach, but you say it in a very roundabout way.
Consider something like:
* This method enables an application to end its own AOT recording
* programatically, but that is not necessarily the best approach. Doing so
* requires changing the application’s code, which might not be
* feasible. Even when it is feasible, injecting training-specific logic
* into the application reduces the similarity between training runs and
* production runs, potentially making the AOT cache less effective. It may
* be better to arrange for an external agent to end the training run,
* thereby creating an AOT cache without interfering with the application’s
* code.
```
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28010#discussion_r2586483272
PR Review Comment: https://git.openjdk.org/jdk/pull/28010#discussion_r2586486393
PR Review Comment: https://git.openjdk.org/jdk/pull/28010#discussion_r2586493320
PR Review Comment: https://git.openjdk.org/jdk/pull/28010#discussion_r2586488596
PR Review Comment: https://git.openjdk.org/jdk/pull/28010#discussion_r2586490840
PR Review Comment: https://git.openjdk.org/jdk/pull/28010#discussion_r2586506998
PR Review Comment: https://git.openjdk.org/jdk/pull/28010#discussion_r2586509392
PR Review Comment: https://git.openjdk.org/jdk/pull/28010#discussion_r2586515533
PR Review Comment: https://git.openjdk.org/jdk/pull/28010#discussion_r2586550031