diff options
author | Fadi Hanna <fadim@microsoft.com> | 2018-07-18 01:09:48 +0300 |
---|---|---|
committer | Fadi Hanna <fadim@microsoft.com> | 2018-07-18 01:09:48 +0300 |
commit | dbf3d4d25650f3b82e2856ef13b22ba22dbdf932 (patch) | |
tree | 8771a0b839d60838a1518ef702404f1e5e7100c1 /src/ILCompiler.CppCodeGen | |
parent | b4774e93ec8da9a775ae157118d7e3120d7608a0 (diff) |
Refactoring the ISortableSymbolNode into ISortableNode and ISymbolNode, to separate the sorting APIs into their own interfaces, independent of having symbols. Reasons:
1) There are some dependency nodes that need sorting, and are not necessarily symbol nodes (today they implement the SortableDependencyNode, which now with these changes will also implement the ISortableNode interface)
2) Avoid places where we have the messy 2 ClassCode and 2 CompareToImpl implementations, where one pair tail-calls the other (really the main reason behind this refactoring)
With these changes, the ClassCode and CompareToImpl are now part of the ISortableNode, The ISortableSymbolNode is now simply a merging of ISortableNode and ISymbolNode, to be used in places where we deal with both concepts.
SortableDependencyNode provides default/abstract virtuals to the interface methods, and are overridden in derived classes.
[tfs-changeset: 1707646]
Diffstat (limited to 'src/ILCompiler.CppCodeGen')
-rw-r--r-- | src/ILCompiler.CppCodeGen/src/Compiler/DependencyAnalysis/CppMethodCodeNode.cs | 4 | ||||
-rw-r--r-- | src/ILCompiler.CppCodeGen/src/Compiler/DependencyAnalysis/CppUnboxingStubNode.cs | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/ILCompiler.CppCodeGen/src/Compiler/DependencyAnalysis/CppMethodCodeNode.cs b/src/ILCompiler.CppCodeGen/src/Compiler/DependencyAnalysis/CppMethodCodeNode.cs index 70a138649..49f610ef4 100644 --- a/src/ILCompiler.CppCodeGen/src/Compiler/DependencyAnalysis/CppMethodCodeNode.cs +++ b/src/ILCompiler.CppCodeGen/src/Compiler/DependencyAnalysis/CppMethodCodeNode.cs @@ -76,9 +76,9 @@ namespace ILCompiler.DependencyAnalysis public override IEnumerable<CombinedDependencyListEntry> GetConditionalStaticDependencies(NodeFactory factory) => null; public override IEnumerable<CombinedDependencyListEntry> SearchDynamicDependencies(List<DependencyNodeCore<NodeFactory>> markedNodes, int firstNode, NodeFactory factory) => null; - int ISortableSymbolNode.ClassCode => 1643555522; + int ISortableNode.ClassCode => 1643555522; - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) + int ISortableNode.CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_method, ((CppMethodCodeNode)other)._method); } diff --git a/src/ILCompiler.CppCodeGen/src/Compiler/DependencyAnalysis/CppUnboxingStubNode.cs b/src/ILCompiler.CppCodeGen/src/Compiler/DependencyAnalysis/CppUnboxingStubNode.cs index 916c94d9e..a47dca6db 100644 --- a/src/ILCompiler.CppCodeGen/src/Compiler/DependencyAnalysis/CppUnboxingStubNode.cs +++ b/src/ILCompiler.CppCodeGen/src/Compiler/DependencyAnalysis/CppUnboxingStubNode.cs @@ -29,7 +29,7 @@ namespace ILCompiler.DependencyAnalysis sb.Append("unbox_").Append(nameMangler.GetMangledMethodName(Method)); } - public int CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) + public int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(this.Method, ((CppUnboxingStubNode)other).Method); } |