blob: d64319e9073872abc3de9ea256baeb1d81e45cfc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// 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 Internal.Text;
using Internal.TypeSystem;
namespace ILCompiler.DependencyAnalysis
{
internal sealed class ClonedConstructedEETypeNode : ConstructedEETypeNode, ISymbolDefinitionNode
{
public ClonedConstructedEETypeNode(NodeFactory factory, TypeDesc type) : base(factory, type)
{
}
protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler) + " cloned";
public override ObjectNode NodeForLinkage(NodeFactory factory) => this;
//
// A cloned type must be named differently than the type it is a clone of so the linker
// will have an unambiguous symbol to resolve
//
public override void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append("__Cloned_EEType_").Append(nameMangler.GetMangledTypeName(_type));
}
public override bool IsShareable => true;
protected override void OutputRelatedType(NodeFactory factory, ref ObjectDataBuilder objData)
{
//
// Cloned types use the related type field to point via an IAT slot at their true implementation
//
objData.EmitPointerReloc(factory.NecessaryTypeSymbol(_type));
}
protected internal override int ClassCode => -288888778;
}
}
|