-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
8288537: Move Devirtualizer out of hotspot/share/memory/iterator.hpp #9176
Conversation
👋 Welcome back iklam! A progress list of the required criteria for merging this PR into |
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.
Even though the name sounds generic, the Devirtualizer class was written to support the oop_iterate / OopIterateClosure devirtualization. (Maybe a hint that this should be renamed)
This patch splits the implementation of this devirtualization into two different files. I think that's unfortunate. I'd rather see that we kept that code together. Maybe move all the code into a new oopIterateClosure.inline.hpp file.
However, if you do so, you'll find that we would almost move all the code out of iterator.inline.hpp. To me that makes it unclear how much the move of the Devirtualizer contributed to the fixed compilation time.
Since this patch moves two completely separate closures, could you repurpose this PR to only move the SerializeClosure, so that we can evaluate the move of the OopIterateClosure separately?
The main problem is:
Here's the output of https://github.com/iklam/tools/blob/main/headers/whoincludes.tcl:
So the main benefit of this PR is that the expensive expansion of OopIterateDispatch is no longer needed by the popular header stackChunkFrameStream.inline.hpp (introduced by Loom, and is indirectly used by the popular header frame.inline.hpp, which I looked at but is much more difficult to refactor). So keeping OopIterateDispatch and Devirtualizer in the same file doesn't make sense, as long as compilation time is concerned. Maybe we can add a comment to describe their relationship? Also, as shown in the output above, apparently the Loom project found a use case of Devirtualizer without using OopIterateDispatch at the same time (see For completeness and clarity, I can do three separate PRs:
And devirtualizer.hpp/oopIterateDispatch should be moved to the share/oops directory? What do you think? |
I forgot that Loom hijacked Devirtualizer for the derived oops processing. This devirtualization is not needed. The compiler sees the correct type and performs the correct inlining anyway. Before the integration of Loom I removed the usage of Devirtualizer::do_bit and verified that the compiler generated the same code (though I forgot to remove function). I took and tested removing Devirtualizer::do_derived_oops, and again, the compiler generated the same code. So, simplest would be to just remove that function and the include of iterator.inline.hpp. However, if you still want to do this separation, then I guess that's OK as well. Could you move the Devirtualizer class to utilities/ instead of oops/, given that it's not necessarily oops that we are visiting? Maybe also update the comment to not mention OopClosureType. Sounds good to move the OopIterateDispatch code to oops/oopIterateDispatch. |
I think it's still useful to move Devirtualizer out in case it might be used in the future by other code. I've backed out the changes related to SerializeClosure, and moved the header to utilities/devirtualizer.hpp. If you want to do the Loom cleanup, I'll leave it up to you :-) |
Sounds good to me :) |
@@ -0,0 +1,171 @@ | |||
/* | |||
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. |
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.
Since these new files are mainly copied code, would you mind retaining the copyright dates. Right now this look like newly created code.
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 updated the copyright year to 2018-2022, since the Devirtualizer class was first added in 2018 in JDK-8204540
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 like an improvement.
@iklam 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 no new commits pushed to the ➡️ To integrate this PR with the above commit message to the |
…refactor-iterator-hpp
Going to push as commit 9f8bfab.
Your commit was automatically rebased without conflicts. |
HotSpot build time has regressed quite a bit since JDK 17 (1m46s vs 2m20s on my machine). Now it's time to do some header file cleanup.
iterator.hpp contains a hodge-podge of unrelated classes. Some of these classes have dependencies on other headers (e.g.,
Devirtualizer
depends on bitMap.hpp) that slow down C++ compilation.This patch moves two infrequently used classes,
Devirtualizer
andSerializeClosure
, to their own header files. This reduces the total number of C++ lines compiled for libjvm.so for about 1%.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9176/head:pull/9176
$ git checkout pull/9176
Update a local copy of the PR:
$ git checkout pull/9176
$ git pull https://git.openjdk.org/jdk pull/9176/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 9176
View PR using the GUI difftool:
$ git pr show -t 9176
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9176.diff