-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8367240: Parallel: Refactor PSScavengeCLDClosure #27165
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 ayang! A progress list of the required criteria for merging this PR into |
@albertnetymk 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 15 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 |
@albertnetymk 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. |
Webrevs
|
// if references are left in the young gen. | ||
_oop_closure.set_scanned_cld(cld); | ||
// Reset before iterating oops. | ||
_oop_closure._has_oop_into_young_gen = false; |
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 wonder if this wouldn't be cleaner if you set up a new PSScavengeFromCLDClosure
here instead. Then you wouldn't have to explicitly reset _has_oop_into_young_gen here.
if (cld->has_modified_oops()) {
PSScavengeFromCLDClosure oop_closure(_pm);
// Clean the cld since we're going to scavenge all the metadata.
cld->oops_do(&oop_closure, ClassLoaderData::_claim_none, /*clear_modified_oops*/true);
if (oop_closure.has_oops_into_young_gen()) {
cld->record_modified_oops();
}
}
Maybe you don't have to hide PSScavengeFromCLDClosure
inside PSScavengeCLDClosure
. I find it more distracting that what we had before. If you don't agree with that, maybe the PSScavengeCLDClosure name could be changed so that we don't repeat the PSScavenge prefix for the internal class.
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 have simplified the class name and moved it inside the do_cld
method.
}; | ||
public: | ||
// Records whether this CLD contains oops pointing into young-gen after scavenging. | ||
bool _has_oop_into_young_gen; |
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.
Comment says oops but name says oop. Maybe use _has_oops_into_young_gen?
_scanned_cld = cld; | ||
} | ||
// Scavenges a single oop in a ClassLoaderData. | ||
class CLDOopClosure : public OopClosure { |
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.
This makes the do_cld function much harder to read, IMHO. So, three alternatives:
- Keep the class outside PSScavengeCLDClosure, just like it was before this patch.
- Have the class inside PSScavengeCLDClosure, but not in a function
- Have the class inside a function inside PSScavengeCLDClosure.
I prefer (1) because it allows you to look at PSScavengeCLDClosure without having to see the details about the second class. I'm OK with (2) and like that it encapsulates the other class. I don't think we should do (3) because it significantly hurts the readability of do_cld.
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 have moved the oop-closure class def outside.
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.
Thanks for fixing the style. I've added two small nits, but otherwise I've approved the PR.
@@ -77,17 +77,19 @@ class PSRootsClosure: public OopClosure { | |||
typedef PSRootsClosure</*promote_immediately=*/false> PSScavengeRootsClosure; | |||
typedef PSRootsClosure</*promote_immediately=*/true> PSPromoteRootsClosure; | |||
|
|||
|
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.
}; | ||
|
||
// Scavenges the oop in a ClassLoaderData. | ||
class PSScavengeCLDClosure: public CLDClosure { | ||
private: | ||
PSScavengeFromCLDClosure _oop_closure; | ||
PSPromotionManager* _pm; |
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.
To make the two classes consistent w.r.t. newlines.
PSPromotionManager* _pm; | |
PSPromotionManager* _pm; | |
@@ -97,43 +98,33 @@ class PSScavengeFromCLDClosure: public OopClosure { | |||
oop new_obj = _pm->copy_to_survivor_space</*promote_immediately=*/false>(o); | |||
RawAccess<IS_NOT_NULL>::oop_store(p, new_obj); | |||
|
|||
if (PSScavenge::is_obj_in_young(new_obj)) { | |||
do_cld_barrier(); | |||
if (PSScavenge::is_obj_in_young(new_obj) && !_has_oops_into_young_gen) { |
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.
Why do you need to check !_has_oops_into_young_gen
?
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.
It's to avoid writing _has_oops_into_young_gen
multiple times, if it's already true
. (Both versions are correct though.)
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.
Yeah, I was curious why it's needed. What's the problem with just writing true
if it's already true
?
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.
There is no problem; just redundant work.
Thanks for review. /integrate |
Going to push as commit 385c132.
Your commit was automatically rebased without conflicts. |
@albertnetymk Pushed as commit 385c132. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Refactor
PSScavengeCLDClosure
and its "enclosing"PSScavengeFromCLDClosure
so that all CLD logic is encapsulated in the CLD closure, without polluting the oop closure.Test: tier1-3
Progress
Issue
Reviewers
Reviewers without OpenJDK IDs
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27165/head:pull/27165
$ git checkout pull/27165
Update a local copy of the PR:
$ git checkout pull/27165
$ git pull https://git.openjdk.org/jdk.git pull/27165/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 27165
View PR using the GUI difftool:
$ git pr show -t 27165
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27165.diff
Using Webrev
Link to Webrev Comment