Skip to content

Conversation

@macarte
Copy link
Contributor

@macarte macarte commented Oct 28, 2025

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)


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change requires CSR request JDK-8369737 to be approved

Integration blocker

 ⚠️ Dependency #27965 must be integrated first

Issues

  • JDK-8369736: Add management interface for AOT cache creation (Enhancement - P3)
  • JDK-8369737: Add management interface for AOT cache creation (CSR)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28010/head:pull/28010
$ git checkout pull/28010

Update a local copy of the PR:
$ git checkout pull/28010
$ git pull https://git.openjdk.org/jdk.git pull/28010/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 28010

View PR using the GUI difftool:
$ git pr show -t 28010

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28010.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 28, 2025

👋 Welcome back macarte! A progress list of the required criteria for merging this PR into pr/27965 will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Oct 28, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented Oct 28, 2025

@macarte The following labels will be automatically applied to this pull request:

  • hotspot
  • jmx
  • serviceability

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 28, 2025
@mlbridge
Copy link

mlbridge bot commented Oct 28, 2025

Webrevs

* </blockquote>
*
* @return {@code true} if a recording was in progress and has been ended successfully; {@code false} otherwise.
*/
Copy link
Contributor

@AlanBateman AlanBateman Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are issues in the javadoc that will cause the docs target to fail, e.g. mismatched blockquote. Can you fix these up so that we can generate the docs from the changes in the PR?

Copy link
Contributor Author

@macarte macarte Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an easy way to test the correctness of the javadoc parts (I couldn't find an option for javadoc). The </blockquote >above is matched to a <blockquote> on line 88, but there is a <pre></pre> pair in between, is that the issue you are referring to?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make docs. The second blockquote is matched with another blockquote, not </blockquote>. In the example, which can be converted to a snippet, then then braces not matched so the end brace for {@code ... } get mixed up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that now - fixing ....


import java.lang.management.ManagementFactory;
import java.lang.management.PlatformManagedObject;
import java.util.concurrent.ForkJoinPool;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume there is no need to import ForkJoinPool.

/**
* Management interface for the JDK's Ahead of Time (AOT) optimizations.
*
* Currently, {@code HotSpotAOTCacheMXBean} defines one operation at this time to end the AOT recording.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you drop "Currently, ", it will be a bit clearer without it.

class HotSpotAOTCacheMXBeanApp {
public static void main(String[] args) {
System.out.println("Hello Leyden " + args[0]);
var aotBean = ManagementFactory.getPlatformMXBean(HotSpotAOTCacheMXBean.class);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This uses MF.getPlatformMXBean in the child VM. A more complete test would repeat with:

        MBeanServer server = ManagementFactory.getPlatformMBeanServer();
        HotSpotAOTCacheMXBean bean = ManagementFactory.newPlatformMXBeanProxy(server,
                "jdk.management:type=HotSpotAOTCacheMXBean",
                HotSpotAOTCacheMXBean.class);

In any case, it might be simpler to test that the MXBean is registered in the test itself, it doesn't need to be in the child VM.

import javax.management.ObjectName;

/**
* Management interface for the JDK's Ahead of Time (AOT) optimizations.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the word "optimizations" here but don't have a better one. Maybe "operation"? Still not great

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, one possible alternative is kind of implicit in the bean name:

"Management interface for the JDK's Ahead of Time (AOT) Cache"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

csr Pull request needs approved CSR before integration hotspot [email protected] jmx [email protected] rfr Pull request is ready for review serviceability [email protected]

Development

Successfully merging this pull request may close these issues.

4 participants