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

8264734: Some SA classes could use better hashCode() implementation #3522

Closed
wants to merge 4 commits into from

Conversation

@kariya-mitsuru
Copy link
Contributor

@kariya-mitsuru kariya-mitsuru commented Apr 15, 2021

The current hashCode implementation of SA's Address subclasses ignores the upper 32 bits of the long value.
This PR changes to use Long.hashCode instead.


Progress

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

Issue

  • JDK-8264734: Some SA classes could use better hashCode() implementation

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3522

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

Using diff file

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

@bridgekeeper bridgekeeper bot added the oca label Apr 15, 2021
@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Apr 15, 2021

Hi @kariya-mitsuru, welcome to this OpenJDK project and thanks for contributing!

We do not recognize you as Contributor and need to ensure you have signed the Oracle Contributor Agreement (OCA). If you have not signed the OCA, please follow the instructions. Please fill in your GitHub username in the "Username" field of the application. Once you have signed the OCA, please let us know by writing /signed in a comment in this pull request.

If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please use "Add GitHub user kariya-mitsuru" as summary for the issue.

If you are contributing this work on behalf of your employer and your employer has signed the OCA, please let us know by writing /covered in a comment in this pull request.

Loading

@openjdk openjdk bot changed the title 8264734: SA's Address subclasses could use better hashCode() implemen… 8264734: SA's Address subclasses could use better hashCode() implementation Apr 15, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Apr 15, 2021

@kariya-mitsuru 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.

Loading

@kariya-mitsuru
Copy link
Contributor Author

@kariya-mitsuru kariya-mitsuru commented Apr 15, 2021

/covered

Loading

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Apr 15, 2021

Thank you! Please allow for a few business days to verify that your employer has signed the OCA. Also, please note that pull requests that are pending an OCA check will not usually be evaluated, so your patience is appreciated!

Loading

@mlbridge
Copy link

@mlbridge mlbridge bot commented Apr 28, 2021

Loading

Copy link
Contributor

@plummercj plummercj left a comment

Please update all copyright dates to 2021. Only the latest year need to be updated. For example:

* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.

becomes

* Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.

Loading

@plummercj
Copy link
Contributor

@plummercj plummercj commented Apr 28, 2021

Also, please give a proper description of the PR. Right now it just says "…tation"

Loading

@plummercj
Copy link
Contributor

@plummercj plummercj commented Apr 29, 2021

/contributor add @kariya-mitsuru

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Apr 29, 2021

@plummercj Only the author (@kariya-mitsuru) is allowed to issue the contributor command.

Loading

@plummercj
Copy link
Contributor

@plummercj plummercj commented Apr 29, 2021

@kariya-mitsuru Please enable github actions on your jdk personal fork to enable the pre-submit testing. Start with the following link:

https://github.com/kariya-mitsuru/jdk/actions

Click on "Settings" tab and then click on "Actions" from the list of settings (not the "Actions" tab). Then enable "Allow all Actions".

Loading

@kariya-mitsuru
Copy link
Contributor Author

@kariya-mitsuru kariya-mitsuru commented Apr 29, 2021

Please update all copyright dates to 2021.

Thank you for your advice.
I just updated the copyright.

Loading

@kariya-mitsuru
Copy link
Contributor Author

@kariya-mitsuru kariya-mitsuru commented Apr 29, 2021

Also, please give a proper description of the PR. Right now it just says "…tation"

Oh, I'm embarrassed to say that I completely overlooked this.
I just updated the description.

Loading

@kariya-mitsuru
Copy link
Contributor Author

@kariya-mitsuru kariya-mitsuru commented Apr 29, 2021

Please enable github actions on your jdk personal fork to enable the pre-submit testing.

I've changed the settings.

Loading

@kevinjwalls
Copy link

@kevinjwalls kevinjwalls commented Apr 29, 2021

Hi -
There are a few more places where a long is cast to an int and used as the hashCode:

open/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/amd64/WindbgAMD64Thread.java

public int hashCode() {
return (int) getThreadID();
}

open/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/x86/WindbgX86Thread.java
open/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shenandoah/ShenandoahHeapRegion.java

open/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java
getThreadHashCode(long id) returns a truncated long if it caught a RemoteException.

If you have time, these could all use the same change?

Loading

@kariya-mitsuru
Copy link
Contributor Author

@kariya-mitsuru kariya-mitsuru commented Apr 29, 2021

If you have time, these could all use the same change?

I have enough time to change them.
May I mix that fix into this pull request?

Loading

@kevinjwalls
Copy link

@kevinjwalls kevinjwalls commented Apr 30, 2021

Thanks, yes it can definitely be an update to this change.

We can update the bug title, as I notice that is specific to Address classes, but as there are only a few more methods doing the same truncation, it makes sense to include them. e.g. "Some SA classes could use better hashCode() implementation."

Loading

@kariya-mitsuru kariya-mitsuru changed the title 8264734: SA's Address subclasses could use better hashCode() implementation 8264734: Some SA classes could use better hashCode() implementation May 2, 2021
@kariya-mitsuru
Copy link
Contributor Author

@kariya-mitsuru kariya-mitsuru commented May 2, 2021

I found that WindbgAARCH64Thread is the same, so I changed it together.

Loading

@kariya-mitsuru
Copy link
Contributor Author

@kariya-mitsuru kariya-mitsuru commented May 2, 2021

I have changed the title of this PR but I cannot change the title of issue JDK-8264734.
Would it have been better if I hadn't changed the title?

Loading

@kevinjwalls
Copy link

@kevinjwalls kevinjwalls commented May 4, 2021

No problem. I updated the JBS title to match this. I think the warning about title mismatch has gone.

Loading

@kariya-mitsuru
Copy link
Contributor Author

@kariya-mitsuru kariya-mitsuru commented May 10, 2021

@plummercj Would you please check the changes again?
Also, should I issue the /contributor command?

Loading

@plummercj
Copy link
Contributor

@plummercj plummercj commented May 10, 2021

Also, should I issue the /contributor command?

I don't think you need to. I tried using it to add you as a contributor because I thought it might be necessary since you don't have an openjdk username yet, but I was told that it is not necessary since you are the author of the PR.

Loading

@plummercj
Copy link
Contributor

@plummercj plummercj commented May 10, 2021

Some of the more recently changed files need updates to the Oracle copyrights. WindbgAARCH64Thread.java is a bit different in that it currently only has a 2020 date. It should be changed to the following:

* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.

Note I'm only requesting updates to the Oracle copyrights.

Loading

@kariya-mitsuru
Copy link
Contributor Author

@kariya-mitsuru kariya-mitsuru commented May 11, 2021

I don't think you need to.

Sure.

Some of the more recently changed files need updates to the Oracle copyrights.

I'm sorry for the stupid mistake.
I just updated the copyright.

Note I'm only requesting updates to the Oracle copyrights.

I made no change to ShenandoahHeapRegion.java since it has no Oracle copyright line.
If the line need to be added, could you please let me know?

Loading

Copy link
Contributor

@plummercj plummercj left a comment

Changes look good.

Loading

@openjdk
Copy link

@openjdk openjdk bot commented May 11, 2021

⚠️ @kariya-mitsuru the full name on your profile does not match the author name in this pull requests' HEAD commit. If this pull request gets integrated then the author name from this pull requests' HEAD commit will be used for the resulting commit. If you wish to push a new commit with a different author name, then please run the following commands in a local repository of your personal fork:

$ git checkout JDK-8264734
$ git commit -c user.name='Preferred Full Name' --allow-empty -m 'Update full name'
$ git push

Loading

@openjdk
Copy link

@openjdk openjdk bot commented May 11, 2021

@kariya-mitsuru 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:

8264734: Some SA classes could use better hashCode() implementation

Reviewed-by: cjplummer, kevinw

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

  • 3c47cab: 8261034: improve jcmd GC.class_histogram to support parallel
  • ed32e02: 8241187: ToolBox::grep should allow for negative filtering
  • cc03734: 8266925: Add a test to verify that hidden class's members are not statically invocable
  • 271a0c7: 8047218: [TEST_BUG] java/awt/FullScreen/AltTabCrashTest/AltTabCrashTest.java fails with exception
  • 1a0ff28: 8255035: Update BCEL to Version 6.5.0
  • 57c6ba6: 8266822: Rename MetaspaceShared::is_old_class to be more explicit about what "old" means
  • 616244f: 8266937: Remove Compile::reshape_address
  • 974b9f7: 8266773: Release VM is broken with GCC 9 after 8214237
  • f6c5a6b: 8266784: java/text/Collator/RuleBasedCollatorTest.java fails with jtreg 6
  • 1356116: 8266456: Replace direct TKit.run() calls with jdk.jpackage.test.Annotations.Test annotation
  • ... and 466 more: https://git.openjdk.java.net/jdk/compare/94067446ba6ef46adb54307226bd916ce1027013...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, @kevinjwalls) 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).

Loading

@openjdk openjdk bot added the ready label May 11, 2021
@kariya-mitsuru
Copy link
Contributor Author

@kariya-mitsuru kariya-mitsuru commented May 12, 2021

/integrate

Loading

@openjdk openjdk bot added the sponsor label May 12, 2021
@openjdk
Copy link

@openjdk openjdk bot commented May 12, 2021

@kariya-mitsuru
Your change (at version 71b663c) is now ready to be sponsored by a Committer.

Loading

@kariya-mitsuru
Copy link
Contributor Author

@kariya-mitsuru kariya-mitsuru commented May 17, 2021

Hi,

Would anyone sponsor it?

Best regards,
Mitsuru

Loading

@kevinjwalls
Copy link

@kevinjwalls kevinjwalls commented May 17, 2021

/sponsor

Loading

@openjdk
Copy link

@openjdk openjdk bot commented May 17, 2021

@kevinjwalls @kariya-mitsuru Since your change was applied there have been 530 commits pushed to the master branch:

  • 2313a21: 8266637: CHT: Add insert_and_get method
  • 7b736ec: 8266489: Enable G1 to use large pages on Windows when region size is larger than 2m
  • f422787: 8266073: Regression ~2% in Derby after 8261804
  • 02f895c: 8252685: APIs that require JavaThread should take JavaThread arguments
  • 2066f49: 8266764: [REDO] JDK-8255493 Support for pre-generated java.lang.invoke classes in CDS dynamic archive
  • 8c71144: 8265153: add time based test for ThreadMXBean.getThreadInfo() and ThreadInfo.getLockOwnerName()
  • 10cafd2: 8267153: Problemlist jdk/jfr/event/gc/collection/TestG1ParallelPhases.java to remove the noise from CI
  • f3fb5a4: 8266942: gtest/GTestWrapper.java os.iso8601_time_vm failed
  • 7ab6dc8: 6676643: Improve current C_GetAttributeValue native implementation
  • 28f1c7a: 8249395: (macos) jpackage tests timeout on MacPro5_1 systems
  • ... and 520 more: https://git.openjdk.java.net/jdk/compare/94067446ba6ef46adb54307226bd916ce1027013...master

Your commit was automatically rebased without conflicts.

Pushed as commit a555fd8.

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

Loading

@kariya-mitsuru
Copy link
Contributor Author

@kariya-mitsuru kariya-mitsuru commented May 17, 2021

Thanks a lot!

Loading

@kariya-mitsuru kariya-mitsuru deleted the JDK-8264734 branch May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants