| File: Compiler\DependencyAnalysis\UnboxingStubNode.cs | Web Access |
| Project: src\runtime\src\coreclr\tools\aot\ILCompiler.Compiler\ILCompiler.Compiler.csproj (ILCompiler.Compiler) |
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Internal.Text; using Internal.TypeSystem; using Debug = System.Diagnostics.Debug; namespace ILCompiler.DependencyAnalysis { /// <summary> /// Represents an unboxing stub that supports calling instance methods on boxed valuetypes. /// </summary> public partial class UnboxingStubNode : AssemblyStubNode, IMethodNode, ISymbolDefinitionNode { public MethodDesc Method { get; } public override ObjectNodeSection GetSection(NodeFactory factory) { return factory.Target.IsWindows ? ObjectNodeSection.UnboxingStubWindowsContentSection : ObjectNodeSection.UnboxingStubUnixContentSection; } public override bool IsShareable => true; public UnboxingStubNode(MethodDesc target) { Debug.Assert(target.GetCanonMethodTarget(CanonicalFormKind.Specific) == target); Debug.Assert(target.OwningType.IsValueType); Method = target; } private ISymbolNode GetUnderlyingMethodEntrypoint(NodeFactory factory) { ISymbolNode node = factory.MethodEntrypoint(Method); return node; } public override void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { sb.Append("unbox_"u8).Append(nameMangler.GetMangledMethodName(Method)); } public static Utf8String GetMangledName(NameMangler nameMangler, MethodDesc method) { return Utf8String.Concat("unbox_"u8, nameMangler.GetMangledMethodName(method).AsSpan()); } protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); public override int ClassCode => -1846923013; public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(Method, ((UnboxingStubNode)other).Method); } } }