diff options
author | dotnet-bot <dotnet-bot@microsoft.com> | 2017-10-23 20:19:26 +0300 |
---|---|---|
committer | dotnet-bot <dotnet-bot@microsoft.com> | 2017-10-23 20:19:26 +0300 |
commit | 5a49c4381d471f6a0b49cc0a5e5f4316a724ed6e (patch) | |
tree | 54447f7446aa9ed1d65c1c9b4a0d3b4493d26df0 /src/ILCompiler.Compiler | |
parent | a924fcc643fec39f58dca13bc22a0012acea5d32 (diff) |
ProjectX: Set the canonical unboxing stub as the template method for GVMs of structs
For GVMs that use the canonical implementation, if their owning types are structs, the canonical template should be the unboxing stub instead of the real target. However, the template signature should not have the IsUnboxingStub set because all template lookups performed at runtime are performed with this flag not set, since it can't always be conveniently computed for a concrete method before looking up its template.
[tfs-changeset: 1678892]
Diffstat (limited to 'src/ILCompiler.Compiler')
-rw-r--r-- | src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NativeLayoutVertexNode.cs | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NativeLayoutVertexNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NativeLayoutVertexNode.cs index 48bbeb575..2b181fa90 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NativeLayoutVertexNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NativeLayoutVertexNode.cs @@ -98,11 +98,6 @@ namespace ILCompiler.DependencyAnalysis { CreateInstantiatedSignature = 1, SaveEntryPoint = 2, - /// <summary> - /// IsUnboxingStub is not set for template methods (all template lookups performed at runtime are done with this flag not set, - /// since it can't always be conveniently computed for a concrete method before looking up its template). - /// </summary> - DisableUnboxingStub = 4 } protected readonly MethodDesc _method; @@ -226,9 +221,8 @@ namespace ILCompiler.DependencyAnalysis protected virtual IMethodNode GetMethodEntrypointNode(NodeFactory factory, out bool unboxingStub) { - unboxingStub = (_flags & MethodEntryFlags.DisableUnboxingStub) != 0 ? false : _method.OwningType.IsValueType && !_method.Signature.IsStatic; + unboxingStub = _method.OwningType.IsValueType && !_method.Signature.IsStatic; IMethodNode methodEntryPointNode = factory.MethodEntrypoint(_method, unboxingStub); - return methodEntryPointNode; } } @@ -672,7 +666,7 @@ namespace ILCompiler.DependencyAnalysis protected override string GetName(NodeFactory factory) => "NativeLayoutTemplateMethodSignatureVertexNode_" + factory.NameMangler.GetMangledMethodName(_method); public NativeLayoutTemplateMethodSignatureVertexNode(NodeFactory factory, MethodDesc method) - : base(factory, method, MethodEntryFlags.CreateInstantiatedSignature | MethodEntryFlags.SaveEntryPoint | MethodEntryFlags.DisableUnboxingStub) + : base(factory, method, MethodEntryFlags.CreateInstantiatedSignature | (method.IsVirtual ? MethodEntryFlags.SaveEntryPoint : 0)) { } @@ -683,8 +677,19 @@ namespace ILCompiler.DependencyAnalysis Vertex methodEntryVertex = base.WriteVertex(factory); return SetSavedVertex(factory.MetadataManager.NativeLayoutInfo.TemplatesSection.Place(methodEntryVertex)); } - } + protected override IMethodNode GetMethodEntrypointNode(NodeFactory factory, out bool unboxingStub) + { + // Only GVM templates need entry points. + Debug.Assert(_method.IsVirtual); + unboxingStub = _method.OwningType.IsValueType; + IMethodNode methodEntryPointNode = factory.MethodEntrypoint(_method, unboxingStub); + // Note: We don't set the IsUnboxingStub flag on template methods (all template lookups performed at runtime are performed with this flag not set, + // since it can't always be conveniently computed for a concrete method before looking up its template) + unboxingStub = false; + return methodEntryPointNode; + } + } public sealed class NativeLayoutDictionarySignatureNode : NativeLayoutSavedVertexNode { |