Initial codegen node factory cleanup#6411
Conversation
|
I believe this is a great step towards making the R2RCGNF more reasonable and less of a dumping ground for arbitrary code that didn't fit elsewhere. Let's hear what Simon has to say but to me your change looks good - I'm ready to approve it as soon as you remove the WIP prefix from the PR title. You will probably need to resolve some conflicts there - that's actually one more reason why it might be useful to just finish the review, merge the change in and possibly start another one if you see opportunities for additional cleanup; there's lots of traffic in this branch and maintaining an open PR for too long is often quite painful. Thanks a lot Oleksandr for making these changes! |
| @@ -0,0 +1,39 @@ | |||
| using System; | |||
There was a problem hiding this comment.
Each source file needs to have the copyright header added. Could you please copy-paste from another file to top here.
| return info.Constructor; | ||
| } | ||
|
|
||
| Dictionary<ILCompiler.ReadyToRunHelper, ISymbolNode> _helperCache = new Dictionary<ILCompiler.ReadyToRunHelper, ISymbolNode>(); |
There was a problem hiding this comment.
Nit: Prepend with private
| return ExternSymbol(helperId); | ||
| } | ||
|
|
||
| readonly Dictionary<MethodAndCallSite, ISymbolNode> _interfaceDispatchCells = new Dictionary<MethodAndCallSite, ISymbolNode>(); |
There was a problem hiding this comment.
Nit: Prepend with private
| return ReadyToRunHelper(helperId, entity, signatureContext); | ||
| } | ||
|
|
||
| readonly Dictionary<MethodDesc, ISortableSymbolNode> _genericDictionaryCache = new Dictionary<MethodDesc, ISortableSymbolNode>(); |
There was a problem hiding this comment.
Nit: Prepend with private
| return genericDictionary; | ||
| } | ||
|
|
||
| readonly Dictionary<TypeDesc, ISymbolNode> _constructedTypeSymbols = new Dictionary<TypeDesc, ISymbolNode>(); |
There was a problem hiding this comment.
Nit: Prepend with private
|
Oleksandr this looks great - thanks for taking the time to organize this class. We are still discussing how we want this to look in the future but for now I'll gladly take this cleanup. I would leave things as they are in For your question #3 above, could you point at where in the code you're referring? |
8cd9a85 to
95d88dc
Compare
|
Tomas, Simon, thank you for feedback. Merging changes one by one definitely is the right think to do. I had an idea to introduce something like For now I have done a pretty painful rebase, hope that everything is okay. Regarding my third question - I was referring to the description of https://github.com/dotnet/corert/issues/6274 , third bullet point there. |
|
@dotnet-bot test OSX10.12 Debug and CoreCLR tests hm, how do i unWIP it? |
|
Hmm, I hit that myself sometime ago, apparently there's some "smart" logic that WIP's your change whenever it finds WIP anywhere in the description, not just in the title. I'd try to edit the change description and leave out the reference to WIP; after that, you might need to retest the change to get rid of the dotnet bot still treating the change as WIP. |
95d88dc to
1e3ae4c
Compare
|
Turns out commit messages turn on the WIP (along with title and labels). I guess I should use only title for WIPs in future as it is the most confortable way. Upd: not sure what`s up with WASM test. |
|
Don't worry about WASM, it's been broken half of the time with my and Simon's changes too. We'll need to take a look at some point but it's not Pri# 0 right now. |
|
|
||
| public new ReadyToRunCodegenNodeFactory NodeFactory { get; } | ||
|
|
||
| public ReadyToRunSymbolNodeFactory SymbolNodeFactory { get; } |
There was a problem hiding this comment.
I'm wondering whether it might be more descriptive to call the new class "ReadyToRunHelperFactory".
| : base(dependencyGraph, nodeFactory, roots, ilProvider, debugInformationProvider, devirtualizationManager, logger) | ||
| { | ||
| NodeFactory = nodeFactory; | ||
| SymbolNodeFactory = new ReadyToRunSymbolNodeFactory(nodeFactory); |
There was a problem hiding this comment.
I don't think this is such a big hack. It will probably take several iterations to finish the transition, for now I believe this is just fine.
| @@ -0,0 +1,39 @@ | |||
| using System; | |||
There was a problem hiding this comment.
Nit - I'm not sure how much value there is in separating out this tiny class considering there are ten others like this in the node / helper factory but I don't have a strong opinion on this; perhaps you're right that longer term we would be better off pulling all these helpers out to separate classes.
There was a problem hiding this comment.
It is used in both factories, that`s why i extracted it.
* Initial ReadyToRunCodegenNodeFactory cleanup * Extract part of ReadyToRunCodegenNodeFactory to separate class * Fixes after rebase * Addressed code review feedback * Fixed rebase issue * Minor additional cleanup
This is a very harsh WIP, but i lack domain knowledge to proceed :)
I poked this class a bit and here are couple of observations/questions:
NodeFactory.There are some places where methods are called through base class:
HeaderNodewhich derives fromObjectNodeand other base infrastructure:CompilationBuilderandCompilation.I hached this by passing whole factory to new extracted class but it is indeed a hack.
Also initialization process in
AttachToDependencyGraphis complex and I am not sure if it can/should be split.Fixes https://github.com/dotnet/corert/issues/6274
cc @nattress