diff options
author | Michal Strehovský <MichalStrehovsky@users.noreply.github.com> | 2022-11-09 06:21:34 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-09 06:21:34 +0300 |
commit | 18eaeb27c0f69d9ebd60fbe9301014d405e40017 (patch) | |
tree | 9fe2efef8079a5804afecb9f57fe25843ea611cb | |
parent | 2d251ae9e33469d1829ff6f1421180d96c237e52 (diff) |
Pass NodeFactory to ObjectData's Section (#77967)
This is a preparatory change for something I'm working on, but makes sense on its own - notice several node types that had to hold on to extra state just because we didn't have context in the `Section` property. Got rid of the extra state as well. A couple bytes of memory saved here and there.
93 files changed, 187 insertions, 296 deletions
diff --git a/src/coreclr/tools/Common/Compiler/DependencyAnalysis/AssemblyStubNode.cs b/src/coreclr/tools/Common/Compiler/DependencyAnalysis/AssemblyStubNode.cs index b289ff34706..6b51f875d15 100644 --- a/src/coreclr/tools/Common/Compiler/DependencyAnalysis/AssemblyStubNode.cs +++ b/src/coreclr/tools/Common/Compiler/DependencyAnalysis/AssemblyStubNode.cs @@ -21,7 +21,7 @@ namespace ILCompiler.DependencyAnalysis /// </summary> protected virtual bool IsVisibleFromManagedCode => true; - public override ObjectNodeSection Section => ObjectNodeSection.TextSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.TextSection; public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/Common/Compiler/DependencyAnalysis/MethodReadOnlyDataNode.cs b/src/coreclr/tools/Common/Compiler/DependencyAnalysis/MethodReadOnlyDataNode.cs index 9a8e941f022..a9faa695fb1 100644 --- a/src/coreclr/tools/Common/Compiler/DependencyAnalysis/MethodReadOnlyDataNode.cs +++ b/src/coreclr/tools/Common/Compiler/DependencyAnalysis/MethodReadOnlyDataNode.cs @@ -18,7 +18,7 @@ namespace ILCompiler.DependencyAnalysis _owningMethod = owningMethod; } - public override ObjectNodeSection Section => ObjectNodeSection.ReadOnlyDataSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.ReadOnlyDataSection; public override bool StaticDependenciesAreComputed => _data != null; public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) diff --git a/src/coreclr/tools/Common/Compiler/DependencyAnalysis/ObjectNode.cs b/src/coreclr/tools/Common/Compiler/DependencyAnalysis/ObjectNode.cs index 5122c584ae0..32744757168 100644 --- a/src/coreclr/tools/Common/Compiler/DependencyAnalysis/ObjectNode.cs +++ b/src/coreclr/tools/Common/Compiler/DependencyAnalysis/ObjectNode.cs @@ -30,7 +30,7 @@ namespace ILCompiler.DependencyAnalysis public abstract ObjectData GetData(NodeFactory factory, bool relocsOnly = false); - public abstract ObjectNodeSection Section { get; } + public abstract ObjectNodeSection GetSection(NodeFactory factory); /// <summary> /// Should identical symbols emitted into separate object files be Comdat folded when linked together? diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ArrayMapNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ArrayMapNode.cs index 02bcfd36914..2fff19939fc 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ArrayMapNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ArrayMapNode.cs @@ -32,7 +32,7 @@ namespace ILCompiler.DependencyAnalysis public int Offset => 0; public override bool IsShareable => false; - public override ObjectNodeSection Section => _externalReferences.Section; + public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory); public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ArrayOfEmbeddedDataNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ArrayOfEmbeddedDataNode.cs index beaa6c24c35..2e75de7ead9 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ArrayOfEmbeddedDataNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ArrayOfEmbeddedDataNode.cs @@ -41,7 +41,7 @@ namespace ILCompiler.DependencyAnalysis protected override string GetName(NodeFactory factory) => $"Region {StartSymbol.GetMangledName(factory.NameMangler)}"; - public override ObjectNodeSection Section => ObjectNodeSection.DataSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.DataSection; public override bool IsShareable => false; public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/BlobNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/BlobNode.cs index bee1c395219..846c15e4410 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/BlobNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/BlobNode.cs @@ -22,7 +22,7 @@ namespace ILCompiler.DependencyAnalysis _alignment = alignment; } - public override ObjectNodeSection Section => _section; + public override ObjectNodeSection GetSection(NodeFactory factory) => _section; public override bool StaticDependenciesAreComputed => true; public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/BlockReflectionTypeMapNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/BlockReflectionTypeMapNode.cs index 184ab830eaf..707ad234647 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/BlockReflectionTypeMapNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/BlockReflectionTypeMapNode.cs @@ -32,7 +32,7 @@ namespace ILCompiler.DependencyAnalysis public int Offset => 0; public override bool IsShareable => false; - public override ObjectNodeSection Section => _externalReferences.Section; + public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory); public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ClassConstructorContextMap.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ClassConstructorContextMap.cs index f8c39f2a61a..2f84a816e0f 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ClassConstructorContextMap.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ClassConstructorContextMap.cs @@ -30,7 +30,7 @@ namespace ILCompiler.DependencyAnalysis } public int Offset => 0; - public override ObjectNodeSection Section => _externalReferences.Section; + public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory); public override bool IsShareable => false; public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/DefaultConstructorMapNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/DefaultConstructorMapNode.cs index c1603a87ad1..ff6647649d7 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/DefaultConstructorMapNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/DefaultConstructorMapNode.cs @@ -33,7 +33,7 @@ namespace ILCompiler.DependencyAnalysis public int Offset => 0; public override bool IsShareable => false; - public override ObjectNodeSection Section => _externalReferences.Section; + public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory); public override bool ShouldSkipEmittingObjectNode(NodeFactory factory) => false; public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/DelegateMarshallingStubMapNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/DelegateMarshallingStubMapNode.cs index bfe3777676b..1176f0e1bf4 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/DelegateMarshallingStubMapNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/DelegateMarshallingStubMapNode.cs @@ -34,7 +34,7 @@ namespace ILCompiler.DependencyAnalysis public int Offset => 0; public override bool IsShareable => false; - public override ObjectNodeSection Section => _externalReferences.Section; + public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory); public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/EETypeNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/EETypeNode.cs index e159318beca..91eec5ffef3 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/EETypeNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/EETypeNode.cs @@ -117,15 +117,12 @@ namespace ILCompiler.DependencyAnalysis public TypeDesc Type => _type; - public override ObjectNodeSection Section + public override ObjectNodeSection GetSection(NodeFactory factory) { - get - { - if (_type.Context.Target.IsWindows) - return ObjectNodeSection.ReadOnlyDataSection; - else - return ObjectNodeSection.DataSection; - } + if (factory.Target.IsWindows) + return ObjectNodeSection.ReadOnlyDataSection; + else + return ObjectNodeSection.DataSection; } public int MinimumObjectSize => GetMinimumObjectSize(_type.Context); diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/EETypeOptionalFieldsNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/EETypeOptionalFieldsNode.cs index fbde550ed54..cb10e790d41 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/EETypeOptionalFieldsNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/EETypeOptionalFieldsNode.cs @@ -14,15 +14,12 @@ namespace ILCompiler.DependencyAnalysis _owner = owner; } - public override ObjectNodeSection Section + public override ObjectNodeSection GetSection(NodeFactory factory) { - get - { - if (_owner.Type.Context.Target.IsWindows) - return ObjectNodeSection.FoldableReadOnlyDataSection; - else - return ObjectNodeSection.DataSection; - } + if (factory.Target.IsWindows) + return ObjectNodeSection.FoldableReadOnlyDataSection; + else + return ObjectNodeSection.DataSection; } public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ExactMethodInstantiationsNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ExactMethodInstantiationsNode.cs index c91124338a7..46f4eed60a4 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ExactMethodInstantiationsNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ExactMethodInstantiationsNode.cs @@ -32,7 +32,7 @@ namespace ILCompiler.DependencyAnalysis public ISymbolDefinitionNode EndSymbol => _endSymbol; public int Offset => 0; public override bool IsShareable => false; - public override ObjectNodeSection Section => _externalReferences.Section; + public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory); public override bool StaticDependenciesAreComputed => true; protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ExternalReferencesTableNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ExternalReferencesTableNode.cs index 2cbd2b03a09..3c2c3d29289 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ExternalReferencesTableNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ExternalReferencesTableNode.cs @@ -66,15 +66,12 @@ namespace ILCompiler.DependencyAnalysis return index; } - public override ObjectNodeSection Section + public override ObjectNodeSection GetSection(NodeFactory factory) { - get - { - if (_nodeFactory.Target.IsWindows || _nodeFactory.Target.SupportsRelativePointers) - return ObjectNodeSection.ReadOnlyDataSection; - else - return ObjectNodeSection.DataSection; - } + if (factory.Target.IsWindows || factory.Target.SupportsRelativePointers) + return ObjectNodeSection.ReadOnlyDataSection; + else + return ObjectNodeSection.DataSection; } public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/FatFunctionPointerNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/FatFunctionPointerNode.cs index ca1ff7267fe..3833faacc6d 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/FatFunctionPointerNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/FatFunctionPointerNode.cs @@ -41,15 +41,12 @@ namespace ILCompiler.DependencyAnalysis public MethodDesc Method { get; } - public override ObjectNodeSection Section + public override ObjectNodeSection GetSection(NodeFactory factory) { - get - { - if (Method.Context.Target.IsWindows) - return ObjectNodeSection.ReadOnlyDataSection; - else - return ObjectNodeSection.DataSection; - } + if (factory.Target.IsWindows) + return ObjectNodeSection.ReadOnlyDataSection; + else + return ObjectNodeSection.DataSection; } public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/FieldRvaDataNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/FieldRvaDataNode.cs index 243a4cd225b..1acbf20a73a 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/FieldRvaDataNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/FieldRvaDataNode.cs @@ -21,7 +21,7 @@ namespace ILCompiler.DependencyAnalysis _field = field; } - public override ObjectNodeSection Section => ObjectNodeSection.ReadOnlyDataSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.ReadOnlyDataSection; public override bool StaticDependenciesAreComputed => true; public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GCStaticEETypeNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GCStaticEETypeNode.cs index 9a772271e3f..b96839ea5f7 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GCStaticEETypeNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GCStaticEETypeNode.cs @@ -29,15 +29,12 @@ namespace ILCompiler.DependencyAnalysis protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); - public override ObjectNodeSection Section + public override ObjectNodeSection GetSection(NodeFactory factory) { - get - { - if (_target.IsWindows) - return ObjectNodeSection.ReadOnlyDataSection; - else - return ObjectNodeSection.DataSection; - } + if (_target.IsWindows) + return ObjectNodeSection.ReadOnlyDataSection; + else + return ObjectNodeSection.DataSection; } public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GCStaticsNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GCStaticsNode.cs index 08e706b527c..15bb92230cf 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GCStaticsNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GCStaticsNode.cs @@ -72,7 +72,7 @@ namespace ILCompiler.DependencyAnalysis public override bool StaticDependenciesAreComputed => true; - public override ObjectNodeSection Section => ObjectNodeSection.DataSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.DataSection; public override bool IsShareable => EETypeNode.IsTypeNodeShareable(_type); public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false) diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GCStaticsPreInitDataNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GCStaticsPreInitDataNode.cs index 1514c8a1ce7..865d1ee19cb 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GCStaticsPreInitDataNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GCStaticsPreInitDataNode.cs @@ -41,15 +41,12 @@ namespace ILCompiler.DependencyAnalysis public override bool StaticDependenciesAreComputed => true; - public override ObjectNodeSection Section + public override ObjectNodeSection GetSection(NodeFactory factory) { - get - { - if (Type.Context.Target.IsWindows) - return ObjectNodeSection.ReadOnlyDataSection; - else - return ObjectNodeSection.DataSection; - } + if (factory.Target.IsWindows) + return ObjectNodeSection.ReadOnlyDataSection; + else + return ObjectNodeSection.DataSection; } public override bool IsShareable => EETypeNode.IsTypeNodeShareable(_preinitializationInfo.Type); diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericCompositionNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericCompositionNode.cs index 0e17ad61b3b..43c2eb78489 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericCompositionNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericCompositionNode.cs @@ -53,15 +53,12 @@ namespace ILCompiler.DependencyAnalysis } } - public override ObjectNodeSection Section + public override ObjectNodeSection GetSection(NodeFactory factory) { - get - { - if (_details.Instantiation[0].Context.Target.IsWindows) - return ObjectNodeSection.FoldableReadOnlyDataSection; - else - return ObjectNodeSection.DataSection; - } + if (factory.Target.IsWindows) + return ObjectNodeSection.FoldableReadOnlyDataSection; + else + return ObjectNodeSection.DataSection; } public override bool IsShareable => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericDictionaryNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericDictionaryNode.cs index efacb005c3b..659b7f4b276 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericDictionaryNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericDictionaryNode.cs @@ -43,7 +43,7 @@ namespace ILCompiler.DependencyAnalysis int ISymbolDefinitionNode.Offset => HeaderSize; - public override ObjectNodeSection Section => GetDictionaryLayout(_factory).DictionarySection(_factory); + public override ObjectNodeSection GetSection(NodeFactory factory) => GetDictionaryLayout(_factory).DictionarySection(_factory); public GenericDictionaryNode(NodeFactory factory) { diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericMethodsHashtableNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericMethodsHashtableNode.cs index c033f44fd12..9e69b3d98d6 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericMethodsHashtableNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericMethodsHashtableNode.cs @@ -32,7 +32,7 @@ namespace ILCompiler.DependencyAnalysis public ISymbolNode EndSymbol => _endSymbol; public int Offset => 0; public override bool IsShareable => false; - public override ObjectNodeSection Section => _externalReferences.Section; + public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory); public override bool StaticDependenciesAreComputed => true; protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericMethodsTemplateMap.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericMethodsTemplateMap.cs index 2c07dc30adf..971c81d1ef8 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericMethodsTemplateMap.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericMethodsTemplateMap.cs @@ -32,7 +32,7 @@ namespace ILCompiler.DependencyAnalysis public ISymbolNode EndSymbol => _endSymbol; public int Offset => 0; public override bool IsShareable => false; - public override ObjectNodeSection Section => _externalReferences.Section; + public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory); public override bool StaticDependenciesAreComputed => true; protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericTypesHashtableNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericTypesHashtableNode.cs index 43a6e027ba0..c1f06e34ef5 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericTypesHashtableNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericTypesHashtableNode.cs @@ -31,7 +31,7 @@ namespace ILCompiler.DependencyAnalysis public ISymbolNode EndSymbol => _endSymbol; public int Offset => 0; public override bool IsShareable => false; - public override ObjectNodeSection Section => _externalReferences.Section; + public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory); public override bool StaticDependenciesAreComputed => true; protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericTypesTemplateMap.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericTypesTemplateMap.cs index f398a8cc519..bb8435ab8c6 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericTypesTemplateMap.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericTypesTemplateMap.cs @@ -32,7 +32,7 @@ namespace ILCompiler.DependencyAnalysis public ISymbolNode EndSymbol => _endSymbol; public int Offset => 0; public override bool IsShareable => false; - public override ObjectNodeSection Section => _externalReferences.Section; + public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory); public override bool StaticDependenciesAreComputed => true; protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericVirtualMethodTableNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericVirtualMethodTableNode.cs index 49844271e81..c1847c5d06f 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericVirtualMethodTableNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericVirtualMethodTableNode.cs @@ -35,7 +35,7 @@ namespace ILCompiler.DependencyAnalysis public ISymbolNode EndSymbol => _endSymbol; public int Offset => 0; public override bool IsShareable => false; - public override ObjectNodeSection Section => _externalReferences.Section; + public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory); public override bool StaticDependenciesAreComputed => true; protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ILScanNodeFactory.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ILScanNodeFactory.cs index 58c570ffe08..c17647d070a 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ILScanNodeFactory.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ILScanNodeFactory.cs @@ -69,7 +69,7 @@ namespace ILCompiler.DependencyAnalysis else { // Otherwise we just unbox 'this' and don't touch anything else. - return new UnboxingStubNode(method, Target); + return new UnboxingStubNode(method); } } diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/InterfaceDispatchMapNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/InterfaceDispatchMapNode.cs index 08fc5523091..ba8df2e1d47 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/InterfaceDispatchMapNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/InterfaceDispatchMapNode.cs @@ -39,15 +39,12 @@ namespace ILCompiler.DependencyAnalysis public override bool StaticDependenciesAreComputed => true; - public override ObjectNodeSection Section + public override ObjectNodeSection GetSection(NodeFactory factory) { - get - { - if (_type.Context.Target.IsWindows) - return ObjectNodeSection.FoldableReadOnlyDataSection; - else - return ObjectNodeSection.DataSection; - } + if (factory.Target.IsWindows) + return ObjectNodeSection.FoldableReadOnlyDataSection; + else + return ObjectNodeSection.DataSection; } protected override DependencyList ComputeNonRelocationBasedDependencies(NodeFactory factory) diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/InterfaceGenericVirtualMethodTableNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/InterfaceGenericVirtualMethodTableNode.cs index a337a1c03e5..b5855ce04e4 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/InterfaceGenericVirtualMethodTableNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/InterfaceGenericVirtualMethodTableNode.cs @@ -37,7 +37,7 @@ namespace ILCompiler.DependencyAnalysis public ISymbolNode EndSymbol => _endSymbol; public int Offset => 0; public override bool IsShareable => false; - public override ObjectNodeSection Section => _externalReferences.Section; + public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory); public override bool StaticDependenciesAreComputed => true; protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/MetadataNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/MetadataNode.cs index 1ffe42a8a1c..d17ecfb8126 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/MetadataNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/MetadataNode.cs @@ -29,7 +29,7 @@ namespace ILCompiler.DependencyAnalysis public int Offset => 0; public override bool IsShareable => false; - public override ObjectNodeSection Section => ObjectNodeSection.ReadOnlyDataSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.ReadOnlyDataSection; public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/MethodAssociatedDataNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/MethodAssociatedDataNode.cs index 8cd6b03b563..3f4562ce70e 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/MethodAssociatedDataNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/MethodAssociatedDataNode.cs @@ -34,7 +34,7 @@ namespace ILCompiler.DependencyAnalysis protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); - public override ObjectNodeSection Section => ObjectNodeSection.ReadOnlyDataSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.ReadOnlyDataSection; public override bool StaticDependenciesAreComputed => true; public int Offset => 0; public override bool IsShareable => _methodNode.Method is InstantiatedMethod || EETypeNode.IsTypeNodeShareable(_methodNode.Method.OwningType); diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/MethodExceptionHandlingInfoNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/MethodExceptionHandlingInfoNode.cs index 5d76d571e37..1b1bd06d72d 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/MethodExceptionHandlingInfoNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/MethodExceptionHandlingInfoNode.cs @@ -22,7 +22,7 @@ namespace ILCompiler.DependencyAnalysis _data = new ObjectData(data.Data, data.Relocs, data.Alignment, new ISymbolDefinitionNode[] { this }); } - public override ObjectNodeSection Section => _owningMethod.Context.Target.IsWindows + public override ObjectNodeSection GetSection(NodeFactory factory) => _owningMethod.Context.Target.IsWindows ? ObjectNodeSection.FoldableReadOnlyDataSection : ObjectNodeSection.DataSection; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ModuleInitializerListNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ModuleInitializerListNode.cs index 034e173083e..a328dc03ee7 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ModuleInitializerListNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ModuleInitializerListNode.cs @@ -30,7 +30,7 @@ namespace ILCompiler.DependencyAnalysis public override bool IsShareable => false; - public override ObjectNodeSection Section => ObjectNodeSection.DataSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.DataSection; public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ModulesSectionNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ModulesSectionNode.cs index cd7728bd36e..3474a605823 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ModulesSectionNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ModulesSectionNode.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using Internal.Text; -using Internal.TypeSystem; namespace ILCompiler.DependencyAnalysis { @@ -13,21 +12,11 @@ namespace ILCompiler.DependencyAnalysis // in the final binary. This list is created via a special .modules section that // contains list of pointers to all module headers. - private TargetDetails _target; - - public ModulesSectionNode(TargetDetails target) - { - _target = target; - } - - public override ObjectNodeSection Section + public override ObjectNodeSection GetSection(NodeFactory factory) { - get - { - return _target.IsWindows ? - ObjectNodeSection.ModulesWindowsContentSection : - ObjectNodeSection.ModulesUnixContentSection; - } + return factory.Target.IsWindows ? + ObjectNodeSection.ModulesWindowsContentSection : + ObjectNodeSection.ModulesUnixContentSection; } protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NativeLayoutInfoNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NativeLayoutInfoNode.cs index 03a231ec518..e9bc60848da 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NativeLayoutInfoNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NativeLayoutInfoNode.cs @@ -48,7 +48,7 @@ namespace ILCompiler.DependencyAnalysis public ISymbolNode EndSymbol => _endSymbol; public int Offset => 0; public override bool IsShareable => false; - public override ObjectNodeSection Section => _externalReferences.Section; + public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory); public override bool StaticDependenciesAreComputed => true; protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NativeLayoutSignatureNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NativeLayoutSignatureNode.cs index 1556406c6f9..322b84207d4 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NativeLayoutSignatureNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NativeLayoutSignatureNode.cs @@ -55,15 +55,12 @@ namespace ILCompiler.DependencyAnalysis public int Offset => 0; protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); - public override ObjectNodeSection Section + public override ObjectNodeSection GetSection(NodeFactory factory) { - get - { - if (_identity.Context.Target.IsWindows) - return ObjectNodeSection.ReadOnlyDataSection; - else - return ObjectNodeSection.DataSection; - } + if (factory.Target.IsWindows) + return ObjectNodeSection.ReadOnlyDataSection; + else + return ObjectNodeSection.DataSection; } public override bool IsShareable => false; public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NodeFactory.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NodeFactory.cs index c5e5aef1e44..efd7f86102b 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NodeFactory.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NodeFactory.cs @@ -1139,10 +1139,10 @@ namespace ILCompiler.DependencyAnalysis public virtual void AttachToDependencyGraph(DependencyAnalyzerBase<NodeFactory> graph) { - ReadyToRunHeader = new ReadyToRunHeaderNode(Target); + ReadyToRunHeader = new ReadyToRunHeaderNode(); graph.AddRoot(ReadyToRunHeader, "ReadyToRunHeader is always generated"); - graph.AddRoot(new ModulesSectionNode(Target), "ModulesSection is always generated"); + graph.AddRoot(new ModulesSectionNode(), "ModulesSection is always generated"); graph.AddRoot(GCStaticsRegion, "GC StaticsRegion is always generated"); graph.AddRoot(ThreadStaticsRegion, "ThreadStaticsRegion is always generated"); diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NonGCStaticsNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NonGCStaticsNode.cs index 99b3e8da8ec..fef79f3bb9b 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NonGCStaticsNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NonGCStaticsNode.cs @@ -31,21 +31,18 @@ namespace ILCompiler.DependencyAnalysis protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); - public override ObjectNodeSection Section + public override ObjectNodeSection GetSection(NodeFactory factory) { - get + if (_preinitializationManager.HasLazyStaticConstructor(_type) + || _preinitializationManager.IsPreinitialized(_type)) { - if (_preinitializationManager.HasLazyStaticConstructor(_type) - || _preinitializationManager.IsPreinitialized(_type)) - { - // We have data to be emitted so this needs to be in an initialized data section - return ObjectNodeSection.DataSection; - } - else - { - // This is all zeros; place this to the BSS section - return ObjectNodeSection.BssSection; - } + // We have data to be emitted so this needs to be in an initialized data section + return ObjectNodeSection.DataSection; + } + else + { + // This is all zeros; place this to the BSS section + return ObjectNodeSection.BssSection; } } diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs index f2d00e92432..b984cda1438 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs @@ -894,7 +894,7 @@ namespace ILCompiler.DependencyAnalysis private bool ShouldShareSymbol(ObjectNode node) { // Foldable sections are always COMDATs - ObjectNodeSection section = node.Section; + ObjectNodeSection section = node.GetSection(_nodeFactory); if (section == ObjectNodeSection.FoldableManagedCodeUnixContentSection || section == ObjectNodeSection.FoldableManagedCodeWindowsContentSection || section == ObjectNodeSection.FoldableReadOnlyDataSection) @@ -1006,7 +1006,7 @@ namespace ILCompiler.DependencyAnalysis #endif - ObjectNodeSection section = node.Section; + ObjectNodeSection section = node.GetSection(factory); if (objectWriter.ShouldShareSymbol(node)) { section = GetSharedSection(section, ((ISymbolNode)node).GetMangledName(factory.NameMangler)); diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/PInvokeMethodFixupNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/PInvokeMethodFixupNode.cs index 85b8b546517..153f83ae080 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/PInvokeMethodFixupNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/PInvokeMethodFixupNode.cs @@ -33,7 +33,7 @@ namespace ILCompiler.DependencyAnalysis protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); - public override ObjectNodeSection Section => ObjectNodeSection.DataSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.DataSection; public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/PInvokeModuleFixupNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/PInvokeModuleFixupNode.cs index d027f3e5990..d696e0075b3 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/PInvokeModuleFixupNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/PInvokeModuleFixupNode.cs @@ -34,7 +34,7 @@ namespace ILCompiler.DependencyAnalysis protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); - public override ObjectNodeSection Section => ObjectNodeSection.DataSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.DataSection; public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReadyToRunHeaderNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReadyToRunHeaderNode.cs index 243ff6c4769..199b5a1e342 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReadyToRunHeaderNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReadyToRunHeaderNode.cs @@ -28,12 +28,6 @@ namespace ILCompiler.DependencyAnalysis } private List<HeaderItem> _items = new List<HeaderItem>(); - private TargetDetails _target; - - public ReadyToRunHeaderNode(TargetDetails target) - { - _target = target; - } public void Add(ReadyToRunSectionType id, ObjectNode node, ISymbolNode startSymbol, ISymbolNode endSymbol = null) { @@ -52,15 +46,12 @@ namespace ILCompiler.DependencyAnalysis public override bool StaticDependenciesAreComputed => true; - public override ObjectNodeSection Section + public override ObjectNodeSection GetSection(NodeFactory factory) { - get - { - if (_target.IsWindows) - return ObjectNodeSection.ReadOnlyDataSection; - else - return ObjectNodeSection.DataSection; - } + if (factory.Target.IsWindows) + return ObjectNodeSection.ReadOnlyDataSection; + else + return ObjectNodeSection.DataSection; } public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false) diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionFieldMapNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionFieldMapNode.cs index f1962ed6b3c..ec2c6ed59d1 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionFieldMapNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionFieldMapNode.cs @@ -35,7 +35,7 @@ namespace ILCompiler.DependencyAnalysis public int Offset => 0; public override bool IsShareable => false; - public override ObjectNodeSection Section => _externalReferences.Section; + public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory); public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionInvokeMapNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionInvokeMapNode.cs index b8ef007f100..d0c340a7f98 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionInvokeMapNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionInvokeMapNode.cs @@ -41,7 +41,7 @@ namespace ILCompiler.DependencyAnalysis public int Offset => 0; public override bool IsShareable => false; - public override ObjectNodeSection Section => _externalReferences.Section; + public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory); public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionVirtualInvokeMapNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionVirtualInvokeMapNode.cs index dd18d08293d..e28f18387bf 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionVirtualInvokeMapNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionVirtualInvokeMapNode.cs @@ -36,7 +36,7 @@ namespace ILCompiler.DependencyAnalysis public ISymbolNode EndSymbol => _endSymbol; public int Offset => 0; public override bool IsShareable => false; - public override ObjectNodeSection Section => _externalReferences.Section; + public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory); public override bool StaticDependenciesAreComputed => true; protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ResourceDataNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ResourceDataNode.cs index 99165d639d0..19fe3250804 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ResourceDataNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ResourceDataNode.cs @@ -36,7 +36,7 @@ namespace ILCompiler.DependencyAnalysis public override bool IsShareable => false; - public override ObjectNodeSection Section => ObjectNodeSection.ReadOnlyDataSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.ReadOnlyDataSection; public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ResourceIndexNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ResourceIndexNode.cs index ffd0b98be60..21504fd1e0e 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ResourceIndexNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ResourceIndexNode.cs @@ -27,7 +27,7 @@ namespace ILCompiler.DependencyAnalysis public override bool IsShareable => false; - public override ObjectNodeSection Section => ObjectNodeSection.ReadOnlyDataSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.ReadOnlyDataSection; public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/RuntimeFieldHandleNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/RuntimeFieldHandleNode.cs index 1f4aae6eaa5..c7823bae87f 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/RuntimeFieldHandleNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/RuntimeFieldHandleNode.cs @@ -30,15 +30,12 @@ namespace ILCompiler.DependencyAnalysis public override bool IsShareable => false; public override bool StaticDependenciesAreComputed => true; - public override ObjectNodeSection Section + public override ObjectNodeSection GetSection(NodeFactory factory) { - get - { - if (_targetField.Context.Target.IsWindows) - return ObjectNodeSection.ReadOnlyDataSection; - else - return ObjectNodeSection.DataSection; - } + if (factory.Target.IsWindows) + return ObjectNodeSection.ReadOnlyDataSection; + else + return ObjectNodeSection.DataSection; } private static Utf8String s_NativeLayoutSignaturePrefix = new Utf8String("__RFHSignature_"); diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/RuntimeMethodHandleNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/RuntimeMethodHandleNode.cs index 673ee8c1681..4cbd7b21996 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/RuntimeMethodHandleNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/RuntimeMethodHandleNode.cs @@ -36,15 +36,12 @@ namespace ILCompiler.DependencyAnalysis public override bool IsShareable => false; public override bool StaticDependenciesAreComputed => true; - public override ObjectNodeSection Section + public override ObjectNodeSection GetSection(NodeFactory factory) { - get - { - if (_targetMethod.Context.Target.IsWindows) - return ObjectNodeSection.ReadOnlyDataSection; - else - return ObjectNodeSection.DataSection; - } + if (factory.Target.IsWindows) + return ObjectNodeSection.ReadOnlyDataSection; + else + return ObjectNodeSection.DataSection; } protected override DependencyList ComputeNonRelocationBasedDependencies(NodeFactory factory) diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/SealedVTableNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/SealedVTableNode.cs index bb04c7e0aca..7e13fa0522f 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/SealedVTableNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/SealedVTableNode.cs @@ -28,7 +28,7 @@ namespace ILCompiler.DependencyAnalysis protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); - public override ObjectNodeSection Section => _type.Context.Target.IsWindows ? ObjectNodeSection.FoldableReadOnlyDataSection : ObjectNodeSection.DataSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => _type.Context.Target.IsWindows ? ObjectNodeSection.FoldableReadOnlyDataSection : ObjectNodeSection.DataSection; public virtual void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/StackTraceMethodMappingNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/StackTraceMethodMappingNode.cs index 71be4ee7c4f..9a277122333 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/StackTraceMethodMappingNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/StackTraceMethodMappingNode.cs @@ -22,7 +22,7 @@ namespace ILCompiler.DependencyAnalysis public override bool IsShareable => false; - public override ObjectNodeSection Section => ObjectNodeSection.ReadOnlyDataSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.ReadOnlyDataSection; public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/StaticsInfoHashtableNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/StaticsInfoHashtableNode.cs index 306e5c225c8..5f68ef8850d 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/StaticsInfoHashtableNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/StaticsInfoHashtableNode.cs @@ -34,7 +34,7 @@ namespace ILCompiler.DependencyAnalysis public int Offset => 0; public override bool IsShareable => false; - public override ObjectNodeSection Section => _externalReferences.Section; + public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory); public override bool StaticDependenciesAreComputed => true; protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/StructMarshallingStubMapNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/StructMarshallingStubMapNode.cs index dfd92dd9340..c2f5ddf791b 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/StructMarshallingStubMapNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/StructMarshallingStubMapNode.cs @@ -36,7 +36,7 @@ namespace ILCompiler.DependencyAnalysis public int Offset => 0; public override bool IsShareable => false; - public override ObjectNodeSection Section => _externalReferences.Section; + public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory); public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/TypeManagerIndirectionNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/TypeManagerIndirectionNode.cs index 9d1c3c37df3..5aac937956b 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/TypeManagerIndirectionNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/TypeManagerIndirectionNode.cs @@ -16,7 +16,7 @@ namespace ILCompiler.DependencyAnalysis protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); - public override ObjectNodeSection Section => ObjectNodeSection.DataSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.DataSection; public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/TypeMetadataMapNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/TypeMetadataMapNode.cs index f0132ece3af..2c638a08bbd 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/TypeMetadataMapNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/TypeMetadataMapNode.cs @@ -31,7 +31,7 @@ namespace ILCompiler.DependencyAnalysis public int Offset => 0; public override bool IsShareable => false; - public override ObjectNodeSection Section => _externalReferences.Section; + public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory); public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/TypeThreadStaticIndexNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/TypeThreadStaticIndexNode.cs index d8b65d2a345..799a10a0786 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/TypeThreadStaticIndexNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/TypeThreadStaticIndexNode.cs @@ -24,15 +24,12 @@ namespace ILCompiler.DependencyAnalysis } public int Offset => 0; protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); - public override ObjectNodeSection Section + public override ObjectNodeSection GetSection(NodeFactory factory) { - get - { - if (_type.Context.Target.IsWindows) - return ObjectNodeSection.ReadOnlyDataSection; - else - return ObjectNodeSection.DataSection; - } + if (factory.Target.IsWindows) + return ObjectNodeSection.ReadOnlyDataSection; + else + return ObjectNodeSection.DataSection; } public override bool IsShareable => true; public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/UnboxingStubNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/UnboxingStubNode.cs index 31265ae6e90..94808445795 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/UnboxingStubNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/UnboxingStubNode.cs @@ -13,27 +13,21 @@ namespace ILCompiler.DependencyAnalysis /// </summary> public partial class UnboxingStubNode : AssemblyStubNode, IMethodNode, ISymbolDefinitionNode { - private readonly TargetDetails _targetDetails; - public MethodDesc Method { get; } - public override ObjectNodeSection Section + public override ObjectNodeSection GetSection(NodeFactory factory) { - get - { - return _targetDetails.IsWindows ? - ObjectNodeSection.UnboxingStubWindowsContentSection : - ObjectNodeSection.UnboxingStubUnixContentSection; - } + return factory.Target.IsWindows ? + ObjectNodeSection.UnboxingStubWindowsContentSection : + ObjectNodeSection.UnboxingStubUnixContentSection; } public override bool IsShareable => true; - public UnboxingStubNode(MethodDesc target, TargetDetails targetDetails) + public UnboxingStubNode(MethodDesc target) { Debug.Assert(target.GetCanonMethodTarget(CanonicalFormKind.Specific) == target); Debug.Assert(target.OwningType.IsValueType); Method = target; - _targetDetails = targetDetails; } private ISymbolNode GetUnderlyingMethodEntrypoint(NodeFactory factory) diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/CodeGen/ReadyToRunObjectWriter.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/CodeGen/ReadyToRunObjectWriter.cs index d2a36b372cd..623098ab418 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/CodeGen/ReadyToRunObjectWriter.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/CodeGen/ReadyToRunObjectWriter.cs @@ -293,7 +293,7 @@ namespace ILCompiler.DependencyAnalysis string name = GetDependencyNodeName(depNode); - EmitObjectData(r2rPeBuilder, nodeContents, nodeIndex, name, node.Section); + EmitObjectData(r2rPeBuilder, nodeContents, nodeIndex, name, node.GetSection(_nodeFactory)); lastWrittenObjectNode = node; if (_outputInfoBuilder != null && node is MethodWithGCInfo methodNode) @@ -315,7 +315,7 @@ namespace ILCompiler.DependencyAnalysis ObjectData nodeContents = node.GetData(_nodeFactory); string name = GetDependencyNodeName(node); - EmitObjectData(r2rPeBuilder, nodeContents, nodeIndex, name, node.Section); + EmitObjectData(r2rPeBuilder, nodeContents, nodeIndex, name, node.GetSection(_nodeFactory)); } r2rPeBuilder.SetCorHeader(_nodeFactory.CopiedCorHeaderNode, _nodeFactory.CopiedCorHeaderNode.Size); diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ArrayOfEmbeddedDataNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ArrayOfEmbeddedDataNode.cs index fba4e050617..36c558a19f5 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ArrayOfEmbeddedDataNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ArrayOfEmbeddedDataNode.cs @@ -46,7 +46,7 @@ namespace ILCompiler.DependencyAnalysis protected override string GetName(NodeFactory factory) => $"Region {StartSymbol.GetMangledName(factory.NameMangler)}"; - public override ObjectNodeSection Section => ObjectNodeSection.DataSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.DataSection; public override bool IsShareable => false; public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/AssemblyTableNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/AssemblyTableNode.cs index 8a7e5770f78..97ec944b50c 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/AssemblyTableNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/AssemblyTableNode.cs @@ -20,8 +20,7 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun { private readonly List<AssemblyHeaderNode> _assemblyHeaders; - public AssemblyTableNode(TargetDetails target) - : base(target) + public AssemblyTableNode() { _assemblyHeaders = new List<AssemblyHeaderNode>(); } diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/AttributePresenceFilterNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/AttributePresenceFilterNode.cs index 80cb25078dc..a634c584eae 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/AttributePresenceFilterNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/AttributePresenceFilterNode.cs @@ -21,7 +21,6 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun public override int ClassCode => 56456113; public AttributePresenceFilterNode(EcmaModule module) - : base(module.Context.Target) { _module = module; } diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CompilerIdentifierNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CompilerIdentifierNode.cs index 7fcd2febf1a..e2d74b71a29 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CompilerIdentifierNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CompilerIdentifierNode.cs @@ -10,12 +10,11 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun { internal class CompilerIdentifierNode : HeaderTableNode { - public override ObjectNodeSection Section => ObjectNodeSection.ReadOnlyDataSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.ReadOnlyDataSection; public override int ClassCode => 230053202; public CompilerIdentifierNode(TargetDetails target) - : base(target) { } diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedCorHeaderNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedCorHeaderNode.cs index dc69bfdc3e7..853d8728df0 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedCorHeaderNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedCorHeaderNode.cs @@ -22,7 +22,7 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun _module = sourceModule; } - public override ObjectNodeSection Section => ObjectNodeSection.TextSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.TextSection; public override bool IsShareable => false; diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedFieldRvaNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedFieldRvaNode.cs index a8ff518ac75..e73c3216495 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedFieldRvaNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedFieldRvaNode.cs @@ -24,7 +24,7 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun _module = module; } - public override ObjectNodeSection Section => ObjectNodeSection.TextSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.TextSection; public override bool IsShareable => false; diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedManagedResourcesNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedManagedResourcesNode.cs index 6a292c40750..408904cdd16 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedManagedResourcesNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedManagedResourcesNode.cs @@ -18,7 +18,7 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun _module = module; } - public override ObjectNodeSection Section => ObjectNodeSection.TextSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.TextSection; public override bool IsShareable => false; diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedMetadataBlobNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedMetadataBlobNode.cs index b38dbfba67b..119f6b2e6e9 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedMetadataBlobNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedMetadataBlobNode.cs @@ -25,7 +25,7 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun _sourceModule = sourceModule; } - public override ObjectNodeSection Section => ObjectNodeSection.TextSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.TextSection; public override bool IsShareable => false; diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedMethodILNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedMethodILNode.cs index 2ff052a4a72..b0bad75e052 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedMethodILNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedMethodILNode.cs @@ -22,7 +22,7 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun _method = (EcmaMethod)method.GetTypicalMethodDefinition(); } - public override ObjectNodeSection Section => ObjectNodeSection.TextSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.TextSection; public override bool IsShareable => false; diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedStrongNameSignatureNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedStrongNameSignatureNode.cs index d46f742a372..fea66066ad2 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedStrongNameSignatureNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedStrongNameSignatureNode.cs @@ -21,7 +21,7 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun _module = module; } - public override ObjectNodeSection Section => ObjectNodeSection.TextSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.TextSection; public override bool IsShareable => false; diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DebugDirectoryEntryNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DebugDirectoryEntryNode.cs index 0fe61e694e8..e665d3c0cc7 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DebugDirectoryEntryNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DebugDirectoryEntryNode.cs @@ -24,7 +24,7 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun _module = module; } - public override ObjectNodeSection Section => ObjectNodeSection.TextSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.TextSection; public override bool IsShareable => false; diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DebugDirectoryNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DebugDirectoryNode.cs index fae4a53dde9..d903db2524c 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DebugDirectoryNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DebugDirectoryNode.cs @@ -52,7 +52,7 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun } } - public override ObjectNodeSection Section => ObjectNodeSection.TextSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.TextSection; public override bool IsShareable => false; diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DebugInfoTableNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DebugInfoTableNode.cs index cedf2ef5ee8..58b1f9adc8a 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DebugInfoTableNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DebugInfoTableNode.cs @@ -61,8 +61,6 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun /// </summary> public class DebugInfoTableNode : HeaderTableNode { - public DebugInfoTableNode(TargetDetails target) : base(target) { } - public override int ClassCode => 1000735112; public override void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ExceptionInfoLookupTableNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ExceptionInfoLookupTableNode.cs index 4fa4e5e0297..899a9f1357a 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ExceptionInfoLookupTableNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ExceptionInfoLookupTableNode.cs @@ -14,7 +14,7 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun { public class EHInfoNode : ObjectNode, ISymbolDefinitionNode { - public override ObjectNodeSection Section => ObjectNodeSection.ReadOnlyDataSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.ReadOnlyDataSection; public override bool IsShareable => false; @@ -69,7 +69,6 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun private readonly EHInfoNode _ehInfoNode; public ExceptionInfoLookupTableNode(NodeFactory nodeFactory) - : base(nodeFactory.Target) { _nodeFactory = nodeFactory; _ehInfoNode = new EHInfoNode(); diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/GCRefMapNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/GCRefMapNode.cs index a9a414ac1e8..fbf41d54ca8 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/GCRefMapNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/GCRefMapNode.cs @@ -24,7 +24,7 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun _methods = new List<IMethodNode>(); } - public override ObjectNodeSection Section => ObjectNodeSection.ReadOnlyDataSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.ReadOnlyDataSection; public override bool IsShareable => false; diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/HeaderNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/HeaderNode.cs index 72102d606ad..7c57adaaa02 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/HeaderNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/HeaderNode.cs @@ -14,13 +14,6 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun { public abstract class HeaderTableNode : ObjectNode, ISymbolDefinitionNode { - public TargetDetails Target { get; private set; } - - public HeaderTableNode(TargetDetails target) - { - Target = target; - } - public abstract void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb); public int Offset => 0; @@ -31,15 +24,12 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun public override bool StaticDependenciesAreComputed => true; - public override ObjectNodeSection Section + public override ObjectNodeSection GetSection(NodeFactory factory) { - get - { - if (Target.IsWindows) - return ObjectNodeSection.ReadOnlyDataSection; - else - return ObjectNodeSection.DataSection; - } + if (factory.Target.IsWindows) + return ObjectNodeSection.ReadOnlyDataSection; + else + return ObjectNodeSection.DataSection; } } @@ -60,12 +50,10 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun } private readonly List<HeaderItem> _items = new List<HeaderItem>(); - private readonly TargetDetails _target; private readonly ReadyToRunFlags _flags; - public HeaderNode(TargetDetails target, ReadyToRunFlags flags) + public HeaderNode(ReadyToRunFlags flags) { - _target = target; _flags = flags; } @@ -85,15 +73,12 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun public override bool StaticDependenciesAreComputed => true; - public override ObjectNodeSection Section + public override ObjectNodeSection GetSection(NodeFactory factory) { - get - { - if (_target.IsWindows) - return ObjectNodeSection.ReadOnlyDataSection; - else - return ObjectNodeSection.DataSection; - } + if (factory.Target.IsWindows) + return ObjectNodeSection.ReadOnlyDataSection; + else + return ObjectNodeSection.DataSection; } public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false) @@ -152,8 +137,8 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun public class GlobalHeaderNode : HeaderNode { - public GlobalHeaderNode(TargetDetails target, ReadyToRunFlags flags) - : base(target, flags) + public GlobalHeaderNode(ReadyToRunFlags flags) + : base(flags) { } @@ -180,8 +165,8 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun { private readonly int _index; - public AssemblyHeaderNode(TargetDetails target, ReadyToRunFlags flags, int index) - : base(target, flags) + public AssemblyHeaderNode(ReadyToRunFlags flags, int index) + : base(flags) { _index = index; } diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/HotColdMapNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/HotColdMapNode.cs index 0ce9d17d6c1..18f0177e4b9 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/HotColdMapNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/HotColdMapNode.cs @@ -12,11 +12,6 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun { private uint[] _mapping; - public HotColdMapNode(NodeFactory nodeFactory) - : base(nodeFactory.Target) - { - } - public uint[] Mapping { get => _mapping; diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/InliningInfoNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/InliningInfoNode.cs index da6242013b5..0d4438e0476 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/InliningInfoNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/InliningInfoNode.cs @@ -31,8 +31,7 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun private readonly InfoType _inlineInfoType; private ReadyToRunSymbolNodeFactory _symbolNodeFactory; - public InliningInfoNode(TargetDetails target, EcmaModule module, InfoType inlineInfoType) - : base(target) + public InliningInfoNode(EcmaModule module, InfoType inlineInfoType) { _inlineInfoType = inlineInfoType; if (AllowCrossModuleInlines) diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/InstanceEntryPointTableNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/InstanceEntryPointTableNode.cs index 0ffe9f9b15a..99fd74b930e 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/InstanceEntryPointTableNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/InstanceEntryPointTableNode.cs @@ -23,7 +23,6 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun private bool _materializedSignature; public InstanceEntryPointTableNode(NodeFactory factory) - : base(factory.Target) { _factory = factory; _factory.ManifestMetadataTable.RegisterEmitter(this); diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/InstrumentationDataTableNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/InstrumentationDataTableNode.cs index dfa5497c6fb..8ca1fc21747 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/InstrumentationDataTableNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/InstrumentationDataTableNode.cs @@ -26,7 +26,6 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun private readonly ProfileDataManager _profileDataManager; public InstrumentationDataTableNode(NodeFactory factory, MethodDesc[] instrumentationDataMethods, ProfileDataManager profileDataManager) - : base(factory.Target) { _factory = factory; _instrumentationDataMethods = instrumentationDataMethods; diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ManifestAssemblyMvidHeaderNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ManifestAssemblyMvidHeaderNode.cs index b038b39a3e8..02a60b28c0d 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ManifestAssemblyMvidHeaderNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ManifestAssemblyMvidHeaderNode.cs @@ -21,7 +21,7 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun _manifestNode = manifestNode; } - public override ObjectNodeSection Section => ObjectNodeSection.TextSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.TextSection; public override bool IsShareable => false; diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ManifestMetadataTableNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ManifestMetadataTableNode.cs index 2691369badd..0571b6922ac 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ManifestMetadataTableNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ManifestMetadataTableNode.cs @@ -82,7 +82,6 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun public readonly MutableModule _mutableModule; public ManifestMetadataTableNode(NodeFactory nodeFactory) - : base(nodeFactory.Target) { _assemblyRefToModuleIdMap = new Dictionary<string, int>(); _moduleIdToAssemblyNameMap = new Dictionary<int, AssemblyName>(); diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/MethodColdCodeNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/MethodColdCodeNode.cs index ca400ed01d2..5e8bffc5e6e 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/MethodColdCodeNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/MethodColdCodeNode.cs @@ -20,13 +20,9 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun public int Offset => 0; - public override ObjectNodeSection Section + public override ObjectNodeSection GetSection(NodeFactory factory) { - get - { - return _owningMethod.Context.Target.IsWindows ? ObjectNodeSection.ManagedCodeWindowsContentSection : ObjectNodeSection.ManagedCodeUnixContentSection; - - } + return factory.Target.IsWindows ? ObjectNodeSection.ManagedCodeWindowsContentSection : ObjectNodeSection.ManagedCodeUnixContentSection; } public override bool IsShareable => false; diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/MethodEntryPointTableNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/MethodEntryPointTableNode.cs index e11e41c0a6a..4aac38bec9f 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/MethodEntryPointTableNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/MethodEntryPointTableNode.cs @@ -35,8 +35,7 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun } } - public MethodEntryPointTableNode(EcmaModule module, TargetDetails target) - : base(target) + public MethodEntryPointTableNode(EcmaModule module) { _module = module; } diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/MethodWithGCInfo.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/MethodWithGCInfo.cs index 138ae902cac..cd71b9a0076 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/MethodWithGCInfo.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/MethodWithGCInfo.cs @@ -293,12 +293,9 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun public override int ClassCode => 315213488; - public override ObjectNodeSection Section + public override ObjectNodeSection GetSection(NodeFactory factory) { - get - { - return _method.Context.Target.IsWindows ? ObjectNodeSection.ManagedCodeWindowsContentSection : ObjectNodeSection.ManagedCodeUnixContentSection; - } + return factory.Target.IsWindows ? ObjectNodeSection.ManagedCodeWindowsContentSection : ObjectNodeSection.ManagedCodeUnixContentSection; } public FrameInfo[] FrameInfos => _frameInfos; diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/OwnerCompositeExecutableNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/OwnerCompositeExecutableNode.cs index a9161481f1c..cdcd81f0fdd 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/OwnerCompositeExecutableNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/OwnerCompositeExecutableNode.cs @@ -16,14 +16,13 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun /// </summary> internal class OwnerCompositeExecutableNode : HeaderTableNode { - public override ObjectNodeSection Section => ObjectNodeSection.ReadOnlyDataSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.ReadOnlyDataSection; public override int ClassCode => 240420333; private readonly string _ownerExecutableName; - public OwnerCompositeExecutableNode(TargetDetails target, string ownerExecutableName) - : base(target) + public OwnerCompositeExecutableNode(string ownerExecutableName) { _ownerExecutableName = ownerExecutableName; } diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/RuntimeFunctionsGCInfoNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/RuntimeFunctionsGCInfoNode.cs index e6c437efc04..8d69be7c2d0 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/RuntimeFunctionsGCInfoNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/RuntimeFunctionsGCInfoNode.cs @@ -16,7 +16,7 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun public override int ClassCode => 316678892; - public override ObjectNodeSection Section => ObjectNodeSection.ReadOnlyDataSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.ReadOnlyDataSection; public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/RuntimeFunctionsTableNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/RuntimeFunctionsTableNode.cs index b9a06153ae7..941f671c4d9 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/RuntimeFunctionsTableNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/RuntimeFunctionsTableNode.cs @@ -19,7 +19,6 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun private int _tableSize = -1; public RuntimeFunctionsTableNode(NodeFactory nodeFactory) - : base(nodeFactory.Target) { _nodeFactory = nodeFactory; } @@ -120,8 +119,8 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun symbol = method; } - runtimeFunctionsBuilder.EmitReloc(symbol, RelocType.IMAGE_REL_BASED_ADDR32NB, delta: frameInfo.StartOffset + Target.CodeDelta); - if (!relocsOnly && Target.Architecture == TargetArchitecture.X64) + runtimeFunctionsBuilder.EmitReloc(symbol, RelocType.IMAGE_REL_BASED_ADDR32NB, delta: frameInfo.StartOffset + _nodeFactory.Target.CodeDelta); + if (!relocsOnly && _nodeFactory.Target.Architecture == TargetArchitecture.X64) { // On Amd64, the 2nd word contains the EndOffset of the runtime function Debug.Assert(frameInfo.StartOffset != frameInfo.EndOffset); diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/Signature.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/Signature.cs index 19480449845..a370d4900f3 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/Signature.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/Signature.cs @@ -7,7 +7,7 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun { public abstract class Signature : ObjectNode, ISymbolDefinitionNode, ISortableSymbolNode { - public override ObjectNodeSection Section => ObjectNodeSection.DataSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.DataSection; public override bool IsShareable => true; public override bool StaticDependenciesAreComputed => true; diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/TypesTableNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/TypesTableNode.cs index 03a9a148914..715b9bb1743 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/TypesTableNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/TypesTableNode.cs @@ -19,8 +19,7 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun { private readonly EcmaModule _module; - public TypesTableNode(TargetDetails target, EcmaModule module) - : base(target) + public TypesTableNode(EcmaModule module) { _module = module; } diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/Win32ResourcesNode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/Win32ResourcesNode.cs index ac8a53e0268..c5769b515a6 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/Win32ResourcesNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/Win32ResourcesNode.cs @@ -19,7 +19,7 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun _size = -1; } - public override ObjectNodeSection Section => ObjectNodeSection.TextSection; + public override ObjectNodeSection GetSection(NodeFactory factory) => ObjectNodeSection.TextSection; public override bool IsShareable => false; diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRunCodegenNodeFactory.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRunCodegenNodeFactory.cs index 8c9d3e5c416..ca32b271840 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRunCodegenNodeFactory.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRunCodegenNodeFactory.cs @@ -81,7 +81,7 @@ namespace ILCompiler.DependencyAnalysis { if (HotColdMap == null) { - HotColdMap = new HotColdMapNode(this); + HotColdMap = new HotColdMapNode(); Header.Add(Internal.Runtime.ReadyToRunSectionType.HotColdMap, HotColdMap, HotColdMap); dependencyGraph.AddRoot(HotColdMap, "HotColdMap is generated because there is cold code"); } @@ -198,7 +198,7 @@ namespace ILCompiler.DependencyAnalysis CopiedCorHeaderNode = corHeaderNode; DebugDirectoryNode = debugDirectoryNode; Resolver = compilationModuleGroup.Resolver; - Header = new GlobalHeaderNode(Target, flags); + Header = new GlobalHeaderNode(flags); ImageBase = imageBase; if (!win32Resources.IsEmpty) Win32ResourcesNode = new Win32ResourcesNode(win32Resources); @@ -693,7 +693,7 @@ namespace ILCompiler.DependencyAnalysis if (CompilationModuleGroup.IsCompositeBuildMode) { - assemblyTable = new AssemblyTableNode(Target); + assemblyTable = new AssemblyTableNode(); Header.Add(Internal.Runtime.ReadyToRunSectionType.ComponentAssemblies, assemblyTable, assemblyTable); } @@ -705,20 +705,20 @@ namespace ILCompiler.DependencyAnalysis HeaderNode tableHeader = Header; if (assemblyTable != null) { - AssemblyHeaderNode perAssemblyHeader = new AssemblyHeaderNode(Target, ReadyToRunFlags.READYTORUN_FLAG_Component, assemblyIndex); + AssemblyHeaderNode perAssemblyHeader = new AssemblyHeaderNode(ReadyToRunFlags.READYTORUN_FLAG_Component, assemblyIndex); assemblyTable.Add(perAssemblyHeader); tableHeader = perAssemblyHeader; } - MethodEntryPointTableNode methodEntryPointTable = new MethodEntryPointTableNode(inputModule, Target); + MethodEntryPointTableNode methodEntryPointTable = new MethodEntryPointTableNode(inputModule); tableHeader.Add(Internal.Runtime.ReadyToRunSectionType.MethodDefEntryPoints, methodEntryPointTable, methodEntryPointTable); - TypesTableNode typesTable = new TypesTableNode(Target, inputModule); + TypesTableNode typesTable = new TypesTableNode(inputModule); tableHeader.Add(Internal.Runtime.ReadyToRunSectionType.AvailableTypes, typesTable, typesTable); if (CompilationModuleGroup.IsCompositeBuildMode) { - InliningInfoNode inliningInfoTable = new InliningInfoNode(Target, inputModule, InliningInfoNode.InfoType.InliningInfo2); + InliningInfoNode inliningInfoTable = new InliningInfoNode(inputModule, InliningInfoNode.InfoType.InliningInfo2); tableHeader.Add(Internal.Runtime.ReadyToRunSectionType.InliningInfo2, inliningInfoTable, inliningInfoTable); } @@ -733,7 +733,7 @@ namespace ILCompiler.DependencyAnalysis } } - InliningInfoNode crossModuleInliningInfoTable = new InliningInfoNode(Target, null, + InliningInfoNode crossModuleInliningInfoTable = new InliningInfoNode(null, CompilationModuleGroup.IsCompositeBuildMode ? InliningInfoNode.InfoType.CrossModuleInliningForCrossModuleDataOnly : InliningInfoNode.InfoType.CrossModuleAllMethods); Header.Add(Internal.Runtime.ReadyToRunSectionType.CrossModuleInlineInfo, crossModuleInliningInfoTable, crossModuleInliningInfoTable); this.CrossModuleInlningInfo = crossModuleInliningInfoTable; @@ -744,7 +744,7 @@ namespace ILCompiler.DependencyAnalysis ImportSectionsTable = new ImportSectionsTableNode(this); Header.Add(Internal.Runtime.ReadyToRunSectionType.ImportSections, ImportSectionsTable, ImportSectionsTable.StartSymbol); - DebugInfoTable = new DebugInfoTableNode(Target); + DebugInfoTable = new DebugInfoTableNode(); Header.Add(Internal.Runtime.ReadyToRunSectionType.DebugInfo, DebugInfoTable, DebugInfoTable); EagerImports = new ImportSectionNode( diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilation.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilation.cs index 4df9dae5fb0..8b1b8d7c30e 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilation.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilation.cs @@ -430,7 +430,7 @@ namespace ILCompiler DependencyAnalyzerBase<NodeFactory> componentGraph = new DependencyAnalyzer<NoLogStrategy<NodeFactory>, NodeFactory>(componentFactory, comparer); componentGraph.AddRoot(componentFactory.Header, "Component module R2R header"); - OwnerCompositeExecutableNode ownerExecutableNode = new OwnerCompositeExecutableNode(_nodeFactory.Target, ownerExecutableName); + OwnerCompositeExecutableNode ownerExecutableNode = new OwnerCompositeExecutableNode(ownerExecutableName); componentGraph.AddRoot(ownerExecutableNode, "Owner composite executable name"); componentGraph.AddRoot(copiedCorHeader, "Copied COR header"); componentGraph.AddRoot(debugDirectory, "Debug directory"); diff --git a/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/DependencyAnalysis/MethodCodeNode.cs b/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/DependencyAnalysis/MethodCodeNode.cs index 3d434e0b17e..2c5c14d9b5f 100644 --- a/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/DependencyAnalysis/MethodCodeNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/DependencyAnalysis/MethodCodeNode.cs @@ -49,14 +49,11 @@ namespace ILCompiler.DependencyAnalysis protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); - public override ObjectNodeSection Section + public override ObjectNodeSection GetSection(NodeFactory factory) { - get - { - return _method.Context.Target.IsWindows ? - (_isFoldable ? ObjectNodeSection.FoldableManagedCodeWindowsContentSection : ObjectNodeSection.ManagedCodeWindowsContentSection) : - (_isFoldable ? ObjectNodeSection.FoldableManagedCodeUnixContentSection : ObjectNodeSection.ManagedCodeUnixContentSection); - } + return factory.Target.IsWindows ? + (_isFoldable ? ObjectNodeSection.FoldableManagedCodeWindowsContentSection : ObjectNodeSection.ManagedCodeWindowsContentSection) : + (_isFoldable ? ObjectNodeSection.FoldableManagedCodeUnixContentSection : ObjectNodeSection.ManagedCodeUnixContentSection); } public override bool StaticDependenciesAreComputed => _methodCode != null; diff --git a/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/DependencyAnalysis/RyuJitNodeFactory.cs b/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/DependencyAnalysis/RyuJitNodeFactory.cs index 933f5a46b79..45060d7ffa3 100644 --- a/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/DependencyAnalysis/RyuJitNodeFactory.cs +++ b/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/DependencyAnalysis/RyuJitNodeFactory.cs @@ -70,7 +70,7 @@ namespace ILCompiler.DependencyAnalysis else { // Otherwise we just unbox 'this' and don't touch anything else. - return new UnboxingStubNode(method, Target); + return new UnboxingStubNode(method); } } |