Skip to content
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

8267985: Allow AsyncGetCallTrace and JFR to walk a stub frame #4274

Closed
wants to merge 1 commit into from

Conversation

@luhenry
Copy link
Member

@luhenry luhenry commented May 31, 2021

When the signal sent for AsyncGetCallTrace or JFR would land on a stub
(like arraycopy), it wouldn't be able to detect the sender (caller)
frame because _cb->frame_size() == 0.

Because we fully control how the prolog and epilog of stub code is
generated, we know there are two cases:

  1. A stack frame is allocated via macroAssembler->enter(), and consists
    in push rbp; mov rsp, rbp;.
  2. No stack frames are allocated and rbp is left unchanged and rsp is
    decremented with the call instruction that push the return pc on the
    stack.

For case 1., we can easily know the sender frame by simply looking at
rbp, especially since we know that all stubs preserve the frame pointer
(on x86 at least).

For case 2., we end up returning the sender's sender, but that already
gives us more information than what we have today.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8267985: Allow AsyncGetCallTrace and JFR to walk a stub frame

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/4274/head:pull/4274
$ git checkout pull/4274

Update a local copy of the PR:
$ git checkout pull/4274
$ git pull https://git.openjdk.java.net/jdk pull/4274/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4274

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/4274.diff

When the signal sent for AsyncGetCallTrace or JFR would land on a stub
(like arraycopy), it wouldn't be able to detect the sender (caller)
frame because `_cb->frame_size() == 0`.

Because we fully control how the prolog and epilog of stub code is
generated, we know there are two cases:
1. A stack frame is allocated via macroAssembler->enter(), and consists
in `push rbp; mov rsp, rbp;`.
2. No stack frames are allocated and rbp is left unchanged and rsp is
decremented with the `call` instruction that push the return `pc` on the
stack.

For case 1., we can easily know the sender frame by simply looking at
rbp, especially since we know that all stubs preserver the frame pointer
(on x86 at least).

For case 2., we end up returning the sender's sender, but that already
gives us more information than what we have today.
@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented May 31, 2021

👋 Welcome back luhenry! 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 openjdk bot added the rfr label May 31, 2021
@openjdk
Copy link

@openjdk openjdk bot commented May 31, 2021

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

  • hotspot

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 label May 31, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented May 31, 2021

Webrevs

@luhenry
Copy link
Member Author

@luhenry luhenry commented Jun 3, 2021

Depends on #4337

@luhenry luhenry changed the title JDK-8267985: Allow AsyncGetCallTrace and JFR to walk a stub frame 8267985: Allow AsyncGetCallTrace and JFR to walk a stub frame Jun 3, 2021
@luhenry luhenry closed this Jun 8, 2021
@luhenry luhenry deleted the fix-8178287-1 branch Jun 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
1 participant