-
Notifications
You must be signed in to change notification settings - Fork 394
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
Allow extensions to GlobalRegisterAllocator #6577
Conversation
7d17d38
to
31f5471
Compare
31f5471
to
144d051
Compare
144d051
to
82ab93d
Compare
Jenkins build all |
82ab93d
to
fa14415
Compare
fa14415
to
887415d
Compare
Jenkins build all |
@hzongaro : please review |
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 changes look good overall. One question I had was whether you considered moving GlobalRegisterAllocator
itself to the TR
and OMR
namespaces as well, and if not, why not?
As I don't have a lot of experience with the tradeoffs involved, I'm just wondering whether doing that now would cause problems for the kind of extension to GlobalRegisterAllocator
that you're working on, or if some other downstream project required it in the future, what kind of difficulty it might cause for your project at that point.
|
||
#include "optimizer/OMRGlobalRegister_inlines.hpp" | ||
|
||
#endif |
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's a newline missing at the end of this file.
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 review! I didn't strongly consider moving all of TR_GlobalRegisterAllocator to OMR/TR namespace, but that was basically only because it wasn't strictly needed to allow the extension points I was trying to enable here. That being said, I'm not opposed to it, and I don't think that if other projects wanted it structured that way it would cause any problems in downstream projects that I'm aware of.
My understanding (for what it's worth; others with more experience with the OMR code than I may have additional thoughts) is that the tradeoff there is largely a matter of whether making a change to the structure of the class in that way may inadvertently lead to new bugs/disruptions to existing projects, against the consistency it would afford, both to OMR itself in having a consistent style and to downstream projects in having a more consistent set of extension points for the various optimization classes, to have all of the optimizations structured in a similar way (which at the moment actually isn't consistent across the various optimizations - some are TR_, others are in the OMR/TR namespace, others are fully extensible classes - but probably it would be nice if it were consistently one or another of those options).
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.
OK, that sounds reasonable. Once you have a chance to add the missing newline, I'll mark my review as approved.
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've added a newline to the end of the file.
int32_t numberOfRegistersLiveOnEntry(TR_Array<TR::GlobalRegister> &, bool); | ||
TR_PairedSymbols *findOrCreatePairedSymbols(TR::SymbolReference *symRef1, TR::SymbolReference *symRef2); | ||
bool isDependentStore(TR::Node *, const TR_UseDefInfo::BitVector &, TR::SymbolReference *, bool *); | ||
TR::TreeTop * findPrevTreeTop(TR::TreeTop * &, TR::Node * &, TR::Block *, TR::Block *); |
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.
Did you really intend to make _visitCount
and all the other fields that follow protected
rather than leaving them private
? I'm guessing "yes", but it's hard to know what might need to be accessed in downstream implementations.
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 did intend to make those protected
, yes.
caffe97
to
492fd8a
Compare
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 to me
Jenkins build all |
@kevindean12, the copyright updates that you made now conflict with the changes to the new style of copyright from pull request #6923. It also looks like the CI builds never ran for some reason. Once you've removed your updates to the copyrights, I'll request the CI builds again. |
-Put TR_RegisterCandidate, TR_RegisterCandidates, and GlobalSet classes into the OMR namespace and create derived classes in TR namespace, allowing downstream projects to add a project-level class to those hierarchies in order to extend functionality. -Make members of the above classes protected -Make the following methods virtual: -GlobalSet::collectReferencedAutoSymRefs() -RegisterCandidate::symbolIsLive() -RegisterCandidate::processLiveOnEntryBlocks() -RegisterCandidates::findOrCreate() -RegisterCandidates::find(TR::SymbolReference *) -RegisterCandidates::assign() -RegisterCandidates::computeAvailableRegisters()
492fd8a
to
04ddf49
Compare
Rebased and resolved the copyrights conflicts. |
Jenkins build all |
@hzongaro : Henry, this will need a corresponding change to the makefiles in OpenJ9 to handle the rename of "OMRRegisterCandidate.cpp" and the addition of "OMRGlobalRegister.cpp" These are the "common.mk" files used for the older SDK 8 builds. If you could create a PR for that then I could do a coordinated merge of the two PRs. Thanks. |
@0xdaryl, thank you for catching that! I will take care of it. |
OMR pull request eclipse/omr#6577 renames RegisterCandidate.cpp to OMRRegisterCandidate.cpp, and adds a new file, OMRGlobalRegister.cpp. Both of these files are located in omr/compiler/optimizer. This change updates the OpenJ9 common.mk file that is used by older versions of the build infrastructure to compile those files. Signed-off-by: Henry Zongaro <[email protected]>
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.
Kevin @kevindean12, sorry for the late re-review comments!
@@ -155,7 +155,7 @@ JIT_PRODUCT_BACKEND_SOURCES+=\ | |||
$(JIT_OMR_DIRTY_DIR)/optimizer/ReachingDefinitions.cpp \ | |||
$(JIT_OMR_DIRTY_DIR)/optimizer/OMRRecognizedCallTransformer.cpp \ | |||
$(JIT_OMR_DIRTY_DIR)/optimizer/RedundantAsyncCheckRemoval.cpp \ | |||
$(JIT_OMR_DIRTY_DIR)/optimizer/RegisterCandidate.cpp \ | |||
$(JIT_OMR_DIRTY_DIR)/optimizer/OMRRegisterCandidate.cpp \ |
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.
Daryl's comment prompted me to take a look at the changes to these common.mk
files again. I believe a new entry will be needed for OMRGlobalRegister.cpp
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.
Oops, thanks for catching it! I'll update these two common.mk
files.
@@ -157,7 +157,7 @@ JIT_PRODUCT_BACKEND_SOURCES+=\ | |||
$(JIT_OMR_DIRTY_DIR)/optimizer/ReachingDefinitions.cpp \ | |||
$(JIT_OMR_DIRTY_DIR)/optimizer/OMRRecognizedCallTransformer.cpp \ | |||
$(JIT_OMR_DIRTY_DIR)/optimizer/RedundantAsyncCheckRemoval.cpp \ | |||
$(JIT_OMR_DIRTY_DIR)/optimizer/RegisterCandidate.cpp \ | |||
$(JIT_OMR_DIRTY_DIR)/optimizer/OMRRegisterCandidate.cpp \ |
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.
Daryl's comment prompted me to take a look at the changes to these common.mk
files again. I believe a new entry will be needed for OMRGlobalRegister.cpp
-replace uses of TR_GlobalRegister with TR::GlobalRegister
-the following GRA methods are made virtual for downstream projects to be able to extend functionality: -markAutosUsedIn() -transformNode() -prepareForBlockExit() -registerIsLiveAcrossEdge() -make several GRA members protected -make TR_LiveRangeSplitter members protected Closes: eclipse#6529
04ddf49
to
7383012
Compare
Jenkins build all |
Thanks, Kevin @kevindean12. The one failure with the macOS build again appears to be due to #6924, so I think everything looks good. Daryl @0xdaryl - FYI |
Splits TR_RegisterCandidate, TR_RegisterCandidates, and GlobalSet into OMR and TR namespaces to allow downstream projects to provide derived classes that extend their functionality. Makes TR_GlobalRegister a proper extensible class, which is necessary because the way that TR_GlobalRegister is used requires that it does not have any virtual functions (instances are initialized inside of a TR_Array and memset to 0, which would interfere with the vtable if the class used dynamic polymorphism). Finally, makes some members of GlobalRegisterAllocator virtual and moves some members' access in GlobalRegisterAllocator from private to protected to allow downstream projects to create derived class extensions of GlobalRegisterAllocator.