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

8312623: SA add NestHost and NestMembers attributes when dumping class #15005

Closed

Conversation

ashu-mehra
Copy link
Contributor

@ashu-mehra ashu-mehra commented Jul 24, 2023

This patch adds NestHost and NestMembers attributes to the class dumped by SA.

Testing: test/hotspot/jtreg/serviceability/sa and test/jdk/sun/tools/jhsdb
Manual testing by dumping j.l.String and j.l.String$CaseInsensitiveComparator classes.
j.l.String shows one entry in NestMembers attribute for j.l.String$CaseInsensitiveComparator and j.l.String$CaseInsensitiveComparator has j.l.String as its NestHost.


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-8312623: SA add NestHost and NestMembers attributes when dumping class (Sub-task - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 15005

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

Using diff file

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

Webrev

Link to Webrev Comment

Signed-off-by: Ashutosh Mehra <asmehra@redhat.com>
@bridgekeeper
Copy link

bridgekeeper bot commented Jul 24, 2023

👋 Welcome back ashu-mehra! 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 Pull request is ready for review label Jul 24, 2023
@openjdk
Copy link

openjdk bot commented Jul 24, 2023

@ashu-mehra The following labels will be automatically applied to this pull request:

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

@openjdk openjdk bot added serviceability serviceability-dev@openjdk.org hotspot hotspot-dev@openjdk.org labels Jul 24, 2023
@mlbridge
Copy link

mlbridge bot commented Jul 24, 2023

Webrevs

Copy link
Contributor

@plummercj plummercj left a comment

Choose a reason for hiding this comment

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

Looks good.

@openjdk
Copy link

openjdk bot commented Jul 24, 2023

@ashu-mehra 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:

8312623: SA add NestHost and NestMembers attributes when dumping class

Reviewed-by: cjplummer, sspitsyn, stuefe

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 126 new commits pushed to the master branch:

  • 017e0c7: 8310388: Shenandoah: Auxiliary bitmap is not madvised for THP
  • f66cd50: 8313564: Fix -Wconversion warnings in classfile code
  • e8a37b9: 8313248: C2: setScopedValueCache intrinsic exposes nullptr pre-values to store barriers
  • 29f1d8e: 8313707: GHA: Bootstrap sysroots with --variant=minbase
  • 61c58fd: 8312976: MatchResult produces StringIndexOutOfBoundsException for groups outside match
  • 5d23295: 8313251: Add NativeLibraryLoad event
  • c4b8574: 8311938: Add default cups include location for configure on AIX
  • 10a2605: 8294979: test/jdk/tools/jlink 3 test classes use ASM library
  • e8c325d: 8313394: Array Elements in OldObjectSample event has the incorrect description
  • d60352e: 8311006: missing @SInCE info in jdk.xml.dom
  • ... and 116 more: https://git.openjdk.org/jdk/compare/7dd47998f00712515c25fb852b6c0cf958120508...master

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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@plummercj, @sspitsyn, @tstuefe) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jul 24, 2023
Copy link
Contributor

@sspitsyn sspitsyn left a comment

Choose a reason for hiding this comment

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

Looks good.
Thanks,
Serguei

@dholmes-ora
Copy link
Member

We need to be sure this works as expected for top-level classes that have no nest members, and deeply nested nest members, plus dynamically injected hidden classes that are nest members. I'm unclear if this is intended to only expose the same details as would be statically defined in the attribute in the classfile?

@ashu-mehra
Copy link
Contributor Author

@dholmes-ora sorry for responding late. I got sidetracked by some other work.

We need to be sure this works as expected for top-level classes that have no nest members, and deeply nested nest members, plus dynamically injected hidden classes that are nest members.

I am not sure I understand this concern. We are getting nest-host and nest-members from the InstanceKlass. As long as this information is recorded in InstanceKlass, it would work. Can you please elaborate your concern about the cases you feel may not work.

I'm unclear if this is intended to only expose the same details as would be statically defined in the attribute in the classfile?

It is to expose the details as the JVM sees, which may be different from what is statically defined in the classfile if agents are involved.

@dholmes-ora
Copy link
Member

@ashu-mehra you indicated that you had only done two basic manual tests to check the output. You need to check it for the cases that I flagged too. In the VM every top-level class is its own nest-host, but that is not expressed in a classfile attribute (it is just the defined semantics) so displaying this as-if it were an explicit attribute may not be right.

@ashu-mehra
Copy link
Contributor Author

@dholmes-ora I confirmed there is no nest-host or nest-members attributes generated by this patch for a top level class which doesn't have any nest-members. Is that what you wanted to verify?

@dholmes-ora
Copy link
Member

@ashu-mehra That was one case. I also want to know that you have tested deeply nested classes; and hidden classes (if applicable). Thanks.

@ashu-mehra
Copy link
Contributor Author

@dholmes-ora I verified the case for hidden dynamically injected classes. The dumped class data for a hidden dynamically injected class does not have any Nest-Host attribute. When generating these classes dynamically the VM does not expose nest-host information in the class data, but sets the nest-host directly in the InstanceKlass.

Also verified the case for deeply nested classes by creating chain of nested classes as:

class DeepNest {
  class NestLvl1 {
    class NestLvl2 {
      class NestLvl3 {
      }
    }
  }
} 

Only DeepNest has the NestMembers attribute which lists all the NestLvl[1-3] classes. Rest all have DeepNest as the NestHost attribute.

Does this cover all the cases you flagged?

@dholmes-ora
Copy link
Member

@ashu-mehra thanks for doing the additional testing. Pity there is no regression/functional test for this.

@ashu-mehra
Copy link
Contributor Author

Pity there is no regression/functional test for this.

@dholmes-ora @plummercj I have improved dumpclass tests to cover up some cases for this PR and JDK-8311971. If the tests makes sense I would like to include it in this PR. Is that okay?

@plummercj
Copy link
Contributor

@dholmes-ora @plummercj I have improved dumpclass tests to cover up some cases for this PR and JDK-8311971. If the tests makes sense I would like to include it in this PR. Is that okay?

I think given the scope of the changes it would be better to do this with a "Improve SA dumpclass testing" CR/PR.

@ashu-mehra
Copy link
Contributor Author

@plummercj

I think given the scope of the changes it would be better to do this with a "Improve SA dumpclass testing" CR/PR.

Okay. I guess this can then be integrated as is. Thanks for the reviews.

@ashu-mehra
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Aug 3, 2023
@openjdk
Copy link

openjdk bot commented Aug 3, 2023

@ashu-mehra
Your change (at version 27aa99e) is now ready to be sponsored by a Committer.

@ashu-mehra
Copy link
Contributor Author

@plummercj can you please sponsor it.

Copy link
Member

@tstuefe tstuefe left a comment

Choose a reason for hiding this comment

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

Belatedly, and unnecessary since you have two reviews, but this looks good to me too.

@plummercj
Copy link
Contributor

/sponsor

@openjdk
Copy link

openjdk bot commented Aug 4, 2023

Going to push as commit 873d117.
Since your change was applied there have been 126 commits pushed to the master branch:

  • 017e0c7: 8310388: Shenandoah: Auxiliary bitmap is not madvised for THP
  • f66cd50: 8313564: Fix -Wconversion warnings in classfile code
  • e8a37b9: 8313248: C2: setScopedValueCache intrinsic exposes nullptr pre-values to store barriers
  • 29f1d8e: 8313707: GHA: Bootstrap sysroots with --variant=minbase
  • 61c58fd: 8312976: MatchResult produces StringIndexOutOfBoundsException for groups outside match
  • 5d23295: 8313251: Add NativeLibraryLoad event
  • c4b8574: 8311938: Add default cups include location for configure on AIX
  • 10a2605: 8294979: test/jdk/tools/jlink 3 test classes use ASM library
  • e8c325d: 8313394: Array Elements in OldObjectSample event has the incorrect description
  • d60352e: 8311006: missing @SInCE info in jdk.xml.dom
  • ... and 116 more: https://git.openjdk.org/jdk/compare/7dd47998f00712515c25fb852b6c0cf958120508...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Aug 4, 2023
@openjdk openjdk bot closed this Aug 4, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Aug 4, 2023
@openjdk
Copy link

openjdk bot commented Aug 4, 2023

@plummercj @ashu-mehra Pushed as commit 873d117.

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

@ashu-mehra
Copy link
Contributor Author

Thanks every one for reviewing this PR.

@ashu-mehra ashu-mehra deleted the sa-nesthost-nestmembers branch August 4, 2023 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated serviceability serviceability-dev@openjdk.org
5 participants