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

8276721: G1: Refine G1EvacFailureObjectsSet::iterate #6303

Conversation

Hamlin-Li
Copy link

@Hamlin-Li Hamlin-Li commented Nov 9, 2021

Currently, G1EvacFailureObjectsSet::iterate(ObjectClosure* closure) is not a const method, but it looks like a const method. It will be a surprise for reader, i.e. you would not expect that an iteration method is destructive, clearing out the set it just iterated over.
We should refine it in some way.


Progress

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

Issue

  • JDK-8276721: G1: Refine G1EvacFailureObjectsSet::iterate

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 6303

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

Using diff file

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

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Nov 9, 2021

👋 Welcome back mli! 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 label Nov 9, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Nov 9, 2021

@Hamlin-Li The following label will be automatically applied to this pull request:

  • hotspot-gc

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 hotspot-gc label Nov 9, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Nov 9, 2021

Webrevs

Copy link
Contributor

@tschatzl tschatzl left a comment

I do not think this change solves what it was intended to do: G1EvacFailureObjectsSet:handle_iteration() is still destructive, and the rest of the changes seem to just be moving around code, and making more stuff visible in the header file, overall complicating the code imho.

What about renaming G1EvacFailureObjectsSet:iterate to G1EvacFailureObjectsSet:iterate_and_drop/empty/remove? Or, as mentioned earlier, have an explicit drop/remove/emtpy method in G1EvacFailureObjectsSet and call it appropriately?
The former would be my preferred solution because it is then called distinctively enough from a normal iterate method, and does not completely mess up current code.

The cause of all this may have been the decision to put G1EvacFailureObjectsSet, a data structure only interesting during (young) gc that needs some per-gc handling, into the permanently valid HeapRegion data structure - I'll handle this refactoring though as mentioned.

Let's sync with @albertnetymk about this before continuing.

@albertnetymk
Copy link
Member

@albertnetymk albertnetymk commented Nov 9, 2021

The former would be my preferred solution

Agree; I prefer not having iterate in the name, sth like process_and_drop/empty/remove, but either is fine to me.

@Hamlin-Li
Copy link
Author

@Hamlin-Li Hamlin-Li commented Nov 9, 2021

I was thinking handle_iteration() will be not that surprising for users as iterate(), but seems it's not.
Sure, let me just rename it as process_and_drop.

@tschatzl
Copy link
Contributor

@tschatzl tschatzl commented Nov 9, 2021

I was thinking handle_iteration() will be not that surprising for users as iterate(), but seems it's not. Sure, let me just rename it as process_and_drop.

The main issue I have with the current change is that this is a changeset with 160 changed lines for the purpose of renaming two methods which are each called once. That seems completely off.

@Hamlin-Li Hamlin-Li force-pushed the refine-G1EvacFailureObjectsSet-iterate branch from 4b33882 to 2118829 Compare Nov 9, 2021
@Hamlin-Li
Copy link
Author

@Hamlin-Li Hamlin-Li commented Nov 9, 2021

Agree, seems it's too much code for such a trivial issue. :)

Copy link
Contributor

@tschatzl tschatzl left a comment

Lgtm apart from the one comment about the comment.

@@ -74,7 +74,7 @@ class G1EvacFailureObjectsSet {

// Apply the given ObjectClosure to all objects that failed evacuation. Objects
// are passed in increasing address order.
void iterate(ObjectClosure* closure);
void process_and_drop(ObjectClosure* closure);
Copy link
Contributor

@tschatzl tschatzl Nov 9, 2021

Choose a reason for hiding this comment

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

The comment needs some update, something like: "Apply the given ObjectClosure to all objects that failed evacuation and empties the list after processing. Objects are passed in increasing address order."

@openjdk
Copy link

@openjdk openjdk bot commented Nov 9, 2021

@Hamlin-Li 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:

8276721: G1: Refine G1EvacFailureObjectsSet::iterate

Reviewed-by: tschatzl, ayang

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

  • 8822d41: 8274736: Concurrent read/close of SSLSockets causes SSLSessions to be invalidated unnecessarily
  • c1e41fe: 8276842: G1: Only calculate size in bytes from words when needed
  • c8b0ee6: 8276833: G1: Make G1EvacFailureRegions::par_iterate const
  • 0699220: 8268882: C2: assert(n->outcnt() != 0 || C->top() == n || n->is_Proj()) failed: No dead instructions after post-alloc
  • d7012fb: 8276880: Remove java/lang/RuntimeTests/exec/ExecWithDir as unnecessary
  • f9024d0: 8230130: javadoc search result dialog shows cut off headers for long results
  • 055de6f: 8223358: Incorrect HTML structure in annotation pages
  • a60e912: 8198626: java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.html fails on mac
  • dde959d: 8276808: java/nio/channels/Channels/TransferTo.java timed out
  • daf77eb: 8276337: Use override specifier in HeapDumper
  • ... and 31 more: https://git.openjdk.java.net/jdk/compare/884915496f7bfe754279f1644603131c64f192b3...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 label Nov 9, 2021
@Hamlin-Li
Copy link
Author

@Hamlin-Li Hamlin-Li commented Nov 10, 2021

Thanks @tschatzl @albertnetymk for your reviews.

/integrate

@openjdk
Copy link

@openjdk openjdk bot commented Nov 10, 2021

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

  • 8822d41: 8274736: Concurrent read/close of SSLSockets causes SSLSessions to be invalidated unnecessarily
  • c1e41fe: 8276842: G1: Only calculate size in bytes from words when needed
  • c8b0ee6: 8276833: G1: Make G1EvacFailureRegions::par_iterate const
  • 0699220: 8268882: C2: assert(n->outcnt() != 0 || C->top() == n || n->is_Proj()) failed: No dead instructions after post-alloc
  • d7012fb: 8276880: Remove java/lang/RuntimeTests/exec/ExecWithDir as unnecessary
  • f9024d0: 8230130: javadoc search result dialog shows cut off headers for long results
  • 055de6f: 8223358: Incorrect HTML structure in annotation pages
  • a60e912: 8198626: java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.html fails on mac
  • dde959d: 8276808: java/nio/channels/Channels/TransferTo.java timed out
  • daf77eb: 8276337: Use override specifier in HeapDumper
  • ... and 31 more: https://git.openjdk.java.net/jdk/compare/884915496f7bfe754279f1644603131c64f192b3...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Nov 10, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Nov 10, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Nov 10, 2021

@Hamlin-Li Pushed as commit e91e9d8.

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

@Hamlin-Li Hamlin-Li deleted the refine-G1EvacFailureObjectsSet-iterate branch Nov 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-gc integrated
3 participants