Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/coreclr/tools/ILTrim.Core/ILTrim.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<Compile Include="..\aot\ILCompiler.Compiler\Compiler\DescriptorMarker.cs" Link="Shared\DescriptorMarker.cs"/>
<Compile Include="..\aot\ILCompiler.Compiler\Compiler\DependencyAnalysis\ObjectGetTypeCalledNode.cs" Link="DependencyAnalysis\ObjectGetTypeCalledNode.cs" />
<Compile Include="..\aot\ILCompiler.Compiler\Compiler\DependencyAnalysis\ObjectGetTypeFlowDependenciesNode.cs" Link="DependencyAnalysis\ObjectGetTypeFlowDependenciesNode.cs" />
<Compile Include="..\aot\ILCompiler.Compiler\Compiler\DependencyAnalysis\TrimmingDescriptorNode.cs" Link="DependencyAnalysis\TrimmingDescriptorNode.cs" />
</ItemGroup>

<!-- ILCompiler.Compiler shared extension method files -->
Expand Down
24 changes: 1 addition & 23 deletions src/coreclr/tools/ILTrim.Tests/ILTrimExpectedFailures.txt
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,6 @@ Inheritance.Interfaces.OnReferenceType.InterfaceTypeInOtherUsedOnlyByCopiedAssem
Inheritance.Interfaces.OnReferenceType.InterfaceUsedOnlyAsConstraintIsKept
Inheritance.Interfaces.OnReferenceType.NoInstanceCtor.NoInstanceCtorAndAssemblyPreserveAll
Inheritance.Interfaces.OnReferenceType.NoInstanceCtor.NoInstanceCtorAndTypePreserveAll
Inheritance.Interfaces.OnReferenceType.NoInstanceCtor.NoInstanceCtorAndTypePreserveFields
Inheritance.Interfaces.OnReferenceType.NoInstanceCtor.NoInstanceCtorAndTypePreserveFieldsWithInterfacesMarked
Inheritance.Interfaces.OnReferenceType.NoInstanceCtor.NoInstanceCtorAndTypePreserveMethods
Inheritance.Interfaces.OnReferenceType.NoInstanceCtor.NoInstanceCtorAndTypePreserveMethodsWithInterfacesMarked
Inheritance.Interfaces.OnReferenceType.NoInstanceCtor.NoInstanceCtorAndTypePreserveNone
Inheritance.Interfaces.OnReferenceType.NoKeptCtor.DynamicDependencyPreservesInterfaceMethod
Inheritance.Interfaces.OnReferenceType.NoKeptCtor.ExplicitInterfaceCanBeRemovedFromClassWithOnlyStaticMethodUsed
Inheritance.Interfaces.OnReferenceType.NoKeptCtor.GenericWithConstraintDoesNotCauseOtherTypesToKeepInterface
Expand All @@ -253,8 +248,6 @@ Inheritance.Interfaces.OnReferenceType.NoKeptCtor.PreserveDependencyPreservesInt
Inheritance.Interfaces.OnReferenceType.NoKeptCtor.UnusedTypeHasExplicitInterfaceMethodPreservedViaXml
Inheritance.Interfaces.OnReferenceType.NoKeptCtor.UnusedTypeHasExplicitInterfacePropertyPreservedViaXml
Inheritance.Interfaces.OnReferenceType.NoKeptCtor.UnusedTypeHasInterfaceMethodPreservedViaXml
Inheritance.Interfaces.OnReferenceType.NoKeptCtor.UnusedTypeWithPreserveFields
Inheritance.Interfaces.OnReferenceType.NoKeptCtor.UnusedTypeWithPreserveMethods
Inheritance.Interfaces.OnReferenceType.NoKeptCtor.UnusedTypeWithPreserveMethodsAndInterfaceTypeMarked
Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded.ArrayWithIndexAssignedToReturnValue
Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded.FieldDowncastedToInterface
Expand Down Expand Up @@ -282,14 +275,12 @@ Inheritance.Interfaces.OnReferenceType.NoKeptCtorButInterfaceNeeded.ReturnValueD
Inheritance.Interfaces.OnReferenceType.ObjectCastedToSecondInterfaceHasMemberRemovedButInterfaceKept
Inheritance.Interfaces.OnReferenceType.UnusedComInterfaceIsKept
Inheritance.Interfaces.OnReferenceType.UnusedExplicitInterfaceHasMethodPreservedViaXml
Inheritance.Interfaces.OnReferenceType.UnusedInterfaceHasMethodPreservedViaXml
Inheritance.Interfaces.OnValueType.NoKeptCtor.InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethod
Inheritance.Interfaces.OnValueType.NoKeptCtor.InterfaceTypeRemovedWhenOnlyUsedByClassWithOnlyStaticMethodMultiple
Inheritance.Interfaces.OnValueType.StructImplementingInterfaceMethodsNested2
Inheritance.Interfaces.OnValueType.StructUsedFromConcreteTypeHasInterfaceMethodRemoved2
Inheritance.Interfaces.OnValueType.StructWithNestedStructImplementingInterface
Inheritance.Interfaces.OnValueType.UnusedExplicitInterfaceHasMethodPreservedViaXml
Inheritance.Interfaces.OnValueType.UnusedInterfaceHasMethodPreservedViaXml
Inheritance.Interfaces.RecursiveInterfaces.GenericInterfaceImplementedRecursively
Inheritance.Interfaces.RecursiveInterfaces.InterfaceImplementedRecursively
Inheritance.Interfaces.RecursiveInterfaces.OverrideOfRecursiveInterfaceIsRemoved
Expand Down Expand Up @@ -348,34 +339,23 @@ LinkAttributes.TypedArgumentsErrors
LinkXml.AssemblyWithPreserveAll
LinkXml.CanPreserveAnExportedType
LinkXml.CanPreserveExportedTypesUsingRegex
LinkXml.CanPreserveNamespace
LinkXml.CanPreserveTypesUsingRegex
LinkXml.EmbeddedLinkXmlFromCopyAssemblyIsProcessed
LinkXml.EmbeddedLinkXmlPreservesAdditionalAssemblyWithOverriddenMethod
LinkXml.EmbeddedLinkXmlUnresolvedReferencesAreReported
LinkXml.LinkXmlErrorCases
LinkXml.PreserveIndividualMembersOfNonRequiredType
LinkXml.PreserveSecondLevelMethodsOfNonRequiredType
LinkXml.TypeWithPreserveFieldsHasBackingFieldsOfPropertiesRemoved
LinkXml.UnusedAssemblyWithNoDefinedPreserveHasAllTypesPreserved
LinkXml.UnusedEventPreservedByLinkXmlIsKept
LinkXml.UnusedFieldPreservedByLinkXmlIsKept
LinkXml.UnusedGenericTypeWithPreserveAllHasAllMembersPreserved
LinkXml.UnusedInterfaceTypeOnTypeWithPreserveAllIsKept
LinkXml.UnusedInterfaceTypeOnTypeWithPreserveNothingIsRemoved
LinkXml.UnusedMethodPreservedByLinkXmlIsKept
LinkXml.UnusedNestedTypePreservedByLinkXmlIsKept
LinkXml.UnusedNonRequiredTypeIsRemoved
Comment thread
MichalStrehovsky marked this conversation as resolved.
LinkXml.UnusedPropertyPreservedByLinkXmlIsKept
LinkXml.UnusedTypeDeclarationPreservedByLinkXmlIsKept
LinkXml.UnusedTypeIsPresservedWhenEntireAssemblyIsPreserved
LinkXml.UnusedTypePreservedByLinkXmlIsKept
LinkXml.UnusedTypePreservedByLinkXmlWithCommentIsKept
LinkXml.UnusedTypeWithNoDefinedPreserveHasAllMembersPreserved
LinkXml.UnusedTypeWithPreserveAllHasAllMembersPreserved
LinkXml.UnusedTypeWithPreserveFieldsHasMethodsRemoved
LinkXml.UnusedTypeWithPreserveMethodsHasFieldsRemoved
LinkXml.UnusedTypeWithPreserveNothingAndPreserveMembers
LinkXml.UnusedTypeWithPreserveNothingHasMembersRemoved
LinkXml.UsedNonRequiredExportedTypeIsKept
LinkXml.UsedNonRequiredExportedTypeIsKeptWhenRooted
LinkXml.UsedNonRequiredTypeIsKept
Expand All @@ -389,7 +369,6 @@ Logging.SourceLines
Metadata.DebuggerDisplayNamesAreKept
Metadata.NamesAreRemoved
Metadata.RootAllAssemblyNamesAreKept
Metadata.RootDescriptorNamesAreKept
Metadata.RootLibraryAssemblyNamesAreKept
Metadata.RootVisibleAssemblyNamesAreKept
PreserveDependencies.PreserveDependencyDeprecated
Expand Down Expand Up @@ -589,7 +568,6 @@ UnreachableBody.OverrideOfAbstractIsStubbedWithUnusedInterface
UnreachableBody.SimpleGetter
UnreachableBody.SimpleSetter
UnreachableBody.WorksWithDynamicDependency
UnreachableBody.WorksWithLinkXml
UnreachableBody.WorksWithPreserveDependency
Warnings.CanDisableWarnAsError
Warnings.CanDisableWarnings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@

namespace ILCompiler.DependencyAnalysis
{
public class TrimmingDescriptorNode : DependencyNodeCore<NodeFactory>, ICompilationRootProvider
public class TrimmingDescriptorNode : DependencyNodeCore<NodeFactory>
#if !ILTRIM
#pragma warning disable SA1001
, ICompilationRootProvider
#pragma warning restore SA1001
Comment thread
MichalStrehovsky marked this conversation as resolved.
#endif
{
private readonly string _fileName;

Expand All @@ -21,8 +26,12 @@ public override IEnumerable<DependencyListEntry> GetStaticDependencies(NodeFacto
{
using (Stream fs = File.OpenRead(_fileName))
{
#if ILTRIM
return DescriptorMarker.GetDependencies(factory.Logger, factory, fs, default, default, _fileName, factory.Settings.FeatureSettings);
#else
var metadataManager = (UsageBasedMetadataManager)factory.MetadataManager;
return DescriptorMarker.GetDependencies(metadataManager.Logger, factory, fs, default, default, _fileName, metadataManager.FeatureSwitches);
#endif
}
}

Expand All @@ -37,6 +46,8 @@ protected override string GetName(NodeFactory factory)
public override bool StaticDependenciesAreComputed => true;
public override IEnumerable<CombinedDependencyListEntry> GetConditionalStaticDependencies(NodeFactory context) => null;
public override IEnumerable<CombinedDependencyListEntry> SearchDynamicDependencies(List<DependencyNodeCore<NodeFactory>> markedNodes, int firstNode, NodeFactory context) => null;
#if !ILTRIM
void ICompilationRootProvider.AddCompilationRoots(IRootingServiceProvider rootProvider) => rootProvider.AddCompilationRoot(this, "Descriptor from command line");
#endif
}
}
5 changes: 4 additions & 1 deletion src/tools/illink/src/linker/Linker/Driver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
using ILogger = ILCompiler.ILogWriter;
using DependencyNode = ILCompiler.DependencyAnalysisFramework.DependencyNodeCore<ILCompiler.DependencyAnalysis.NodeFactory>;
using AssemblyRootNode = ILCompiler.DependencyAnalysis.AssemblyRootNode;
using TrimmingDescriptorNode = ILCompiler.DependencyAnalysis.TrimmingDescriptorNode;
#else
using Mono.Cecil;
using Mono.Linker.Steps;
Expand Down Expand Up @@ -772,7 +773,9 @@ protected int SetupContext(ILogger? customLogger = null)
return -1;
}

#if !ILTRIM
#if ILTRIM
inputs.Add(new TrimmingDescriptorNode(xmlFile));
#else
inputs.Add(new ResolveFromXmlStep(File.OpenRead(xmlFile), xmlFile));
#endif
continue;
Expand Down
Loading