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 | |
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]
108 files changed, 206 insertions, 306 deletions
diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ArrayMapNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ArrayMapNode.cs index 4f8c8ba46..bd42d69ad 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ArrayMapNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ArrayMapNode.cs @@ -78,6 +78,6 @@ namespace ILCompiler.DependencyAnalysis } protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.ArrayMapNode; + public override int ClassCode => (int)ObjectNodeOrder.ArrayMapNode; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ArrayOfEmbeddedDataNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ArrayOfEmbeddedDataNode.cs index 927710fad..131ae249f 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ArrayOfEmbeddedDataNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ArrayOfEmbeddedDataNode.cs @@ -108,6 +108,6 @@ namespace ILCompiler.DependencyAnalysis protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.ArrayOfEmbeddedDataNode; + public override int ClassCode => (int)ObjectNodeOrder.ArrayOfEmbeddedDataNode; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ArrayOfEmbeddedPointersNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ArrayOfEmbeddedPointersNode.cs index 45271af23..3082f9ffc 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ArrayOfEmbeddedPointersNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ArrayOfEmbeddedPointersNode.cs @@ -51,7 +51,7 @@ namespace ILCompiler.DependencyAnalysis protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.ArrayOfEmbeddedPointersNode; + public override int ClassCode => (int)ObjectNodeOrder.ArrayOfEmbeddedPointersNode; private class PointerIndirectionNodeComparer : IComparer<EmbeddedPointerIndirectionNode<TTarget>> { @@ -96,7 +96,7 @@ namespace ILCompiler.DependencyAnalysis }; } - protected internal override int ClassCode => -66002498; + public override int ClassCode => -66002498; } private class EmbeddedPointerIndirectionWithSymbolNode : SimpleEmbeddedPointerIndirectionNode, ISymbolDefinitionNode diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ArrayOfFrozenObjectsNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ArrayOfFrozenObjectsNode.cs index 70349bdbf..847eb27be 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ArrayOfFrozenObjectsNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ArrayOfFrozenObjectsNode.cs @@ -42,6 +42,6 @@ namespace ILCompiler.DependencyAnalysis builder.EmitZeroPointer(); } - protected internal override int ClassCode => -1771336339; + public override int ClassCode => -1771336339; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/BlobNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/BlobNode.cs index 5f2b27f5c..083de9bde 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/BlobNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/BlobNode.cs @@ -42,9 +42,9 @@ namespace ILCompiler.DependencyAnalysis protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); #if !SUPPORT_JIT - protected internal override int ClassCode => -470351029; + public override int ClassCode => -470351029; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return _name.CompareTo(((BlobNode)other)._name); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/BlockReflectionTypeMapNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/BlockReflectionTypeMapNode.cs index 95fa4b07e..b9ccd7b07 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/BlockReflectionTypeMapNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/BlockReflectionTypeMapNode.cs @@ -83,6 +83,6 @@ namespace ILCompiler.DependencyAnalysis } protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.BlockReflectionTypeMapNode; + public override int ClassCode => (int)ObjectNodeOrder.BlockReflectionTypeMapNode; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/CanonicalDefinitionEETypeNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/CanonicalDefinitionEETypeNode.cs index 520781f53..d1538a4a9 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/CanonicalDefinitionEETypeNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/CanonicalDefinitionEETypeNode.cs @@ -43,6 +43,6 @@ namespace ILCompiler.DependencyAnalysis // Canonical definition types will have their base size set to the minimum protected override int BaseSize => MinimumObjectSize; - protected internal override int ClassCode => -1851030036; + public override int ClassCode => -1851030036; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/CanonicalEETypeNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/CanonicalEETypeNode.cs index 70e39e6c1..945e49c39 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/CanonicalEETypeNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/CanonicalEETypeNode.cs @@ -144,6 +144,6 @@ namespace ILCompiler.DependencyAnalysis base.ComputeValueTypeFieldPadding(); } - protected internal override int ClassCode => -1798018602; + public override int ClassCode => -1798018602; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ClassConstructorContextMap.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ClassConstructorContextMap.cs index 0624ee1c6..1a62667db 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ClassConstructorContextMap.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ClassConstructorContextMap.cs @@ -81,6 +81,6 @@ namespace ILCompiler.DependencyAnalysis } protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.ClassConstructorContextMap; + public override int ClassCode => (int)ObjectNodeOrder.ClassConstructorContextMap; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ClonedConstructedEETypeNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ClonedConstructedEETypeNode.cs index d64319e90..dda4941c2 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ClonedConstructedEETypeNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ClonedConstructedEETypeNode.cs @@ -35,6 +35,6 @@ namespace ILCompiler.DependencyAnalysis objData.EmitPointerReloc(factory.NecessaryTypeSymbol(_type)); } - protected internal override int ClassCode => -288888778; + public override int ClassCode => -288888778; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/CompilerComparer.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/CompilerComparer.cs index b183b043c..250b32707 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/CompilerComparer.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/CompilerComparer.cs @@ -10,9 +10,9 @@ using Internal.TypeSystem; namespace ILCompiler.DependencyAnalysis { - public class CompilerComparer : TypeSystemComparer, IComparer<ISortableSymbolNode> + public class CompilerComparer : TypeSystemComparer, IComparer<ISortableNode> { - public int Compare(ISortableSymbolNode x, ISortableSymbolNode y) + public int Compare(ISortableNode x, ISortableNode y) { if (x == y) { diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ConstructedEETypeNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ConstructedEETypeNode.cs index 23a9a47d2..d145a8d26 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ConstructedEETypeNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ConstructedEETypeNode.cs @@ -220,6 +220,6 @@ namespace ILCompiler.DependencyAnalysis ThrowHelper.ThrowTypeLoadException(ExceptionStringID.ClassLoadGeneral, type); } - protected internal override int ClassCode => 590142654; + public override int ClassCode => 590142654; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/DefaultConstructorMapNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/DefaultConstructorMapNode.cs index fde8c0764..bee2f4de6 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/DefaultConstructorMapNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/DefaultConstructorMapNode.cs @@ -43,7 +43,7 @@ namespace ILCompiler.DependencyAnalysis public override bool StaticDependenciesAreComputed => true; protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.DefaultConstructorMapNode; + public override int ClassCode => (int)ObjectNodeOrder.DefaultConstructorMapNode; protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/DelegateMarshallingStubMapNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/DelegateMarshallingStubMapNode.cs index 11318ad2f..95f9588aa 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/DelegateMarshallingStubMapNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/DelegateMarshallingStubMapNode.cs @@ -77,6 +77,6 @@ namespace ILCompiler.DependencyAnalysis } protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.DelegateMarshallingStubMapNode; + public override int ClassCode => (int)ObjectNodeOrder.DelegateMarshallingStubMapNode; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/DynamicInvokeTemplateDataNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/DynamicInvokeTemplateDataNode.cs index d18e2eb59..01070faa2 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/DynamicInvokeTemplateDataNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/DynamicInvokeTemplateDataNode.cs @@ -124,6 +124,6 @@ namespace ILCompiler.DependencyAnalysis } protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.DynamicInvokeTemplateDataNode; + public override int ClassCode => (int)ObjectNodeOrder.DynamicInvokeTemplateDataNode; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/EETypeNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/EETypeNode.cs index 01b643a11..9d07fac1f 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/EETypeNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/EETypeNode.cs @@ -1243,20 +1243,13 @@ namespace ILCompiler.DependencyAnalysis } } - protected internal override int ClassCode => 1521789141; + public override int ClassCode => 1521789141; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_type, ((EETypeNode)other)._type); } - int ISortableSymbolNode.ClassCode => ClassCode; - - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) - { - return CompareToImpl((ObjectNode)other, comparer); - } - private struct SlotCounter { private int _startBytes; diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/EETypeOptionalFieldsNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/EETypeOptionalFieldsNode.cs index ba0b4739e..dbcaf76cf 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/EETypeOptionalFieldsNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/EETypeOptionalFieldsNode.cs @@ -63,9 +63,9 @@ namespace ILCompiler.DependencyAnalysis return objData.ToObjectData(); } - protected internal override int ClassCode => 821718028; + public override int ClassCode => 821718028; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return SortableDependencyNode.CompareImpl(_owner, ((EETypeOptionalFieldsNode)other)._owner, comparer); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/EmbeddedDataContainerNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/EmbeddedDataContainerNode.cs index bc9d9975d..0cffffac1 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/EmbeddedDataContainerNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/EmbeddedDataContainerNode.cs @@ -26,9 +26,9 @@ namespace ILCompiler.DependencyAnalysis _endSymbol = new ObjectAndOffsetSymbolNode(this, 0, endSymbolMangledName, true); } - protected internal override int ClassCode => -1410622237; + public override int ClassCode => -1410622237; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return _startSymbolMangledName.CompareTo(((EmbeddedDataContainerNode)other)._startSymbolMangledName); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/EmbeddedPointerIndirectionNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/EmbeddedPointerIndirectionNode.cs index 766a73706..45d05c9bc 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/EmbeddedPointerIndirectionNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/EmbeddedPointerIndirectionNode.cs @@ -47,9 +47,9 @@ namespace ILCompiler.DependencyAnalysis Target.AppendMangledName(nameMangler, sb); } - int ISortableSymbolNode.ClassCode => -2055384490; + public override int ClassCode => -2055384490; - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_targetNode, ((EmbeddedPointerIndirectionNode<TTarget>)other)._targetNode); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ExactMethodInstantiationsNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ExactMethodInstantiationsNode.cs index d1dffa4b0..b4bf6659e 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ExactMethodInstantiationsNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ExactMethodInstantiationsNode.cs @@ -152,6 +152,6 @@ namespace ILCompiler.DependencyAnalysis } protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.ExactMethodInstantiationsNode; + public override int ClassCode => (int)ObjectNodeOrder.ExactMethodInstantiationsNode; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ExternMethodSymbolNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ExternMethodSymbolNode.cs index 1aa1b3826..8efd6fe27 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ExternMethodSymbolNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ExternMethodSymbolNode.cs @@ -29,6 +29,6 @@ namespace ILCompiler.DependencyAnalysis } } - protected internal override int ClassCode => -729061105; + public override int ClassCode => -729061105; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ExternSymbolNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ExternSymbolNode.cs index 3714fb7ba..0aee4c8db 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ExternSymbolNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ExternSymbolNode.cs @@ -42,19 +42,12 @@ namespace ILCompiler.DependencyAnalysis public override IEnumerable<CombinedDependencyListEntry> SearchDynamicDependencies(List<DependencyNodeCore<NodeFactory>> markedNodes, int firstNode, NodeFactory factory) => null; #if !SUPPORT_JIT - protected internal override int ClassCode => 1092559304; + public override int ClassCode => 1092559304; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return _name.CompareTo(((ExternSymbolNode)other)._name); } - - int ISortableSymbolNode.ClassCode => ClassCode; - - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) - { - return CompareToImpl((SortableDependencyNode)other, comparer); - } #endif } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ExternalReferencesTableNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ExternalReferencesTableNode.cs index 84c17aab5..d37a4be95 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ExternalReferencesTableNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ExternalReferencesTableNode.cs @@ -123,9 +123,8 @@ namespace ILCompiler.DependencyAnalysis } protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.ExternalReferencesTableNode; - - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int ClassCode => (int)ObjectNodeOrder.ExternalReferencesTableNode; + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return string.Compare(_blobName, ((ExternalReferencesTableNode)other)._blobName); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/FatFunctionPointerNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/FatFunctionPointerNode.cs index a4127e63d..3016536ce 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/FatFunctionPointerNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/FatFunctionPointerNode.cs @@ -97,9 +97,9 @@ namespace ILCompiler.DependencyAnalysis return builder.ToObjectData(); } - protected internal override int ClassCode => 190463489; + public override int ClassCode => 190463489; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { var compare = _isUnboxingStub.CompareTo(((FatFunctionPointerNode)other)._isUnboxingStub); if (compare != 0) @@ -107,12 +107,5 @@ namespace ILCompiler.DependencyAnalysis return comparer.Compare(Method, ((FatFunctionPointerNode)other).Method); } - - int ISortableSymbolNode.ClassCode => ClassCode; - - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) - { - return CompareToImpl((ObjectNode)other, comparer); - } } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/FrozenArrayNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/FrozenArrayNode.cs index 23b0992bd..8d210f5c1 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/FrozenArrayNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/FrozenArrayNode.cs @@ -101,9 +101,9 @@ namespace ILCompiler.DependencyAnalysis factory.FrozenSegmentRegion.AddEmbeddedObject(this); } - protected internal override int ClassCode => 1789429316; + public override int ClassCode => 1789429316; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return _preInitFieldInfo.CompareTo(((FrozenArrayNode)other)._preInitFieldInfo, comparer); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/FrozenStringNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/FrozenStringNode.cs index 1fa63fc51..f1b3467c2 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/FrozenStringNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/FrozenStringNode.cs @@ -91,9 +91,9 @@ namespace ILCompiler.DependencyAnalysis factory.FrozenSegmentRegion.AddEmbeddedObject(this); } - protected internal override int ClassCode => -1733946122; + public override int ClassCode => -1733946122; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return string.CompareOrdinal(_data, ((FrozenStringNode)other)._data); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GCStaticDescNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GCStaticDescNode.cs index e2bbaa68c..4ff2e737a 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GCStaticDescNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GCStaticDescNode.cs @@ -177,19 +177,12 @@ namespace ILCompiler.DependencyAnalysis return compare != 0 ? compare : comparer.Compare(_type, other._type); } - protected sealed internal override int ClassCode => 2142332918; + public sealed override int ClassCode => 2142332918; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return CompareTo((GCStaticDescNode)other, comparer); } - - int ISortableSymbolNode.ClassCode => ClassCode; - - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) - { - return CompareToImpl((SortableDependencyNode)other, comparer); - } } public class GCStaticDescRegionNode : ArrayOfEmbeddedDataNode<GCStaticDescNode> @@ -199,7 +192,7 @@ namespace ILCompiler.DependencyAnalysis { } - protected internal override int ClassCode => 1312891560; + public override int ClassCode => 1312891560; protected override void GetElementDataForNodes(ref ObjectDataBuilder builder, NodeFactory factory, bool relocsOnly) { @@ -255,9 +248,9 @@ namespace ILCompiler.DependencyAnalysis return "Standalone" + _standaloneGCStaticDesc.GetMangledName(context.NameMangler); } - protected internal override int ClassCode => 2091208431; + public override int ClassCode => 2091208431; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return _standaloneGCStaticDesc.CompareTo(((StandaloneGCStaticDescRegionNode)other)._standaloneGCStaticDesc, comparer); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GCStaticEETypeNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GCStaticEETypeNode.cs index bea0665cd..1f2d1f3f0 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GCStaticEETypeNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GCStaticEETypeNode.cs @@ -101,9 +101,9 @@ namespace ILCompiler.DependencyAnalysis return dataBuilder.ToObjectData(); } - protected internal override int ClassCode => 1304929125; + public override int ClassCode => 1304929125; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return _gcMap.CompareTo(((GCStaticEETypeNode)other)._gcMap); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GCStaticsNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GCStaticsNode.cs index d41488885..247d1e9a1 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GCStaticsNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GCStaticsNode.cs @@ -132,18 +132,11 @@ namespace ILCompiler.DependencyAnalysis } } - protected internal override int ClassCode => -522346696; + public override int ClassCode => -522346696; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_type, ((GCStaticsNode)other)._type); } - - int ISortableSymbolNode.ClassCode => ClassCode; - - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) - { - return CompareToImpl((ObjectNode)other, comparer); - } } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GCStaticsPreInitDataNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GCStaticsPreInitDataNode.cs index 653a18fa0..e78801952 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GCStaticsPreInitDataNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GCStaticsPreInitDataNode.cs @@ -113,9 +113,9 @@ namespace ILCompiler.DependencyAnalysis return builder.ToObjectData(); } - protected internal override int ClassCode => 1148300665; + public override int ClassCode => 1148300665; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_type, ((GCStaticsPreInitDataNode)other)._type); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericCompositionNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericCompositionNode.cs index cff9f3746..8d4c161fc 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericCompositionNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericCompositionNode.cs @@ -100,8 +100,8 @@ namespace ILCompiler.DependencyAnalysis protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); - protected internal override int ClassCode => -762680703; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int ClassCode => -762680703; + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return _details.CompareToImpl(((GenericCompositionNode)other)._details, comparer); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericDefinitionEETypeNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericDefinitionEETypeNode.cs index d40972210..243d94cd6 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericDefinitionEETypeNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericDefinitionEETypeNode.cs @@ -76,6 +76,6 @@ namespace ILCompiler.DependencyAnalysis return dataBuilder.ToObjectData(); } - protected internal override int ClassCode => -160325006; + public override int ClassCode => -160325006; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericDictionaryNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericDictionaryNode.cs index 799767379..211ac3a1f 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericDictionaryNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericDictionaryNode.cs @@ -86,9 +86,9 @@ namespace ILCompiler.DependencyAnalysis return this.GetMangledName(factory.NameMangler); } - int ISortableSymbolNode.ClassCode => ClassCode; + public override int ClassCode => ClassCode; - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return CompareToImpl((ObjectNode)other, comparer); } @@ -176,9 +176,9 @@ namespace ILCompiler.DependencyAnalysis _owningType = owningType; } - protected internal override int ClassCode => 889700584; + public override int ClassCode => 889700584; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_owningType, ((TypeGenericDictionaryNode)other)._owningType); } @@ -277,9 +277,9 @@ namespace ILCompiler.DependencyAnalysis _owningMethod = owningMethod; } - protected internal override int ClassCode => -1245704203; + public override int ClassCode => -1245704203; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_owningMethod, ((MethodGenericDictionaryNode)other)._owningMethod); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericMethodsHashtableNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericMethodsHashtableNode.cs index bb6d87553..efbe77897 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericMethodsHashtableNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericMethodsHashtableNode.cs @@ -126,6 +126,6 @@ namespace ILCompiler.DependencyAnalysis } protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.GenericMethodsHashtableNode; + public override int ClassCode => (int)ObjectNodeOrder.GenericMethodsHashtableNode; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericMethodsTemplateMap.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericMethodsTemplateMap.cs index 5f48eff37..c4a743219 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericMethodsTemplateMap.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericMethodsTemplateMap.cs @@ -118,6 +118,6 @@ namespace ILCompiler.DependencyAnalysis } protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.GenericMethodsTemplateMap; + public override int ClassCode => (int)ObjectNodeOrder.GenericMethodsTemplateMap; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericTypesHashtableNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericTypesHashtableNode.cs index 0d9907e9f..0bf0f3850 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericTypesHashtableNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericTypesHashtableNode.cs @@ -68,6 +68,6 @@ namespace ILCompiler.DependencyAnalysis } protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.GenericTypesHashtableNode; + public override int ClassCode => (int)ObjectNodeOrder.GenericTypesHashtableNode; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericTypesTemplateMap.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericTypesTemplateMap.cs index 812a2a3fb..c01bfae12 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericTypesTemplateMap.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericTypesTemplateMap.cs @@ -160,6 +160,6 @@ namespace ILCompiler.DependencyAnalysis } protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.GenericTypesTemplateMap; + public override int ClassCode => (int)ObjectNodeOrder.GenericTypesTemplateMap; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericVirtualMethodTableNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericVirtualMethodTableNode.cs index 69e35880d..18f727a69 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericVirtualMethodTableNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GenericVirtualMethodTableNode.cs @@ -145,6 +145,6 @@ namespace ILCompiler.DependencyAnalysis } protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.GenericVirtualMethodTableNode; + public override int ClassCode => (int)ObjectNodeOrder.GenericVirtualMethodTableNode; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ISortableNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ISortableNode.cs new file mode 100644 index 000000000..ac62439b0 --- /dev/null +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ISortableNode.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace ILCompiler.DependencyAnalysis +{ + public interface ISortableNode + { +#if !SUPPORT_JIT + /// <summary> + /// Gets an identifier that is the same for all instances of this <see cref="ObjectNode"/> + /// descendant, but different from the <see cref="ClassCode"/> of any other descendant. + /// </summary> + /// <remarks> + /// This is really just a number, ideally produced by "new Random().Next(int.MinValue, int.MaxValue)". + /// If two manage to conflict (which is pretty unlikely), just make a new one... + /// </remarks> + int ClassCode { get; } + + int CompareToImpl(ISortableNode other, CompilerComparer comparer); +#endif + } +} diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ISymbolNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ISymbolNode.cs index af38e11d6..ac5b5a2de 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ISymbolNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ISymbolNode.cs @@ -33,12 +33,8 @@ namespace ILCompiler.DependencyAnalysis } - public interface ISortableSymbolNode : ISymbolNode + public interface ISortableSymbolNode : ISymbolNode, ISortableNode { -#if !SUPPORT_JIT - int ClassCode { get; } - int CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer); -#endif } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ImportedEETypeSymbolNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ImportedEETypeSymbolNode.cs index 9b039ac0b..e8138f95e 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ImportedEETypeSymbolNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ImportedEETypeSymbolNode.cs @@ -32,6 +32,6 @@ namespace ILCompiler.DependencyAnalysis } } - protected internal override int ClassCode => 395643063; + public override int ClassCode => 395643063; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/IndirectionNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/IndirectionNode.cs index 77bd897ea..f21986979 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/IndirectionNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/IndirectionNode.cs @@ -61,11 +61,11 @@ namespace ILCompiler.DependencyAnalysis return builder.ToObjectData(); } - protected internal override int ClassCode => -1401349230; + public override int ClassCode => -1401349230; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { - return comparer.Compare(this._indirectedNode, ((IndirectionNode)other)._indirectedNode); + return comparer.Compare(_indirectedNode, ((IndirectionNode)other)._indirectedNode); } } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/InterfaceDispatchCellNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/InterfaceDispatchCellNode.cs index 6779e0a59..d6025238d 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/InterfaceDispatchCellNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/InterfaceDispatchCellNode.cs @@ -114,9 +114,9 @@ namespace ILCompiler.DependencyAnalysis return objData.ToObjectData(); } - protected internal override int ClassCode => -2023802120; + public override int ClassCode => -2023802120; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { var compare = comparer.Compare(_targetMethod, ((InterfaceDispatchCellNode)other)._targetMethod); return compare != 0 ? compare : string.Compare(_callSiteIdentifier, ((InterfaceDispatchCellNode)other)._callSiteIdentifier); diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/InterfaceDispatchMapNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/InterfaceDispatchMapNode.cs index bab5d54e9..2da7c8d02 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/InterfaceDispatchMapNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/InterfaceDispatchMapNode.cs @@ -177,18 +177,11 @@ namespace ILCompiler.DependencyAnalysis return objData.ToObjectData(); } - protected internal override int ClassCode => 848664602; + public override int ClassCode => 848664602; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_type, ((InterfaceDispatchMapNode)other)._type); } - - int ISortableSymbolNode.ClassCode => ClassCode; - - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) - { - return CompareToImpl((ObjectNode)other, comparer); - } } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/InterfaceGenericVirtualMethodTableNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/InterfaceGenericVirtualMethodTableNode.cs index 4418d2984..38fc2bd52 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/InterfaceGenericVirtualMethodTableNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/InterfaceGenericVirtualMethodTableNode.cs @@ -214,6 +214,6 @@ namespace ILCompiler.DependencyAnalysis } protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.InterfaceGenericVirtualMethodTableNode; + public override int ClassCode => (int)ObjectNodeOrder.InterfaceGenericVirtualMethodTableNode; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/JumpStubNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/JumpStubNode.cs index abc13496c..811a1bea9 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/JumpStubNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/JumpStubNode.cs @@ -23,6 +23,6 @@ namespace ILCompiler.DependencyAnalysis protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); - protected internal override int ClassCode => 737788182; + public override int ClassCode => 737788182; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/LoopHijackFlagNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/LoopHijackFlagNode.cs index 69b1bd764..46d92a2ba 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/LoopHijackFlagNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/LoopHijackFlagNode.cs @@ -35,7 +35,7 @@ namespace ILCompiler.DependencyAnalysis public override bool StaticDependenciesAreComputed => true; - protected internal override int ClassCode => -266743363; + public override int ClassCode => -266743363; public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false) { diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MetadataNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MetadataNode.cs index 246e804ce..fda760c8c 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MetadataNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MetadataNode.cs @@ -58,6 +58,6 @@ namespace ILCompiler.DependencyAnalysis } protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.MetadataNode; + public override int ClassCode => (int)ObjectNodeOrder.MetadataNode; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MethodAssociatedDataNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MethodAssociatedDataNode.cs index 46dacad9e..262d0799a 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MethodAssociatedDataNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MethodAssociatedDataNode.cs @@ -41,9 +41,9 @@ namespace ILCompiler.DependencyAnalysis public int Offset => 0; public override bool IsShareable => _methodNode.Method is InstantiatedMethod || EETypeNode.IsTypeNodeShareable(_methodNode.Method.OwningType); - protected internal override int ClassCode => 1055183914; + public override int ClassCode => 1055183914; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_methodNode, ((MethodAssociatedDataNode)other)._methodNode); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MethodCodeNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MethodCodeNode.cs index 2ad4dbd54..fc0efb910 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MethodCodeNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MethodCodeNode.cs @@ -161,18 +161,11 @@ namespace ILCompiler.DependencyAnalysis _debugEHClauseInfos = debugEHClauseInfos; } - protected internal override int ClassCode => 788492407; + public override int ClassCode => 788492407; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_method, ((MethodCodeNode)other)._method); } - - int ISortableSymbolNode.ClassCode => ClassCode; - - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) - { - return CompareToImpl((ObjectNode)other, comparer); - } } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ModulesSectionNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ModulesSectionNode.cs index ed629af32..895138a10 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ModulesSectionNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ModulesSectionNode.cs @@ -55,6 +55,6 @@ namespace ILCompiler.DependencyAnalysis return objData.ToObjectData(); } - protected internal override int ClassCode => -1225116970; + public override int ClassCode => -1225116970; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MrtImports.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MrtImports.cs index 51be3ea4a..503667b2e 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MrtImports.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MrtImports.cs @@ -23,49 +23,49 @@ namespace ILCompiler.DependencyAnalysis { public MrtImportedEETypeSymbolNode(TypeDesc type) : base(type) { } protected override sealed string GetNonImportedName(NameMangler nameMangler) => nameMangler.NodeMangler.EEType(Type); - protected internal override int ClassCode => 126598072; + public override int ClassCode => 126598072; } public sealed class MrtImportedGCStaticSymbolNode : MrtImportWithTypeSymbol { public MrtImportedGCStaticSymbolNode(TypeDesc type) : base(type) { } protected override sealed string GetNonImportedName(NameMangler nameMangler) => GCStaticsNode.GetMangledName(Type, nameMangler); - protected internal override int ClassCode => 1974639431; + public override int ClassCode => 1974639431; } public sealed class MrtImportedNonGCStaticSymbolNode : MrtImportWithTypeSymbol { public MrtImportedNonGCStaticSymbolNode(TypeDesc type) : base(type) { } protected override sealed string GetNonImportedName(NameMangler nameMangler) => NonGCStaticsNode.GetMangledName(Type, nameMangler); - protected internal override int ClassCode => 257546392; + public override int ClassCode => 257546392; } public sealed class MrtImportedThreadStaticOffsetSymbolNode : MrtImportWithTypeSymbol { public MrtImportedThreadStaticOffsetSymbolNode(TypeDesc type) : base(type) { } protected override sealed string GetNonImportedName(NameMangler nameMangler) => ThreadStaticsOffsetNode.GetMangledName(nameMangler, Type); - protected internal override int ClassCode => 1944978231; + public override int ClassCode => 1944978231; } public sealed class MrtImportedMethodDictionarySymbolNode : MrtImportWithMethodSymbol { public MrtImportedMethodDictionarySymbolNode(MethodDesc method) : base(method) { } protected override sealed string GetNonImportedName(NameMangler nameMangler) => nameMangler.NodeMangler.MethodGenericDictionary(Method); - protected internal override int ClassCode => 925274757; + public override int ClassCode => 925274757; } public sealed class MrtImportedMethodCodeSymbolNode : MrtImportWithMethodSymbol, IMethodNode { public MrtImportedMethodCodeSymbolNode(MethodDesc method) : base(method) { } protected override sealed string GetNonImportedName(NameMangler nameMangler) => nameMangler.GetMangledMethodName(Method).ToString(); - protected internal override int ClassCode => -454606757; + public override int ClassCode => -454606757; } public sealed class MrtImportedUnboxingMethodCodeSymbolNode : MrtImportWithMethodSymbol, IMethodNode { public MrtImportedUnboxingMethodCodeSymbolNode(MethodDesc method) : base(method) { } protected override sealed string GetNonImportedName(NameMangler nameMangler) => UnboxingStubNode.GetMangledName(nameMangler, Method); - protected internal override int ClassCode => 1712079609; + public override int ClassCode => 1712079609; } public abstract class MrtImportWithTypeSymbol : MrtImportNode @@ -160,7 +160,7 @@ namespace ILCompiler.DependencyAnalysis public sealed override IEnumerable<CombinedDependencyListEntry> GetConditionalStaticDependencies(NodeFactory factory) => null; public sealed override IEnumerable<CombinedDependencyListEntry> SearchDynamicDependencies(List<DependencyNodeCore<NodeFactory>> markedNodes, int firstNode, NodeFactory factory) => null; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { MrtImportNode otherImportNode = (MrtImportNode)other; @@ -171,7 +171,7 @@ namespace ILCompiler.DependencyAnalysis return Ordinal - otherImportNode.Ordinal; } - protected internal override int ClassCode => 2017985192; + public override int ClassCode => 2017985192; public sealed override IEnumerable<DependencyListEntry> GetStaticDependencies(NodeFactory factory) { @@ -187,13 +187,6 @@ namespace ILCompiler.DependencyAnalysis _importTable.AddNode(this); } - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) - { - return CompareToImpl((SortableDependencyNode)other, comparer); - } - - int ISortableSymbolNode.ClassCode => this.ClassCode; - void ISymbolNode.AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { AppendMangledName(nameMangler, sb); diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MrtProcessedExportAddressTableNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MrtProcessedExportAddressTableNode.cs index 0be12b938..2981c0381 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MrtProcessedExportAddressTableNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MrtProcessedExportAddressTableNode.cs @@ -88,19 +88,12 @@ namespace ILCompiler.DependencyAnalysis return builder.ToObjectData(); } - protected internal override int ClassCode => 40423846; + public override int ClassCode => 40423846; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { Debug.Assert(Object.ReferenceEquals(other, this)); return 0; // There should only ever be one of these per dependency graph } - - int ISortableSymbolNode.ClassCode => ClassCode; - - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) - { - return CompareToImpl((ObjectNode)other, comparer); - } } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MrtProcessedImportAddressTableNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MrtProcessedImportAddressTableNode.cs index e72126588..c2c9b53d9 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MrtProcessedImportAddressTableNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MrtProcessedImportAddressTableNode.cs @@ -113,14 +113,7 @@ namespace ILCompiler.DependencyAnalysis return dependencies; } - protected internal override int ClassCode => -1145565068; - - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) - { - return CompareToImpl((SortableDependencyNode)other, comparer); - } - - int ISortableSymbolNode.ClassCode => this.ClassCode; + public override int ClassCode => -1145565068; void ISymbolNode.AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NativeLayoutInfoNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NativeLayoutInfoNode.cs index a73b9edc3..2b61d0ff4 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NativeLayoutInfoNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NativeLayoutInfoNode.cs @@ -95,6 +95,6 @@ namespace ILCompiler.DependencyAnalysis } protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.NativeLayoutInfoNode; + public override int ClassCode => (int)ObjectNodeOrder.NativeLayoutInfoNode; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NativeLayoutSignatureNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NativeLayoutSignatureNode.cs index 2c1dd5f4d..f4a0044ea 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NativeLayoutSignatureNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NativeLayoutSignatureNode.cs @@ -85,9 +85,9 @@ namespace ILCompiler.DependencyAnalysis return objData.ToObjectData(); } - protected internal override int ClassCode => 1887049331; + public override int ClassCode => 1887049331; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { NativeLayoutSignatureNode otherSignature = (NativeLayoutSignatureNode)other; if (_identity is MethodDesc) @@ -118,4 +118,4 @@ namespace ILCompiler.DependencyAnalysis } } } -}
\ No newline at end of file +} diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NecessaryCanonicalEETypeNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NecessaryCanonicalEETypeNode.cs index 2a72b509b..a55b62860 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NecessaryCanonicalEETypeNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NecessaryCanonicalEETypeNode.cs @@ -27,6 +27,6 @@ namespace ILCompiler.DependencyAnalysis return _type.BaseType != null ? factory.NecessaryTypeSymbol(GetFullCanonicalTypeForCanonicalType(_type.BaseType)) : null; } - protected internal override int ClassCode => 1505000724; + public override int ClassCode => 1505000724; } -}
\ No newline at end of file +} diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NonExternMethodSymbolNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NonExternMethodSymbolNode.cs index c84326a55..097d67036 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NonExternMethodSymbolNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NonExternMethodSymbolNode.cs @@ -149,22 +149,15 @@ namespace ILCompiler.DependencyAnalysis return dependencies; } - protected sealed internal override int ClassCode => -2124588118; + public override int ClassCode => -2124588118; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { NonExternMethodSymbolNode otherMethod = (NonExternMethodSymbolNode)other; var result = _isUnboxing.CompareTo(otherMethod._isUnboxing); return result != 0 ? result : comparer.Compare(_method, otherMethod._method); } - int ISortableSymbolNode.ClassCode => ClassCode; - - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) - { - return CompareToImpl((SortableDependencyNode)other, comparer); - } - private class FuncletSymbol : ISymbolNodeWithFuncletId { public FuncletSymbol(NonExternMethodSymbolNode methodSymbol, int funcletId) diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NonGCStaticsNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NonGCStaticsNode.cs index 0c90865e9..ac2115d7c 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NonGCStaticsNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NonGCStaticsNode.cs @@ -180,18 +180,11 @@ namespace ILCompiler.DependencyAnalysis return builder.ToObjectData(); } - protected internal override int ClassCode => -1173104872; + public override int ClassCode => -1173104872; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_type, ((NonGCStaticsNode)other)._type); } - - int ISortableSymbolNode.ClassCode => ClassCode; - - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) - { - return CompareToImpl((ObjectNode)other, comparer); - } } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/PInvokeMethodFixupNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/PInvokeMethodFixupNode.cs index ddb256bae..c7707b23a 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/PInvokeMethodFixupNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/PInvokeMethodFixupNode.cs @@ -87,9 +87,9 @@ namespace ILCompiler.DependencyAnalysis return builder.ToObjectData(); } - protected internal override int ClassCode => -1592006940; + public override int ClassCode => -1592006940; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { var flagsCompare = _flags.CompareTo(((PInvokeMethodFixupNode)other)._flags); if (flagsCompare != 0) diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/PInvokeModuleFixupNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/PInvokeModuleFixupNode.cs index bf83f13b1..784f791ba 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/PInvokeModuleFixupNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/PInvokeModuleFixupNode.cs @@ -50,9 +50,9 @@ namespace ILCompiler.DependencyAnalysis return builder.ToObjectData(); } - protected internal override int ClassCode => 159930099; + public override int ClassCode => 159930099; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return string.Compare(_moduleName, ((PInvokeModuleFixupNode)other)._moduleName); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReadyToRunGenericHelperNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReadyToRunGenericHelperNode.cs index e7c36429d..f68ccbf0a 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReadyToRunGenericHelperNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReadyToRunGenericHelperNode.cs @@ -208,7 +208,7 @@ namespace ILCompiler.DependencyAnalysis return conditionalDependencies; } - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { var compare = _id.CompareTo(((ReadyToRunGenericHelperNode)other)._id); if (compare != 0) @@ -274,7 +274,7 @@ namespace ILCompiler.DependencyAnalysis AppendLookupSignatureMangledName(nameMangler, sb); } - protected internal override int ClassCode => 1055354299; + public override int ClassCode => 1055354299; } public partial class ReadyToRunGenericLookupFromTypeNode : ReadyToRunGenericHelperNode @@ -296,6 +296,6 @@ namespace ILCompiler.DependencyAnalysis AppendLookupSignatureMangledName(nameMangler, sb); } - protected internal override int ClassCode => 913214059; + public override int ClassCode => 913214059; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReadyToRunHeaderNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReadyToRunHeaderNode.cs index 6c2fd6d73..fa8e6ed26 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReadyToRunHeaderNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReadyToRunHeaderNode.cs @@ -128,6 +128,6 @@ namespace ILCompiler.DependencyAnalysis return builder.ToObjectData(); } - protected internal override int ClassCode => -534800244; + public override int ClassCode => -534800244; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReadyToRunHelperNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReadyToRunHelperNode.cs index 00bdb48b8..76f4785a4 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReadyToRunHelperNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReadyToRunHelperNode.cs @@ -229,9 +229,9 @@ namespace ILCompiler.DependencyAnalysis } #if !SUPPORT_JIT - protected internal override int ClassCode => -911637948; + public override int ClassCode => -911637948; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { var compare = _id.CompareTo(((ReadyToRunHelperNode)other)._id); if (compare != 0) diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReflectionFieldMapNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReflectionFieldMapNode.cs index 93bf59979..7c062d068 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReflectionFieldMapNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReflectionFieldMapNode.cs @@ -187,6 +187,6 @@ namespace ILCompiler.DependencyAnalysis } protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.ReflectionFieldMapNode; + public override int ClassCode => (int)ObjectNodeOrder.ReflectionFieldMapNode; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReflectionInvokeMapNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReflectionInvokeMapNode.cs index 73a95d2e5..2304902a5 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReflectionInvokeMapNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReflectionInvokeMapNode.cs @@ -189,6 +189,6 @@ namespace ILCompiler.DependencyAnalysis } protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.ReflectionInvokeMapNode; + public override int ClassCode => (int)ObjectNodeOrder.ReflectionInvokeMapNode; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReflectionVirtualInvokeMapNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReflectionVirtualInvokeMapNode.cs index cc9f6a98a..0b256dbf1 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReflectionVirtualInvokeMapNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReflectionVirtualInvokeMapNode.cs @@ -242,6 +242,6 @@ namespace ILCompiler.DependencyAnalysis } protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.ReflectionVirtualInvokeMapNode; + public override int ClassCode => (int)ObjectNodeOrder.ReflectionVirtualInvokeMapNode; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ResourceDataNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ResourceDataNode.cs index 683343ffe..b425283de 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ResourceDataNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ResourceDataNode.cs @@ -148,7 +148,7 @@ namespace ILCompiler.DependencyAnalysis } protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.ResourceDataNode; + public override int ClassCode => (int)ObjectNodeOrder.ResourceDataNode; } /// <summary> diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ResourceIndexNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ResourceIndexNode.cs index 4ad4a3b89..bd1243f4a 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ResourceIndexNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ResourceIndexNode.cs @@ -97,6 +97,6 @@ namespace ILCompiler.DependencyAnalysis } protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.ResourceIndexNode; + public override int ClassCode => (int)ObjectNodeOrder.ResourceIndexNode; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/RuntimeDecodableJumpStub.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/RuntimeDecodableJumpStub.cs index d4d8e06ff..1fba7e459 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/RuntimeDecodableJumpStub.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/RuntimeDecodableJumpStub.cs @@ -50,18 +50,11 @@ namespace ILCompiler.DependencyAnalysis protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); - protected internal override int ClassCode => 532434339; + public override int ClassCode => 532434339; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(WrappedMethodIndirectionCellNode, ((RuntimeDecodableJumpStubNode)other).WrappedMethodIndirectionCellNode); } - - int ISortableSymbolNode.ClassCode => ClassCode; - - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) - { - return CompareToImpl((ObjectNode)other, comparer); - } } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/RuntimeDeterminedMethodNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/RuntimeDeterminedMethodNode.cs index d3a3672ea..e9ac8a8d7 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/RuntimeDeterminedMethodNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/RuntimeDeterminedMethodNode.cs @@ -62,9 +62,9 @@ namespace ILCompiler.DependencyAnalysis public override IEnumerable<CombinedDependencyListEntry> SearchDynamicDependencies(List<DependencyNodeCore<NodeFactory>> markedNodes, int firstNode, NodeFactory factory) => null; public override IEnumerable<CombinedDependencyListEntry> GetConditionalStaticDependencies(NodeFactory factory) => null; - int ISortableSymbolNode.ClassCode => 258139501; + int ISortableNode.ClassCode => 258139501; - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) + int ISortableNode.CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_canonicalMethodNode, ((RuntimeDeterminedMethodNode)other)._canonicalMethodNode); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/RuntimeFieldHandleNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/RuntimeFieldHandleNode.cs index 9bcd7c314..c5eaeddfe 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/RuntimeFieldHandleNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/RuntimeFieldHandleNode.cs @@ -65,9 +65,9 @@ namespace ILCompiler.DependencyAnalysis return objData.ToObjectData(); } - protected internal override int ClassCode => -1326215725; + public override int ClassCode => -1326215725; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_targetField, ((RuntimeFieldHandleNode)other)._targetField); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/RuntimeImportMethodNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/RuntimeImportMethodNode.cs index 3a91c46fe..ac7adb740 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/RuntimeImportMethodNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/RuntimeImportMethodNode.cs @@ -28,9 +28,9 @@ namespace ILCompiler.DependencyAnalysis } } - protected internal override int ClassCode => -1173492615; + public override int ClassCode => -1173492615; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_method, ((RuntimeImportMethodNode)other)._method); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/RuntimeMethodHandleNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/RuntimeMethodHandleNode.cs index 5cf5d4fc3..39884096a 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/RuntimeMethodHandleNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/RuntimeMethodHandleNode.cs @@ -80,9 +80,9 @@ namespace ILCompiler.DependencyAnalysis return objData.ToObjectData(); } - protected internal override int ClassCode => -274400625; + public override int ClassCode => -274400625; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_targetMethod, ((RuntimeMethodHandleNode)other)._targetMethod); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ScannedMethodNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ScannedMethodNode.cs index 43d27c344..4dfd01266 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ScannedMethodNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ScannedMethodNode.cs @@ -63,9 +63,9 @@ namespace ILCompiler.DependencyAnalysis public override bool HasDynamicDependencies => false; public override bool HasConditionalStaticDependencies => false; - int ISortableSymbolNode.ClassCode => -1381809560; + int ISortableNode.ClassCode => -1381809560; - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) + int ISortableNode.CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(Method, ((ScannedMethodNode)other).Method); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/SealedVTableNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/SealedVTableNode.cs index 80d67a9bd..942e14dc4 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/SealedVTableNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/SealedVTableNode.cs @@ -160,8 +160,8 @@ namespace ILCompiler.DependencyAnalysis return objData.ToObjectData(); } - protected internal override int ClassCode => 1632890252; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int ClassCode => 1632890252; + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_type, ((SealedVTableNode)other)._type); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ShadowConcreteMethodNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ShadowConcreteMethodNode.cs index 40d7cc978..66c9e8ef1 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ShadowConcreteMethodNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ShadowConcreteMethodNode.cs @@ -99,9 +99,9 @@ namespace ILCompiler.DependencyAnalysis public sealed override IEnumerable<CombinedDependencyListEntry> SearchDynamicDependencies(List<DependencyNodeCore<NodeFactory>> markedNodes, int firstNode, NodeFactory factory) => null; public sealed override IEnumerable<CombinedDependencyListEntry> GetConditionalStaticDependencies(NodeFactory factory) => null; - int ISortableSymbolNode.ClassCode => -1440570971; + int ISortableNode.ClassCode => -1440570971; - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) + int ISortableNode.CompareToImpl(ISortableNode other, CompilerComparer comparer) { var compare = comparer.Compare(Method, ((ShadowConcreteMethodNode)other).Method); if (compare != 0) diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ShadowConcreteUnboxingThunkNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ShadowConcreteUnboxingThunkNode.cs index fe973fdb3..9a1dae917 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ShadowConcreteUnboxingThunkNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ShadowConcreteUnboxingThunkNode.cs @@ -70,9 +70,9 @@ namespace ILCompiler.DependencyAnalysis public sealed override IEnumerable<CombinedDependencyListEntry> SearchDynamicDependencies(List<DependencyNodeCore<NodeFactory>> markedNodes, int firstNode, NodeFactory factory) => null; public sealed override IEnumerable<CombinedDependencyListEntry> GetConditionalStaticDependencies(NodeFactory factory) => null; - int ISortableSymbolNode.ClassCode => -501699818; + int ISortableNode.ClassCode => -501699818; - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) + int ISortableNode.CompareToImpl(ISortableNode other, CompilerComparer comparer) { var compare = comparer.Compare(Method, ((ShadowConcreteUnboxingThunkNode)other).Method); if (compare != 0) diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/SortableDependencyNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/SortableDependencyNode.cs index 9f2443f6f..f65c5b602 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/SortableDependencyNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/SortableDependencyNode.cs @@ -12,7 +12,7 @@ using Internal.TypeSystem; namespace ILCompiler.DependencyAnalysis { - public abstract class SortableDependencyNode : DependencyNodeCore<NodeFactory> + public abstract class SortableDependencyNode : DependencyNodeCore<NodeFactory>, ISortableNode { #if !SUPPORT_JIT /// <summary> @@ -29,10 +29,10 @@ namespace ILCompiler.DependencyAnalysis /// This is really just a number, ideally produced by "new Random().Next(int.MinValue, int.MaxValue)". /// If two manage to conflict (which is pretty unlikely), just make a new one... /// </remarks> - protected internal abstract int ClassCode { get; } - + public abstract int ClassCode { get; } + // Note to implementers: the type of `other` is actually the same as the type of `this`. - protected internal virtual int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public virtual int CompareToImpl(ISortableNode other, CompilerComparer comparer) { throw new NotImplementedException("Multiple nodes of this type are not supported"); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/StackTraceEmbeddedMetadataNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/StackTraceEmbeddedMetadataNode.cs index b1ab09a29..39c62fcb0 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/StackTraceEmbeddedMetadataNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/StackTraceEmbeddedMetadataNode.cs @@ -38,7 +38,7 @@ namespace ILCompiler.DependencyAnalysis public int Offset => 0; protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.StackTraceEmbeddedMetadataNode; + public override int ClassCode => (int)ObjectNodeOrder.StackTraceEmbeddedMetadataNode; public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/StackTraceMethodMappingNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/StackTraceMethodMappingNode.cs index de12c6f92..d9c13b19c 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/StackTraceMethodMappingNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/StackTraceMethodMappingNode.cs @@ -31,7 +31,7 @@ namespace ILCompiler.DependencyAnalysis public int Offset => 0; protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.StackTraceMethodMappingNode; + public override int ClassCode => (int)ObjectNodeOrder.StackTraceMethodMappingNode; public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/StaticsInfoHashtableNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/StaticsInfoHashtableNode.cs index 14b81d92e..232fa7410 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/StaticsInfoHashtableNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/StaticsInfoHashtableNode.cs @@ -148,6 +148,6 @@ namespace ILCompiler.DependencyAnalysis } protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.StaticsInfoHashtableNode; + public override int ClassCode => (int)ObjectNodeOrder.StaticsInfoHashtableNode; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/StringAllocatorMethodNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/StringAllocatorMethodNode.cs index fe9528040..4e68d5536 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/StringAllocatorMethodNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/StringAllocatorMethodNode.cs @@ -73,9 +73,9 @@ namespace ILCompiler.DependencyAnalysis protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); - int ISortableSymbolNode.ClassCode => 1991750873; + int ISortableNode.ClassCode => 1991750873; - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) + int ISortableNode.CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_allocationMethod, ((StringAllocatorMethodNode)other)._allocationMethod); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/StructMarshallingStubMapNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/StructMarshallingStubMapNode.cs index 584dda92f..d4d5664fd 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/StructMarshallingStubMapNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/StructMarshallingStubMapNode.cs @@ -106,6 +106,6 @@ namespace ILCompiler.DependencyAnalysis } protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.StructMarshallingStubMapNode; + public override int ClassCode => (int)ObjectNodeOrder.StructMarshallingStubMapNode; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/Target_ARM/ARMInitialInterfaceDispatchStubNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/Target_ARM/ARMInitialInterfaceDispatchStubNode.cs index 1c201ebe3..7e1793acf 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/Target_ARM/ARMInitialInterfaceDispatchStubNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/Target_ARM/ARMInitialInterfaceDispatchStubNode.cs @@ -52,6 +52,6 @@ namespace ILCompiler.DependencyAnalysis throw new NotImplementedException(); } - protected internal override int ClassCode => 588185132; + public override int ClassCode => 588185132; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ThreadStaticsIndexNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ThreadStaticsIndexNode.cs index f350c2cfb..fbfe07f9e 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ThreadStaticsIndexNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ThreadStaticsIndexNode.cs @@ -82,19 +82,12 @@ namespace ILCompiler.DependencyAnalysis return objData.ToObjectData(); } - protected internal override int ClassCode => -968500265; + public override int ClassCode => -968500265; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return string.Compare(_prefix, ((ThreadStaticsIndexNode)other)._prefix); } - - int ISortableSymbolNode.ClassCode => ClassCode; - - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) - { - return CompareToImpl((ObjectNode)other, comparer); - } } // The data structure used by the OS loader to load TLS chunks. @@ -182,9 +175,9 @@ namespace ILCompiler.DependencyAnalysis return objData.ToObjectData(); } - protected internal override int ClassCode => -754150753; + public override int ClassCode => -754150753; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return string.Compare(_prefix, ((ThreadStaticsDirectoryNode)other)._prefix); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ThreadStaticsNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ThreadStaticsNode.cs index 357dde0fe..89a479939 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ThreadStaticsNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ThreadStaticsNode.cs @@ -76,9 +76,9 @@ namespace ILCompiler.DependencyAnalysis builder.EmitPointerReloc(GetGCStaticEETypeNode(factory)); } - protected internal override int ClassCode => 2091208431; + public override int ClassCode => 2091208431; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_type, ((ThreadStaticsNode)other)._type); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ThreadStaticsOffsetNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ThreadStaticsOffsetNode.cs index ee529a816..5eb2f7525 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ThreadStaticsOffsetNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ThreadStaticsOffsetNode.cs @@ -74,18 +74,11 @@ namespace ILCompiler.DependencyAnalysis builder.EmitReloc(factory.TypeThreadStaticsSymbol(_type), RelocType.IMAGE_REL_SECREL); } - sealed protected internal override int ClassCode => 419394032; + public sealed override int ClassCode => 419394032; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_type, ((ThreadStaticsOffsetNode)other)._type); } - - int ISortableSymbolNode.ClassCode => ClassCode; - - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) - { - return CompareToImpl((SortableDependencyNode)other, comparer); - } } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/TypeManagerIndirectionNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/TypeManagerIndirectionNode.cs index 4199c29fb..7a7c4b797 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/TypeManagerIndirectionNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/TypeManagerIndirectionNode.cs @@ -34,6 +34,6 @@ namespace ILCompiler.DependencyAnalysis return objData.ToObjectData(); } - protected internal override int ClassCode => -2028598574; + public override int ClassCode => -2028598574; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/TypeMetadataMapNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/TypeMetadataMapNode.cs index 75012d6e8..ca2cb8f0a 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/TypeMetadataMapNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/TypeMetadataMapNode.cs @@ -82,6 +82,6 @@ namespace ILCompiler.DependencyAnalysis protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.TypeMetadataMapNode; + public override int ClassCode => (int)ObjectNodeOrder.TypeMetadataMapNode; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/TypeThreadStaticIndexNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/TypeThreadStaticIndexNode.cs index 11ac06f2c..2c20841bb 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/TypeThreadStaticIndexNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/TypeThreadStaticIndexNode.cs @@ -67,9 +67,9 @@ namespace ILCompiler.DependencyAnalysis return objData.ToObjectData(); } - protected internal override int ClassCode => -149601250; + public override int ClassCode => -149601250; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_type, ((TypeThreadStaticIndexNode)other)._type); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/UnboxingStubNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/UnboxingStubNode.cs index d0cb80ba3..ae39c5074 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/UnboxingStubNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/UnboxingStubNode.cs @@ -70,19 +70,12 @@ namespace ILCompiler.DependencyAnalysis protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); - protected internal override int ClassCode => -1846923013; + public override int ClassCode => -1846923013; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(Method, ((UnboxingStubNode)other).Method); } - - int ISortableSymbolNode.ClassCode => ClassCode; - - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) - { - return CompareToImpl((ObjectNode)other, comparer); - } } // @@ -122,9 +115,9 @@ namespace ILCompiler.DependencyAnalysis return objData.ToObjectData(); } - protected internal override int ClassCode => 1102274050; + public override int ClassCode => 1102274050; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return _isEndSymbol.CompareTo(((WindowsUnboxingStubsRegionNode)other)._isEndSymbol); } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/UtcThreadStaticsNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/UtcThreadStaticsNode.cs index 2495fb84d..c4eac9a49 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/UtcThreadStaticsNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/UtcThreadStaticsNode.cs @@ -63,19 +63,11 @@ namespace ILCompiler.DependencyAnalysis return builder.ToObjectData(); } - protected sealed internal override int ClassCode => -1421136129; + public sealed override int ClassCode => -1421136129; - protected internal override int CompareToImpl(SortableDependencyNode other, CompilerComparer comparer) + public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_type, ((UtcThreadStaticsNode)other)._type); } - - int ISortableSymbolNode.ClassCode => ClassCode; - - int ISortableSymbolNode.CompareToImpl(ISortableSymbolNode other, CompilerComparer comparer) - { - return CompareToImpl((ObjectNode)other, comparer); - } - } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugILImagesSection.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugILImagesSection.cs index 5ac16bbb3..284e4fe17 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugILImagesSection.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugILImagesSection.cs @@ -30,7 +30,7 @@ namespace ILCompiler.DependencyAnalysis public int Offset => 0; - protected internal override int ClassCode => 2051656903; + public override int ClassCode => 2051656903; public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugManagedNativeDictionaryInfoSection.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugManagedNativeDictionaryInfoSection.cs index 9d3e33deb..79c176034 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugManagedNativeDictionaryInfoSection.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugManagedNativeDictionaryInfoSection.cs @@ -31,7 +31,7 @@ namespace ILCompiler.DependencyAnalysis public int Offset => 0; protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.WindowsDebugManagedNativeDictionaryInfoSectionNode; + public override int ClassCode => (int)ObjectNodeOrder.WindowsDebugManagedNativeDictionaryInfoSectionNode; public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugMergedAssemblyRecordsSection.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugMergedAssemblyRecordsSection.cs index 49f75a100..d16f9cc5b 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugMergedAssemblyRecordsSection.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugMergedAssemblyRecordsSection.cs @@ -31,7 +31,7 @@ namespace ILCompiler.DependencyAnalysis public int Offset => 0; - protected internal override int ClassCode => -1250136545; + public override int ClassCode => -1250136545; public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugMethodInfoSection.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugMethodInfoSection.cs index 03488c594..9a8d8e765 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugMethodInfoSection.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugMethodInfoSection.cs @@ -150,6 +150,6 @@ namespace ILCompiler.DependencyAnalysis return "___DebugMethodInfoSection"; } - protected internal override int ClassCode => 513099721; + public override int ClassCode => 513099721; } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugMethodMapSection.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugMethodMapSection.cs index da8596c16..9ff897804 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugMethodMapSection.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugMethodMapSection.cs @@ -31,7 +31,7 @@ namespace ILCompiler.DependencyAnalysis public int Offset => 0; protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.WindowsDebugMethodSignatureMapSectionNode; + public override int ClassCode => (int)ObjectNodeOrder.WindowsDebugMethodSignatureMapSectionNode; public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugNeedTypeIndicesStoreNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugNeedTypeIndicesStoreNode.cs index c52a7ea1d..3aa7335d8 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugNeedTypeIndicesStoreNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugNeedTypeIndicesStoreNode.cs @@ -22,7 +22,7 @@ namespace ILCompiler.DependencyAnalysis public int Offset => 0; protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.WindowsDebugNeedTypeIndicesStoreNode; + public override int ClassCode => (int)ObjectNodeOrder.WindowsDebugNeedTypeIndicesStoreNode; public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugPseudoAssemblySection.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugPseudoAssemblySection.cs index 4b3e55177..6780d0685 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugPseudoAssemblySection.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugPseudoAssemblySection.cs @@ -30,7 +30,7 @@ namespace ILCompiler.DependencyAnalysis public int Offset => 0; protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.WindowsDebugPseudoAssemblySectionNode; + public override int ClassCode => (int)ObjectNodeOrder.WindowsDebugPseudoAssemblySectionNode; public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugTypeRecordsSection.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugTypeRecordsSection.cs index 543f213f9..e74e0a077 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugTypeRecordsSection.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugTypeRecordsSection.cs @@ -34,7 +34,7 @@ namespace ILCompiler.DependencyAnalysis public int Offset => 0; protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.WindowsDebugTypeRecordsSectionNode; + public override int ClassCode => (int)ObjectNodeOrder.WindowsDebugTypeRecordsSectionNode; public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugTypeSignatureMapSection.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugTypeSignatureMapSection.cs index f40ff4e87..a5aaea9b7 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugTypeSignatureMapSection.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/WindowsDebugTypeSignatureMapSection.cs @@ -32,7 +32,7 @@ namespace ILCompiler.DependencyAnalysis public int Offset => 0; protected internal override int Phase => (int)ObjectNodePhase.Ordered; - protected internal override int ClassCode => (int)ObjectNodeOrder.WindowsDebugTypeSignatureMapSectionNode; + public override int ClassCode => (int)ObjectNodeOrder.WindowsDebugTypeSignatureMapSectionNode; public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { diff --git a/src/ILCompiler.Compiler/src/ILCompiler.Compiler.csproj b/src/ILCompiler.Compiler/src/ILCompiler.Compiler.csproj index 7b86399ea..c8ddc8902 100644 --- a/src/ILCompiler.Compiler/src/ILCompiler.Compiler.csproj +++ b/src/ILCompiler.Compiler/src/ILCompiler.Compiler.csproj @@ -129,6 +129,7 @@ <Compile Include="Compiler\DevirtualizationManager.cs" /> <Compile Include="Compiler\DictionaryLayoutProvider.cs" /> <Compile Include="Compiler\EmptyInteropStubManager.cs" /> + <Compile Include="Compiler\DependencyAnalysis\ISortableNode.cs" /> <Compile Include="Compiler\DependencyAnalysis\SortableDependencyNode.cs" /> <Compile Include="Compiler\DependencyAnalysis\ImportedNodeProvider.cs" /> <Compile Include="Compiler\FrameworkStringResourceBlockingPolicy.cs" /> 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); } 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); } diff --git a/src/System.Private.Jit/src/System.Private.Jit.csproj b/src/System.Private.Jit/src/System.Private.Jit.csproj index 39cb058cc..f49426928 100644 --- a/src/System.Private.Jit/src/System.Private.Jit.csproj +++ b/src/System.Private.Jit/src/System.Private.Jit.csproj @@ -126,6 +126,7 @@ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\ObjectNodeSection.cs" /> <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\ReadyToRunHelperNode.cs" /> <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\Relocation.cs" /> + <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\ISortableNode.cs" /> <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\SortableDependencyNode.cs" /> <Compile Include="$(ILCompilerBasePath)\Compiler\DelegateCreationInfo.cs" /> <Compile Include="$(ILCompilerBasePath)\Compiler\JitHelper.cs" /> |