-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8304996: Add missing HandleMarks #13215
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
Conversation
👋 Welcome back dholmes! A progress list of the required criteria for merging this PR into |
@dholmes-ora The following label will be automatically applied to this pull request:
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. |
/label add hotspot-runtime |
@dholmes-ora |
@dholmes-ora |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! thank you for fixing these.
@dholmes-ora 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:
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 91 new commits pushed to the
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 |
Thanks @coleenp ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the issue synopsis should be capitalized: "Add missing HandleMarks". Also, does it cover the cases that were not covered by dump_at_exit
HandleMark
before? If not, then it is not adding "missing" HMs.
@@ -1174,6 +1175,7 @@ void klassItable::initialize_itable(GrowableArray<Method*>* supers) { | |||
void klassItable::check_constraints(GrowableArray<Method*>* supers, TRAPS) { | |||
|
|||
assert(_size_method_table == supers->length(), "wrong size"); | |||
HandleMark hm(THREAD); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Would this make the handles area grow up to _size_method_table
in the worst case? I thought we want to have HandleMark
-s closer to actual handle creation/last-use to keep the footprint at bay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was optimising for runtime performance rather than footprint, but you are right this could grow in a way we don't want. So I reverted this change and made a similar change to klassVtable::check_constraints
.
Thanks for looking at this @shipilev .
Fixed capitalization in HandleMark. Not sure what your issue is with "missing" - the HM's were not present where the Handles were used and hence were missing. Some cases were directly detected by removing the old HM in |
What are the rules for using HandleMarks? In the HotSpot code, there are plenty of cases where we create a HandleMark without creating any Handles in the immediately following code. There are also plenty of cases where Handles are created in functions that do not have any HandleMarks. |
@coleenp has a lot to say on this but basically HM's should appear along-side the code that creates the Handles. Unless you return a Handle from a function, there should generally be a HM in the function. There is a lot of code that doesn't follow this. Partly I think this is because we have some high-on-the-stack HMs or HandleMarkCleaners that hide the creation of Handles without a local HandleMark. Conversely if new code uses existing code that doesn't have a HM and gets an error, then the typical response is to put a HM in the new code - especially because that only affects the new change, whereas putting a HM lower-down could be seen as disruptive etc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me. (I'd probably put HandleMark
after the comment, closer to the code in check_constraints
, but no need to do that if there are no other changes pending.)
When I read a synopsis "Add missing HMs", that means to me there are code paths that allocate Handles without HMs -- meaning there is a memory leak. If we just dropped an "umbrella" HM in |
Thanks @shipilev ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @iklam ! /integrate |
Going to push as commit a7546b3.
Your commit was automatically rebased without conflicts. |
@dholmes-ora Pushed as commit a7546b3. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
The review for JDK-8304147 pointed out that the top-level HandleMark in dump_for_exit (added to replace the previous coverage from a HandleMarkCleaner in JVM_ENTRY) was not in the right place as no Handles were being used there. Removing that HM and fixing up the ensuing failures led to a set of fixes where HM's were missing at the place of Handle usage.
Testing: tiers 1-4
Thanks.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/13215/head:pull/13215
$ git checkout pull/13215
Update a local copy of the PR:
$ git checkout pull/13215
$ git pull https://git.openjdk.org/jdk.git pull/13215/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 13215
View PR using the GUI difftool:
$ git pr show -t 13215
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/13215.diff
Webrev
Link to Webrev Comment