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.WebAssembly | |
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.WebAssembly')
-rw-r--r-- | src/ILCompiler.WebAssembly/src/Compiler/DependencyAnalysis/WebAssemblyMethodCodeNode.cs | 4 | ||||
-rw-r--r-- | src/ILCompiler.WebAssembly/src/Compiler/DependencyAnalysis/WebAssemblyVTableSlotNode.cs | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/ILCompiler.WebAssembly/src/Compiler/DependencyAnalysis/WebAssemblyMethodCodeNode.cs b/src/ILCompiler.WebAssembly/src/Compiler/DependencyAnalysis/WebAssemblyMethodCodeNode.cs index 0cfd4382c..0405b88d2 100644 --- a/src/ILCompiler.WebAssembly/src/Compiler/DependencyAnalysis/WebAssemblyMethodCodeNode.cs +++ b/src/ILCompiler.WebAssembly/src/Compiler/DependencyAnalysis/WebAssemblyMethodCodeNode.cs @@ -68,9 +68,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 => -1502960727; + int ISortableNode.ClassCode => -1502960727; - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) + int ISortableNode.CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_method, ((WebAssemblyMethodCodeNode)other)._method); } diff --git a/src/ILCompiler.WebAssembly/src/Compiler/DependencyAnalysis/WebAssemblyVTableSlotNode.cs b/src/ILCompiler.WebAssembly/src/Compiler/DependencyAnalysis/WebAssemblyVTableSlotNode.cs index c9924f68a..5122f8dc0 100644 --- a/src/ILCompiler.WebAssembly/src/Compiler/DependencyAnalysis/WebAssemblyVTableSlotNode.cs +++ b/src/ILCompiler.WebAssembly/src/Compiler/DependencyAnalysis/WebAssemblyVTableSlotNode.cs @@ -76,9 +76,9 @@ namespace ILCompiler.DependencyAnalysis return objData.ToObjectData(); } - protected override int ClassCode => 0; + public override int ClassCode => 0; - protected override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_targetMethod, ((WebAssemblyVTableSlotNode)other)._targetMethod); } |