-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8353290: C2: Refactor PhaseIdealLoop::is_counted_loop() #24458
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
base: master
Are you sure you want to change the base?
Conversation
|
👋 Welcome back kxu! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
|
/reviewers 2 C2 changes |
This reverts commit fd60717.
Webrevs
|
chhagedorn
left a comment
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.
That's a good idea to refactor this, thanks for tackling it! Some initial general comments, I will have a closer look at your patch later again.
|
Was out last week but I'm seeing your last commit mentions WIP. Let me know when it's ready to have another look again :-) |
|
@chhagedorn Sorry this took longer than expected. I left a few replies under some of your specific comments. All other issues were addressed. Thank you! |
|
No worries, thanks @tabjy for addressing my suggestions and comments! I won't be able to continue this week but will have another look next week. |
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.
Nice update, it looks very good already! I did a complete pass and left some more comments.
I'm a bit worried about breaking something which might not be noticed because we just don't create a counted loop anymore. Have you thought about some ways to test this? One idea could be to do some runs with some custom logging in place when a counted loop was successfully created and then compare the output to a baseline without your patch and the same logging in place. We should just have some confidence that we do not introduce (performance) regressions.
Co-authored-by: Christian Hagedorn <christian.hagedorn@oracle.com>
# Conflicts: # src/hotspot/share/opto/loopnode.cpp
That's a very good suggestion. I tried logging the method id where a counted loop is detected and converted and run Alternatively, I cherry-picked the old counted loop implementation back in with minimum changes and asserted the old and new implementation always produce the same result. This is done on another branch [0] to avoid complicating reviews. All of the So yes, I'm quite confident there's no regressions. [0] tabjy/jdk@counted-loop-refactor...tabjy:jdk:counted-loop-refactor-log |
|
Thanks for the (ongoing?) updates! Let me know, when it's ready to be reviewed again 👍 |
|
@chhagedorn It is ready for review. Please see #24458 (comment) and #24458 (comment). Thanks! |
# Conflicts: # src/hotspot/share/opto/loopnode.cpp
|
Was too busy this week, will try to come back to this next week! |
chhagedorn
left a comment
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 the updates! I first did some skimming first but ended up doing another complete pass. It's already in a good state but I still found some more small things which I left as comments. But then I think it's good to go from my side (regarding the code) :-)
About testing:
Thanks for doing an extended testing with directly inserting the old code again to have a proper comparison. I first thought it's going to be too tricky which is why I proposed a logging - but I already feared that it's not going to be stable enough. So, I'm glad that you managed to do a old vs. new state!
For next steps, I suggest I'll give your patch a spin in our standard testing once you addressed the last comments in this badge. Then I'm also happy to run some more extended testing with your old vs. new counted loop transformation state (would be nice if you can update your branch with the latest review and also merge in latest master).
Let me know if you need some help :-)
Co-authored-by: Christian Hagedorn <christian.hagedorn@oracle.com>
|
@chhagedorn Thank you reviewing. I'm glad to hear I'm making progress. Please see my pervious comment regarding iteratively uncasting
Yes please. I've addressed last few suggestions and merged in the master.
Good idea. I've updated the old vs. new code based on the latest patch on this pr. Please find it on the Please let me know how the testing goes. Thank you very much once again! |
|
Thanks @tabjy for the update. Was too busy this week with the mainline fork but I'm happy to take another look next week :-) |
This PR refactors
PhaseIdealLoop::is_counted_loop()into (mostly)CountedLoopConverter::is_counted_loop()andCountedLoopConverter::convert()to decouple the detection and conversion code. This enables us to try different loop configurations easily and finally convert once a counted loop is found.A nested
PhaseIdealLoop::CountedLoopConverterclass is created to handle the context, but I'm not if this is the best name or place for it. Please let me know what you think.Blocks JDK-8336759.
Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24458/head:pull/24458$ git checkout pull/24458Update a local copy of the PR:
$ git checkout pull/24458$ git pull https://git.openjdk.org/jdk.git pull/24458/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 24458View PR using the GUI difftool:
$ git pr show -t 24458Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24458.diff
Using Webrev
Link to Webrev Comment