Skip to content

Conversation

@coleenp
Copy link
Contributor

@coleenp coleenp commented Nov 1, 2022

Use identity_hash for objects in the JVMTI TagMap table. If the object has no hashcode, it's not in the table.
Tested with tier1-6.


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

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 10938

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 1, 2022

👋 Welcome back coleenp! 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 Nov 1, 2022

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

  • hotspot
  • serviceability
  • shenandoah

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 shenandoah shenandoah-dev@openjdk.org labels Nov 1, 2022
@coleenp coleenp marked this pull request as ready for review November 2, 2022 16:41
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 2, 2022
@mlbridge
Copy link

mlbridge bot commented Nov 2, 2022

Webrevs

@coleenp
Copy link
Contributor Author

coleenp commented Nov 2, 2022

/test

Copy link

@kimbarrett kimbarrett 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. Yay code deletion!

I was particularly happy to see set_needs_rehashing removed from all the GCs.

As a followup, I think CollectedHeap::hash_oop is unused after this change.

@openjdk
Copy link

openjdk bot commented Nov 2, 2022

@coleenp 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:

8256072: Eliminate JVMTI tagmap rehashing

Reviewed-by: kbarrett, eosterlund

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

  • 4338f52: 8294241: Deprecate URL public constructors
  • 68209ad: 8288232: Address typos in jar man page
  • 2ff9d3a: 8294858: XMLStreamReader does not respect jdk.xml.maxXMLNameLimit=0 for namespace names
  • 72f74df: 8292427: Improve specification of InflaterInputStream.fill()
  • 53905e6: 8178355: IdentityHashMap uses identity-based comparison for values everywhere except remove(K,V) and replace(K,V,V)
  • 25dfcbd: 8289689: (fs) Re-examine the need for normalization to Unicode Normalization Format D (macOS)
  • b7442d1: 8295653: Add a graph of the sealed class hierarchy for marked classes
  • 59a13b1: 8295872: [PPC64] JfrGetCallTrace: Need pc == nullptr check before frame constructor
  • 2a79dfc: 8295774: Write a test to verify List sends ItemEvent/ActionEvent
  • cc3c5a1: 8296101: nmethod::is_unloading result unstable with concurrent unloading
  • ... and 6 more: https://git.openjdk.org/jdk/compare/c7b95a895fe66a00c754b590ebde53087f183c51...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 Nov 2, 2022
@coleenp
Copy link
Contributor Author

coleenp commented Nov 2, 2022

Thanks for the code review Kim. I removed the function that you noticed is now unused.

Copy link

@kimbarrett kimbarrett 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. Maybe just a little more deletion.


inline uint32_t ZHeap::hash_oop(uintptr_t addr) const {
const uintptr_t offset = ZAddress::offset(addr);
return ZHash::address_to_uint32(offset);

Choose a reason for hiding this comment

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

I think removal of the call to ZHash::address_to_uint32 means this file no longer needs to include zHash.inline.hpp.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you are right Kim.

Copy link
Contributor

@fisk fisk left a comment

Choose a reason for hiding this comment

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

I love the use of identity hash code instead of address bits. There might be an issue with displaced markWords though where we need to be careful.

}

JvmtiTagMapEntry* JvmtiTagMapTable::find(oop obj) {
if (obj->has_no_hash()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This new function you added checks if the markWord has a hashCode. If there is a displaced markWord, then it very well might be that there is a hashCode, but it is in the displaced markWord - either in a stack lock or an ObjectMonitor. Bailing here does not seem correct, as it might actually be in the table even if there is no hashCode in the markWord. Is this an optimization?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is an optimization. I don't think we want to create an identity hash for all oops just for lookup. Is there a better way to find if an oop hashCode?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was hoping there was just a bit but you're right. I renamed it to fast_no_hash_check() and only return true if the object is unlocked and added a comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm rerunning jvmti and jdi tests locally.

Copy link
Contributor

@fisk fisk 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 now to me!

@coleenp
Copy link
Contributor Author

coleenp commented Nov 3, 2022

Thanks Erik and Kim for reviewing!

Copy link

@kimbarrett kimbarrett left a comment

Choose a reason for hiding this comment

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

Good thing Erik caught the displaced markword issue. Looks even better now.


// identity hash; returns the identity hash key (computes it if necessary)
inline bool has_no_hash();
inline bool fast_no_hash_check();

Choose a reason for hiding this comment

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

Seems like fast_no_hash_check ought to be later in this grouping. The preceding comment is about identity_hash.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, this makes sense. Thanks.

@coleenp
Copy link
Contributor Author

coleenp commented Nov 3, 2022

Thanks for the re-review Kim. Recompiled with the trivial change.
/integrate

@openjdk
Copy link

openjdk bot commented Nov 3, 2022

Going to push as commit 94eb25a.
Since your change was applied there have been 16 commits pushed to the master branch:

  • 4338f52: 8294241: Deprecate URL public constructors
  • 68209ad: 8288232: Address typos in jar man page
  • 2ff9d3a: 8294858: XMLStreamReader does not respect jdk.xml.maxXMLNameLimit=0 for namespace names
  • 72f74df: 8292427: Improve specification of InflaterInputStream.fill()
  • 53905e6: 8178355: IdentityHashMap uses identity-based comparison for values everywhere except remove(K,V) and replace(K,V,V)
  • 25dfcbd: 8289689: (fs) Re-examine the need for normalization to Unicode Normalization Format D (macOS)
  • b7442d1: 8295653: Add a graph of the sealed class hierarchy for marked classes
  • 59a13b1: 8295872: [PPC64] JfrGetCallTrace: Need pc == nullptr check before frame constructor
  • 2a79dfc: 8295774: Write a test to verify List sends ItemEvent/ActionEvent
  • cc3c5a1: 8296101: nmethod::is_unloading result unstable with concurrent unloading
  • ... and 6 more: https://git.openjdk.org/jdk/compare/c7b95a895fe66a00c754b590ebde53087f183c51...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Nov 3, 2022

@coleenp Pushed as commit 94eb25a.

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

@coleenp coleenp deleted the jvmti branch November 3, 2022 17:27
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 shenandoah shenandoah-dev@openjdk.org

Development

Successfully merging this pull request may close these issues.

3 participants