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

8316342: CLHSDB "dumpclass" command produces invalid classes #15973

Closed

Conversation

ashu-mehra
Copy link
Contributor

@ashu-mehra ashu-mehra commented Sep 28, 2023

Please review this change to fix the operands of the bytecodes that operate on fields when dumping a class using SA.

Testing: hotspot_serviceability

I have also verified that test/hotspot/jtreg/serviceability/sa/ClhsdbDumpclass.javaClhsdbDumpclass.java, which is in the problem list because of this issue, passes with this change.
I have also verified it by dumping the class that has getstatic/putstatic bytecodes and comparing the bytecodes manually with the original classfile.


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-8316342: CLHSDB "dumpclass" command produces invalid classes (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 15973

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

Using diff file

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

Webrev

Link to Webrev Comment

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

bridgekeeper bot commented Sep 28, 2023

👋 Welcome back asmehra! 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 Sep 28, 2023
@openjdk
Copy link

openjdk bot commented Sep 28, 2023

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

  • serviceability

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 serviceability serviceability-dev@openjdk.org label Sep 28, 2023
@mlbridge
Copy link

mlbridge bot commented Sep 28, 2023

Webrevs

@plummercj
Copy link
Contributor

@matias9927 and/or @coleenp Should have a look at this.

cpoolIndex = getConstantPoolIndex(hotspotcode, bci + 1);
case Bytecodes._invokedynamic: {
int cpci = method.getNativeIntArg(bci + 1);
cpoolIndex = (short) cpCache.getIndyEntryAt(~cpci).getConstantPoolIndex();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this really suppose to be ~cpci and not just cpci?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's right. See

pool_index = mh->constants()->resolved_indy_entry_at(mh->constants()->decode_invokedynamic_index(cpci))->constant_pool_index();
and
static int decode_invokedynamic_index(int i) { assert(is_invokedynamic_index(i), ""); return ~i; }

I tend to use JvmtiClassFileReconstituter as the reference for the code involved in dumping the classfile, and that makes things easier to follow and implement.

@plummercj
Copy link
Contributor

Ok. The changes look good to me, but I don't have much of understanding of the hotspot code involved here, so I'll defer to a hotspot expert for the 2nd review.

@openjdk
Copy link

openjdk bot commented Sep 28, 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:

8316342: CLHSDB "dumpclass" command produces invalid classes

Reviewed-by: cjplummer, sspitsyn

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

  • 115b074: 8319944: Remove DynamicDumpSharedSpaces
  • c0507af: 8319818: Address GCC 13.2.0 warnings (stringop-overflow and dangling-pointer)
  • 3684b4b: 8306116: Update CLDR to Version 44.0
  • 88ccd64: 8296250: Update ICU4J to Version 74.1
  • 03db828: 8319650: Improve heap dump performance with class metadata caching
  • b41b00a: 8319820: Use unnamed variables in the FFM implementation
  • 4d650fe: 8319704: LogTagSet::set_output_level() should not accept NULL as LogOutput
  • 6f863b2: 8318636: Add jcmd to print annotated process memory map
  • e035637: 8319375: test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineLeakThrowable.java runs into OutOfMemoryError: Metaspace on AIX
  • 50f41d6: 8309893: Integrate ReplicateB/S/I/L/F/D nodes to Replicate node
  • ... and 574 more: https://git.openjdk.org/jdk/compare/750da0012931656cfd55f3e67c3f49ad7363ab8e...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.

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

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 28, 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.

Nice simplification.
This looks good.
Thanks,
Serguei

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 31, 2023

@ashu-mehra This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@ashu-mehra
Copy link
Contributor Author

I am returning from a break. Thanks @plummercj @sspitsyn for reviewing the changes.
It looks like this doesn't have any merge conflicts, so can still be integrated.

@ashu-mehra
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Nov 14, 2023

Going to push as commit 7bb1999.
Since your change was applied there have been 600 commits pushed to the master branch:

  • 97ea5bf: 8319961: JvmtiEnvBase doesn't zero _ext_event_callbacks
  • 25f9af9: 8319883: Zero: Use atomic built-ins for 64-bit accesses
  • 9c98270: 8254693: Add Panama feature to pass heap segments to native code
  • c80e691: 8319970: AArch64: enable tests compiler/intrinsics/Test(Long|Integer)UnsignedDivMod.java on aarch64
  • 856c280: 8319960: RISC-V: compiler/intrinsics/TestInteger/LongUnsignedDivMod.java failed with "counts: Graph contains wrong number of nodes"
  • cb7875d: 8318218: RISC-V: C2 CompressBits
  • 1535528: 8318479: [jmh] the test security.CacheBench failed for multiple threads run
  • 95bd92a: 8210807: Printing a JTable with a JScrollPane prints table without rows populated
  • 21cda19: 8309203: C2: remove copy-by-value of GrowableArray for InterfaceSet
  • b120a05: 8319406: x86: Shorter movptr(reg, imm) for 32-bit immediates
  • ... and 590 more: https://git.openjdk.org/jdk/compare/750da0012931656cfd55f3e67c3f49ad7363ab8e...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Nov 14, 2023

@ashu-mehra Pushed as commit 7bb1999.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated serviceability serviceability-dev@openjdk.org
3 participants