diff options
author | dotnet-bot <dotnet-bot@microsoft.com> | 2018-07-27 02:18:02 +0300 |
---|---|---|
committer | dotnet-bot <dotnet-bot@microsoft.com> | 2018-07-27 02:18:02 +0300 |
commit | d23b7f190431b216c45eed3444012a6565b45668 (patch) | |
tree | e60356fdca1c26dbde5fe09922bb26c2116d69ac /src/ILCompiler.Compiler | |
parent | 907e75814f72cb4ebf5ec172def064ff1b9959c8 (diff) |
[tfs-changeset: 1708860]
Diffstat (limited to 'src/ILCompiler.Compiler')
4 files changed, 26 insertions, 59 deletions
diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NonExternMethodSymbolNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NonExternMethodSymbolNode.cs index 097d67036..6be5e9456 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NonExternMethodSymbolNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NonExternMethodSymbolNode.cs @@ -18,7 +18,7 @@ namespace ILCompiler.DependencyAnalysis // When full analysis is fully supported, remove this class and field forever. public static bool EnableFullAnalysis = false; } - + /// <summary> /// Represents a symbol that is defined externally but modeled as a method /// in the DependencyAnalysis infrastructure during compilation that is compiled @@ -32,6 +32,7 @@ namespace ILCompiler.DependencyAnalysis ISymbolNode[] _funcletSymbols = Array.Empty<ISymbolNode>(); bool _dependenciesQueried; bool _hasCompiledBody; + private HashSet<GenericLookupResult> _floatingGenericLookupResults; public NonExternMethodSymbolNode(NodeFactory factory, MethodDesc method, bool isUnboxing) : base(isUnboxing ? UnboxingStubNode.GetMangledName(factory.NameMangler, method) : @@ -101,6 +102,30 @@ namespace ILCompiler.DependencyAnalysis _funcletSymbols = funclets; } + public void DeferFloatingGenericLookup(GenericLookupResult lookupResult) + { + if (_floatingGenericLookupResults == null) + _floatingGenericLookupResults = new HashSet<GenericLookupResult>(); + _floatingGenericLookupResults.Add(lookupResult); + } + + protected override void OnMarked(NodeFactory factory) + { + // Commit all floating generic lookups associated with the method when the method + // is proved not dead. + if (_floatingGenericLookupResults != null) + { + Debug.Assert(_method.IsCanonicalMethod(CanonicalFormKind.Any)); + TypeSystemEntity canonicalOwner = _method.HasInstantiation ? (TypeSystemEntity)_method : (TypeSystemEntity)_method.OwningType; + DictionaryLayoutNode dictLayout = factory.GenericDictionaryLayout(canonicalOwner); + + foreach (var lookupResult in _floatingGenericLookupResults) + { + dictLayout.EnsureEntry(lookupResult); + } + } + } + public void AddCompilationDiscoveredDependency(IDependencyNode<NodeFactory> node, string reason) { Debug.Assert(!_dependenciesQueried); diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/UtcDictionaryLayoutNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/UtcDictionaryLayoutNode.cs deleted file mode 100644 index d268fa17b..000000000 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/UtcDictionaryLayoutNode.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Diagnostics; - -using Internal.TypeSystem; - -using ILCompiler.DependencyAnalysisFramework; - -namespace ILCompiler.DependencyAnalysis -{ - /// <summary> - /// Represents the layout of the generic dictionary associated with a given canonical - /// generic type or generic method. Maintains a bag of <see cref="GenericLookupResult"/> associated - /// with the canonical entity. - /// </summary> - /// <remarks> - /// The generic dictionary doesn't have any dependent nodes because <see cref="GenericLookupResult"/> - /// are runtime-determined - the concrete dependency depends on the generic context the canonical - /// entity is instantiated with. - /// </remarks> - public partial class UtcDictionaryLayoutNode : DictionaryLayoutNode - { - public override bool HasFixedSlots - { - get - { - return false; - } - } - - public UtcDictionaryLayoutNode(TypeSystemEntity owningMethodOrType) : base(owningMethodOrType) - { - - } - -#if !PROJECTN - public override void EnsureEntry(GenericLookupResult lookupResult) => throw new NotImplementedException(); - public override int GetSlotForEntry(GenericLookupResult entry) => throw new NotImplementedException(); - public override IEnumerable<GenericLookupResult> Entries => throw new NotImplementedException(); - public override ICollection<NativeLayoutVertexNode> GetTemplateEntries(NodeFactory factory) => throw new NotImplementedException(); - public override void EmitDictionaryData(ref ObjectDataBuilder builder, NodeFactory factory, GenericDictionaryNode dictionary, bool fixedLayoutOnly) => throw new NotImplementedException(); -#endif - } -} diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/UtcNodeFactory.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/UtcNodeFactory.cs index ef614be4f..2b7db44a7 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/UtcNodeFactory.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/UtcNodeFactory.cs @@ -351,14 +351,6 @@ namespace ILCompiler return ReadOnlyDataBlob(NameMangler.GetMangledFieldName(field), ((EcmaField)field).GetFieldRvaData(), Target.PointerSize); } - public class UtcDictionaryLayoutProvider : DictionaryLayoutProvider - { - public override DictionaryLayoutNode GetLayout(TypeSystemEntity methodOrType) - { - return new UtcDictionaryLayoutNode(methodOrType); - } - } - public ISymbolNode LoopHijackFlagSymbol() { return LoopHijackFlag; diff --git a/src/ILCompiler.Compiler/src/ILCompiler.Compiler.csproj b/src/ILCompiler.Compiler/src/ILCompiler.Compiler.csproj index e42d3a4a4..b738314bc 100644 --- a/src/ILCompiler.Compiler/src/ILCompiler.Compiler.csproj +++ b/src/ILCompiler.Compiler/src/ILCompiler.Compiler.csproj @@ -280,7 +280,6 @@ <Compile Include="Compiler\DependencyAnalysis\UtcThreadStaticsNode.cs" /> <Compile Include="Compiler\DependencyAnalysis\TypeMetadataMapNode.cs" /> <Compile Include="Compiler\DependencyAnalysis\UnboxingStubNode.cs" /> - <Compile Include="Compiler\DependencyAnalysis\UtcDictionaryLayoutNode.cs" /> <Compile Include="Compiler\DependencyAnalysis\UtcNodeFactory.cs" /> <Compile Include="Compiler\DependencyAnalysis\VirtualMethodUseNode.cs" /> <Compile Include="Compiler\DependencyAnalysis\SealedVTableNode.cs" /> |