| File: Compiler\InteropStubManager.cs | Web Access |
| Project: 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 System.Diagnostics; using Internal.IL; using Internal.TypeSystem; using ILCompiler.DependencyAnalysis; using DependencySink = ILCompiler.DependencyAnalysisFramework.DependencyNodeCore<ILCompiler.DependencyAnalysis.NodeFactory>.DependencySink; using IDependencySink = ILCompiler.DependencyAnalysisFramework.DependencyNodeCore<ILCompiler.DependencyAnalysis.NodeFactory>.IDependencySink; using ILCompiler.DependencyAnalysisFramework; namespace ILCompiler { /// <summary> /// This class is responsible for managing stub methods for interop /// </summary> public abstract class InteropStubManager : ICompilationRootProvider { protected readonly PInvokeILEmitterConfiguration _configuration; public InteropStubManager(PInvokeILEmitterConfiguration configuration) { _configuration = configuration; } public abstract void AddDependenciesDueToMethodCodePresence(IDependencySink dependencies, NodeFactory factory, MethodDesc method); public abstract void AddInterestingInteropConstructedTypeDependencies(DependencySink dependencies, NodeFactory factory, TypeDesc type); public abstract PInvokeILProvider CreatePInvokeILProvider(); /// <summary> /// For Marshal generic APIs(eg. Marshal.StructureToPtr<T>, GetFunctionPointerForDelegate) we add /// the generic parameter as dependencies so that we can generate runtime data for them /// </summary> public abstract void AddMarshalAPIsGenericDependencies(IDependencySink dependencies, NodeFactory factory, MethodDesc method); public virtual void AddToReadyToRunHeader(ReadyToRunHeaderNode header, NodeFactory nodeFactory, ExternalReferencesTableNode commonFixupsTableNode) { } public virtual void AddCompilationRoots(IRootingServiceProvider rootProvider) { } public LinkageMetadata GetLinkageMetadata(MethodDesc method) { LinkageMetadata linkage = _configuration.GetLinkageMetadata(method); Debug.Assert(linkage is not null); return linkage; } } }