Skip to content

Conversation

@reinrich
Copy link
Member

@reinrich reinrich commented Feb 14, 2025

This pr changes JavaThread::pd_get_top_frame_for_profiling to better address situations where

  1. JavaThread::last_Java_sp() returns != null
  2. JavaThread::last_Java_pc() returns null

If the runtime needs to walk the stack of a java thread in that state, e.g. for gc purposes, it finds the last java pc relative to the last java sp (see frame::setup()).

This relies on the runtime method being called to store the return pc to its caller's abi which it will do when pushing a new frame for calling another method.

For an asynchronous interrupt to sample the stack this means: if there isn't at least one frame between the last java frame and the frame where the interrupt occurred then we can't be sure that the return pc was already saved and pd_get_top_frame_for_profiling() needs to return false indicating failure.

Otherwise we can and should proceed constructing a frame even though JavaThread::last_Java_pc() returned null.

Testing:

  • DaCapo Tomcat with async-profiler on a fastdebug build.
  • Tier 1-4 of hotspot and jdk on the main platforms and also on Linux/PPC64le and AIX.

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-8350106: [PPC] Avoid ticks_unknown_not_Java AsyncGetCallTrace() if JavaFrameAnchor::_last_Java_pc not set (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 23640

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 14, 2025

👋 Welcome back rrich! 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 Feb 14, 2025

@reinrich This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8350106: [PPC] Avoid ticks_unknown_not_Java AsyncGetCallTrace() if JavaFrameAnchor::_last_Java_pc not set

Reviewed-by: mdoerr

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 6 new commits pushed to the master branch:

  • d90b79a: 8351046: Rename ObjectMonitor functions
  • e90b6bd: 8350638: Make keyboard navigation more usable in API docs
  • 4867a4c: 8351280: Mark Assertion Predicates useless instead of replacing them by a constant directly
  • 64caf08: 8350572: ZGC: Enhance z_verify_safepoints_are_blocked interactions with VMError
  • fb0efbe: 8333578: Fix uses of overaligned types induced by ZCACHE_ALIGNED
  • 99547c5: 8346825: [JVMCI] Remove NativeImageReinitialize annotation

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk
Copy link

openjdk bot commented Feb 14, 2025

@reinrich The following label will be automatically applied to this pull request:

  • hotspot-runtime

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

@openjdk openjdk bot added the hotspot-runtime hotspot-runtime-dev@openjdk.org label Feb 14, 2025
@reinrich reinrich force-pushed the 8350106_agct_last_java_pc_null branch from 190911d to 9d3aa98 Compare February 17, 2025 16:52
@reinrich reinrich force-pushed the 8350106_agct_last_java_pc_null branch from 9d3aa98 to 768bfcb Compare February 19, 2025 11:46
@reinrich reinrich marked this pull request as ready for review February 25, 2025 09:30
@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 25, 2025
@mlbridge
Copy link

mlbridge bot commented Feb 25, 2025

Webrevs

Copy link
Contributor

@TheRealMDoerr TheRealMDoerr left a comment

Choose a reason for hiding this comment

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

Nice enhancement to get more samples! LGTM.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Feb 25, 2025
@reinrich
Copy link
Member Author

Test failure on aarch64 is unrelated.
Thanks for the review Martin.
/integrate

@openjdk
Copy link

openjdk bot commented Mar 11, 2025

Going to push as commit 030c85d.
Since your change was applied there have been 25 commits pushed to the master branch:

  • 0ad9a10: 8351146: JFR: JavaMonitorInflate event should default to no threshold and be disabled
  • b957e5e: 8351322: Parameterize link option for pthreads
  • af9af7e: 8351145: RISC-V: only enable some crypto intrinsic when AvoidUnalignedAccess == false
  • 83de340: 8343789: Move mutable nmethod data out of CodeCache
  • 0de2cdd: 8351458: (ch) Move preClose to UnixDispatcher
  • cd9f1d3: 8286204: [Accessibility,macOS,VoiceOver] VoiceOver reads the spinner value 10 as 1 when user iterates to 10 for the first time on macOS
  • 4cf6316: 8351414: C2: MergeStores must happen after RangeCheck smearing
  • 8a5ed47: 8350148: Native stack overflow when writing Java heap objects into AOT cache
  • 5928209: 8347405: MergeStores with reverse bytes order value
  • f984c2b: 8351505: (fs) Typo in the documentation of java.nio.file.spi.FileSystemProvider.getFileSystem()
  • ... and 15 more: https://git.openjdk.org/jdk/compare/ec683a18bcd8a8282989ba97238899d6375f43c8...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Mar 11, 2025
@openjdk openjdk bot closed this Mar 11, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Mar 11, 2025
@openjdk
Copy link

openjdk bot commented Mar 11, 2025

@reinrich Pushed as commit 030c85d.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@shipilev
Copy link
Member

Apparently causes #24216, take a look?

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

Labels

hotspot-runtime hotspot-runtime-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants