Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFadi Hanna <fadim@microsoft.com>2018-08-16 02:26:32 +0300
committerFadi Hanna <fadim@microsoft.com>2018-08-16 02:26:32 +0300
commit7c4bfd5475f5da9a8d13810be0923b27a34a9711 (patch)
tree4d1fc2425566eec4e4084c5a63ad60332944e046 /src/ILCompiler.Compiler
parent279fb8684688a0e13a3a0769b89e456bd430e0d3 (diff)
The name/semantic of the CanonicalEntrypoint method on the NodeFactory is a bit misleading, and were incorrectly used in a couple of places. I made a small refactoring to distinguish between the scenario where we need a IMethodNode for the purpose of dependency analysis (either a MethodEntrypointNode or a ShadowConcreteMethodNode), and the scenario where we really need a callable address of a canonical entry point.
(Fixes a test in the Recoil category, which had a nullptr value for a ConstrainedMethodUse generic dictionary slot. The call to CanonicalEntrypoint was returning a ShadowConcreteMethod node, which was not really valid for that purpose. In fact, i'm not really sure why this test compiled successfully in the first place instead of hitting a linking error). [tfs-changeset: 1710918]
Diffstat (limited to 'src/ILCompiler.Compiler')
-rw-r--r--src/ILCompiler.Compiler/src/Compiler/Compilation.cs2
-rw-r--r--src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/CustomAttributeBasedDependencyAlgorithm.cs4
-rw-r--r--src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NodeFactory.cs5
-rw-r--r--src/ILCompiler.Compiler/src/IL/ILImporter.Scanner.cs4
4 files changed, 10 insertions, 5 deletions
diff --git a/src/ILCompiler.Compiler/src/Compiler/Compilation.cs b/src/ILCompiler.Compiler/src/Compiler/Compilation.cs
index defedd0b7..75911d73a 100644
--- a/src/ILCompiler.Compiler/src/Compiler/Compilation.cs
+++ b/src/ILCompiler.Compiler/src/Compiler/Compilation.cs
@@ -349,7 +349,7 @@ namespace ILCompiler
public void AddCompilationRoot(MethodDesc method, string reason, string exportName = null)
{
- IMethodNode methodEntryPoint = _factory.CanonicalEntrypoint(method);
+ IMethodNode methodEntryPoint = _factory.MethodNodeForDependencyAnalysis(method);
_graph.AddRoot(methodEntryPoint, reason);
if (exportName != null)
diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/CustomAttributeBasedDependencyAlgorithm.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/CustomAttributeBasedDependencyAlgorithm.cs
index 9f2cae560..800cd1a07 100644
--- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/CustomAttributeBasedDependencyAlgorithm.cs
+++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/CustomAttributeBasedDependencyAlgorithm.cs
@@ -78,7 +78,7 @@ namespace ILCompiler.DependencyAnalysis
// Make a new list in case we need to abort.
var caDependencies = new DependencyList();
- caDependencies.Add(factory.CanonicalEntrypoint(constructor), "Attribute constructor");
+ caDependencies.Add(factory.MethodNodeForDependencyAnalysis(constructor), "Attribute constructor");
caDependencies.Add(factory.ConstructedTypeSymbol(constructor.OwningType), "Attribute type");
CustomAttributeValue<TypeDesc> decodedValue = attribute.DecodeValue(attributeTypeProvider);
@@ -164,7 +164,7 @@ namespace ILCompiler.DependencyAnalysis
}
// TODO: what if the setter is virtual/abstract?
- dependencies.Add(factory.CanonicalEntrypoint(setterMethod), "Custom attribute blob");
+ dependencies.Add(factory.MethodNodeForDependencyAnalysis(setterMethod), "Custom attribute blob");
}
return true;
diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NodeFactory.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NodeFactory.cs
index 26b0c703d..1f33b6bff 100644
--- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NodeFactory.cs
+++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NodeFactory.cs
@@ -758,6 +758,11 @@ namespace ILCompiler.DependencyAnalysis
public IMethodNode CanonicalEntrypoint(MethodDesc method, bool isUnboxingStub = false)
{
+ return MethodEntrypoint(method.GetCanonMethodTarget(CanonicalFormKind.Specific), isUnboxingStub);
+ }
+
+ public IMethodNode MethodNodeForDependencyAnalysis(MethodDesc method, bool isUnboxingStub = false)
+ {
MethodDesc canonMethod = method.GetCanonMethodTarget(CanonicalFormKind.Specific);
if (method != canonMethod)
return ShadowConcreteMethod(method, isUnboxingStub);
diff --git a/src/ILCompiler.Compiler/src/IL/ILImporter.Scanner.cs b/src/ILCompiler.Compiler/src/IL/ILImporter.Scanner.cs
index 9468e25f1..b47f06cff 100644
--- a/src/ILCompiler.Compiler/src/IL/ILImporter.Scanner.cs
+++ b/src/ILCompiler.Compiler/src/IL/ILImporter.Scanner.cs
@@ -396,7 +396,7 @@ namespace Internal.IL
MetadataType classWithMissingCtor = activatorType.GetKnownNestedType("ClassWithMissingConstructor");
ctor = classWithMissingCtor.GetParameterlessConstructor();
}
- _dependencies.Add(_factory.CanonicalEntrypoint(ctor), reason);
+ _dependencies.Add(_factory.MethodNodeForDependencyAnalysis(ctor), reason);
}
return;
@@ -580,7 +580,7 @@ namespace Internal.IL
_dependencies.Add(instParam, reason);
}
- _dependencies.Add(_factory.CanonicalEntrypoint(targetMethod), reason);
+ _dependencies.Add(_factory.MethodNodeForDependencyAnalysis(targetMethod), reason);
}
else
{