diff options
author | David Wrighton <davidwr@microsoft.com> | 2017-10-17 23:51:11 +0300 |
---|---|---|
committer | David Wrighton <davidwr@microsoft.com> | 2017-10-17 23:51:11 +0300 |
commit | 228f8bee5ba74803d30bbd243508fbe8d02f861d (patch) | |
tree | deffc81967c2c662b009c30d6a896f950e63cfb8 /src/ILCompiler.Compiler | |
parent | 431c48978a66f31a904757a394de47bdc80c2a41 (diff) |
Enable more correct compilation when ProjectNDependencyBehavior.EnableFullAnalysis is enabled
- Fix InstantiatedMethod.GetCanonMethodTarget to handle all possible cases of universal generic promotion instead of ones that only involve non-universal canonical generics
- Enable consistent results from HasReflectionInvokeStubForInvokableMethod when full analysis is enabled
- Enable CodeBasedDependencyAlgorithm to create reflection target method bodies
- Add asserts to NonExternMethodNode to ensure that we don't attempt to compile partially canonicalized methods
[tfs-changeset: 1678328]
Diffstat (limited to 'src/ILCompiler.Compiler')
3 files changed, 16 insertions, 4 deletions
diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/CodeBasedDependencyAlgorithm.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/CodeBasedDependencyAlgorithm.cs index b96c74f43..bed14da6e 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/CodeBasedDependencyAlgorithm.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/CodeBasedDependencyAlgorithm.cs @@ -29,7 +29,7 @@ namespace ILCompiler.DependencyAnalysis dependencies = new DependencyList(); if (factory.MetadataManager.HasReflectionInvokeStubForInvokableMethod(method) - && ((factory.Target.Abi != TargetAbi.ProjectN) || !method.IsCanonicalMethod(CanonicalFormKind.Any))) + && ((factory.Target.Abi != TargetAbi.ProjectN) || ProjectNDependencyBehavior.EnableFullAnalysis || !method.IsCanonicalMethod(CanonicalFormKind.Any))) { MethodDesc canonInvokeStub = factory.MetadataManager.GetCanonicalReflectionInvokeStub(method); if (canonInvokeStub.IsSharedByGenericInstantiations) @@ -42,7 +42,7 @@ namespace ILCompiler.DependencyAnalysis } bool skipUnboxingStubDependency = false; - if (factory.Target.Abi == TargetAbi.ProjectN) + if ((factory.Target.Abi == TargetAbi.ProjectN) && !ProjectNDependencyBehavior.EnableFullAnalysis) { // ProjectN compilation currently computes the presence of these stubs independent from dependency analysis here // TODO: fix that issue and remove this odd treatment of unboxing stubs diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NonExternMethodSymbolNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NonExternMethodSymbolNode.cs index 030bacaa2..22923129f 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NonExternMethodSymbolNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NonExternMethodSymbolNode.cs @@ -39,6 +39,10 @@ namespace ILCompiler.DependencyAnalysis { _isUnboxing = isUnboxing; _method = method; + + // Ensure all method bodies are fully canonicalized or not at all. + Debug.Assert(!method.IsCanonicalMethod(CanonicalFormKind.Any) || (method.GetCanonMethodTarget(CanonicalFormKind.Specific) == method)); + Debug.Assert(!method.IsCanonicalMethod(CanonicalFormKind.Universal) || (method.GetCanonMethodTarget(CanonicalFormKind.Universal) == method)); } protected override string GetName(NodeFactory factory) => "Non" + base.GetName(factory); diff --git a/src/ILCompiler.Compiler/src/Compiler/PrecomputedMetadataManager.cs b/src/ILCompiler.Compiler/src/Compiler/PrecomputedMetadataManager.cs index 3c901f52c..ed9478ceb 100644 --- a/src/ILCompiler.Compiler/src/Compiler/PrecomputedMetadataManager.cs +++ b/src/ILCompiler.Compiler/src/Compiler/PrecomputedMetadataManager.cs @@ -729,8 +729,16 @@ namespace ILCompiler { Debug.Assert(IsReflectionInvokable(method)); - if (method.IsCanonicalMethod(CanonicalFormKind.Any)) - return false; + if (!ProjectNDependencyBehavior.EnableFullAnalysis) + { + if (method.IsCanonicalMethod(CanonicalFormKind.Any)) + return false; + } + else + { + if (method.IsCanonicalMethod(CanonicalFormKind.Universal)) + return false; + } MethodDesc reflectionInvokeStub = GetCanonicalReflectionInvokeStub(method); |