Skip to content

8355003: Implement Ahead-of-Time Method Profiling #24886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 28 commits into
base: master
Choose a base branch
from

Conversation

veresov
Copy link
Contributor

@veresov veresov commented Apr 25, 2025

Improve warm-up time by making profile data from a previous run of an application instantly available, when the HotSpot Java Virtual Machine starts. Specifically, enhance the AOT cache to store method execution profiles from training runs, reducing profiling delays in subsequent production runs.

More details in the JEP: https://bugs.openjdk.org/browse/JDK-8325147


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

Issue

  • JDK-8355003: Implement Ahead-of-Time Method Profiling (Sub-task - P4)

Contributors

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 24886

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 25, 2025

👋 Welcome back iveresov! A progress list of the required criteria for merging this PR into master 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 Apr 25, 2025

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

@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 25, 2025
@openjdk
Copy link

openjdk bot commented Apr 25, 2025

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

  • build
  • hotspot
  • 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.

@veresov
Copy link
Contributor Author

veresov commented Apr 25, 2025

/label hotspot-compiler
/label hotspot-runtime

@openjdk
Copy link

openjdk bot commented Apr 25, 2025

@veresov
The hotspot-compiler label was successfully added.

@openjdk
Copy link

openjdk bot commented Apr 25, 2025

@veresov
The hotspot-runtime label was successfully added.

@veresov
Copy link
Contributor Author

veresov commented Apr 25, 2025

/contributor jrose
/contributor vlivanov
/contributor iklam
/contributor kvn
/contributor shade

@openjdk
Copy link

openjdk bot commented Apr 25, 2025

@veresov Syntax: /contributor (add|remove) [@user | openjdk-user | Full Name <email@address>]. For example:

  • /contributor add @openjdk-bot
  • /contributor add duke
  • /contributor add J. Duke <[email protected]>

User names can only be used for users in the census associated with this repository. For other contributors you need to supply the full name and email address.

@openjdk
Copy link

openjdk bot commented Apr 25, 2025

@veresov Syntax: /contributor (add|remove) [@user | openjdk-user | Full Name <email@address>]. For example:

  • /contributor add @openjdk-bot
  • /contributor add duke
  • /contributor add J. Duke <[email protected]>

User names can only be used for users in the census associated with this repository. For other contributors you need to supply the full name and email address.

@openjdk
Copy link

openjdk bot commented Apr 25, 2025

@veresov Syntax: /contributor (add|remove) [@user | openjdk-user | Full Name <email@address>]. For example:

  • /contributor add @openjdk-bot
  • /contributor add duke
  • /contributor add J. Duke <[email protected]>

User names can only be used for users in the census associated with this repository. For other contributors you need to supply the full name and email address.

@openjdk
Copy link

openjdk bot commented Apr 25, 2025

@veresov Syntax: /contributor (add|remove) [@user | openjdk-user | Full Name <email@address>]. For example:

  • /contributor add @openjdk-bot
  • /contributor add duke
  • /contributor add J. Duke <[email protected]>

User names can only be used for users in the census associated with this repository. For other contributors you need to supply the full name and email address.

@openjdk
Copy link

openjdk bot commented Apr 25, 2025

@veresov Syntax: /contributor (add|remove) [@user | openjdk-user | Full Name <email@address>]. For example:

  • /contributor add @openjdk-bot
  • /contributor add duke
  • /contributor add J. Duke <[email protected]>

User names can only be used for users in the census associated with this repository. For other contributors you need to supply the full name and email address.

@veresov
Copy link
Contributor Author

veresov commented Apr 25, 2025

/contributor add jrose
/contributor add vlivanov
/contributor add iklam
/contributor add kvn
/contributor add shade

@openjdk
Copy link

openjdk bot commented Apr 25, 2025

@veresov
Contributor John R Rose <[email protected]> successfully added.

@openjdk
Copy link

openjdk bot commented Apr 25, 2025

@veresov
Contributor Vladimir Ivanov <[email protected]> successfully added.

@openjdk
Copy link

openjdk bot commented Apr 25, 2025

@veresov
Contributor Ioi Lam <[email protected]> successfully added.

@openjdk
Copy link

openjdk bot commented Apr 25, 2025

@veresov
Contributor Vladimir Kozlov <[email protected]> successfully added.

@openjdk
Copy link

openjdk bot commented Apr 25, 2025

@veresov
Contributor Aleksey Shipilev <[email protected]> successfully added.

@mlbridge
Copy link

mlbridge bot commented Apr 25, 2025

Webrevs

Copy link
Contributor

@vnkozlov vnkozlov left a comment

Choose a reason for hiding this comment

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

In general it is okay.

Please, use UL with (aot, training) tags for your code.

I noticed (and added comment) that you use guarantee() which crashes VM when you call new verify methods. Can you disable TD instead and continue execution?

* @summary Sanity test of combinations of the diagnostic flags [+-]AOTRecordTraining and [+-]AOTReplayTraining
* @requires vm.cds
* @comment work around JDK-8345635
* @requires !vm.jvmci.enabled
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding:

 * @requires vm.cds.supports.aot.class.linking
 * @requires vm.flagless

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could you please explain why? @iklam, what do you think?

Copy link
Member

Choose a reason for hiding this comment

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

I think it's OK to test without these two additional flags. This will make sure that the two diagnostic flags don't have any bad side effect even if AOT class linking is disabled (due to flags like -XX:+UseZGC).

Copy link
Contributor

Choose a reason for hiding this comment

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

I see them in aotClassLinking/AOTClassLinkingVMOptions.java test.
@veresov please, add link to your mach5 testing to JBS. And add to description what tests you already ran.

Copy link
Member

Choose a reason for hiding this comment

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

OK, let's add those two @requires to be consistent with other tests.

@@ -1725,8 +1793,26 @@ bool MethodData::profile_parameters_for_method(const methodHandle& m) {
}

void MethodData::metaspace_pointers_do(MetaspaceClosure* it) {
log_trace(cds)("Iter(MethodData): %p", this);
log_trace(cds)("Iter(MethodData): %p for %p %s", this, _method, _method->name_and_sig_as_C_string());
Copy link
Contributor

Choose a reason for hiding this comment

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

We discussed yesterday and we need to use aot instead cds for Leyden. aot tag is already in mainline.
I suggest to use new tag (aot, training) to separate your output from general CDS/AOT output.

@@ -739,6 +767,10 @@ void ArchiveBuilder::relocate_metaspaceobj_embedded_pointers() {
log_info(cds)("Relocating embedded pointers in core regions ... ");
relocate_embedded_pointers(&_rw_src_objs);
relocate_embedded_pointers(&_ro_src_objs);
log_info(cds)("Relocating %zu pointers, %zu tagged, %zu nulled",
Copy link
Contributor

Choose a reason for hiding this comment

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

log_info(aot) if it is Leyden related.

bool is_excluded = !holder()->is_loaded() || SystemDictionaryShared::check_for_exclusion(holder(), nullptr);
if (is_excluded) {
ResourceMark rm;
log_debug(cds)("Cleanup KTD %s", name()->as_klass_external_name());
Copy link
Contributor

Choose a reason for hiding this comment

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

log_debug(aot, training)

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

Successfully merging this pull request may close these issues.

3 participants