Skip to content
Open
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
13 changes: 1 addition & 12 deletions src/tools/illink/src/linker/Linker.Steps/MarkStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3164,20 +3164,9 @@ void MarkMethodCollection(IList<MethodDefinition> methods, in DependencyInfo rea
if (method == null)
return null;

var methodAction = Annotations.GetAction(method);
if (methodAction is MethodAction.ConvertToStub)
{
// CodeRewriterStep may request the stubbed value for any preserved method
// with the action ConvertToStub. Ensure we have precomputed any stub value that may be needed by
// CodeRewriterStep. This ensures sweeping doesn't change the stub value (which can be determined by
// FeatureGuardAttribute or FeatureSwitchDefinitionAttribute that might have been removed).
Annotations.TryGetMethodStubValue(method, out _);
}

if (methodAction == MethodAction.Nothing)
if (Annotations.GetAction(method) == MethodAction.Nothing)
Annotations.SetAction(method, MethodAction.Parse);


// Use the original reason as it's important to correctly generate warnings
// the updated reason is only useful for better tracking of dependencies.
ProcessAnalysisAnnotationsForMethod(method, originalReason.Kind, origin);
Expand Down
13 changes: 0 additions & 13 deletions src/tools/illink/src/linker/Linker/MemberActionStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using ILLink.Shared;
using Mono.Cecil;
Expand All @@ -13,14 +12,12 @@ public class MemberActionStore
{
public SubstitutionInfo PrimarySubstitutionInfo { get; }
private readonly Dictionary<AssemblyDefinition, SubstitutionInfo?> _embeddedXmlInfos;
private readonly Dictionary<MethodDefinition, bool> _featureCheckValues;
readonly LinkContext _context;

public MemberActionStore(LinkContext context)
{
PrimarySubstitutionInfo = new SubstitutionInfo();
_embeddedXmlInfos = new Dictionary<AssemblyDefinition, SubstitutionInfo?>();
_featureCheckValues = new Dictionary<MethodDefinition, bool>();
_context = context;
}

Expand Down Expand Up @@ -73,9 +70,6 @@ public bool TryGetMethodStubValue(MethodDefinition method, out object? value)

internal bool TryGetFeatureCheckValue(MethodDefinition method, out bool value)
{
if (_featureCheckValues.TryGetValue(method, out value))
return true;

value = false;

if (!method.IsStatic)
Expand All @@ -98,10 +92,7 @@ internal bool TryGetFeatureCheckValue(MethodDefinition method, out bool value)
// If there's a FeatureSwitchDefinition, don't continue looking for FeatureGuard.
// We don't want to infer feature switch settings from FeatureGuard.
if (_context.FeatureSettings.TryGetValue(switchName, out value))
{
_featureCheckValues[method] = value;
return true;
}
return false;
}

Expand All @@ -118,17 +109,13 @@ internal bool TryGetFeatureCheckValue(MethodDefinition method, out bool value)
switch (featureType.Name)
{
case "RequiresUnreferencedCodeAttribute":
_featureCheckValues[method] = value;
return true;
case "RequiresDynamicCodeAttribute":
if (_context.FeatureSettings.TryGetValue(
"System.Runtime.CompilerServices.RuntimeFeature.IsDynamicCodeSupported",
out bool isDynamicCodeSupported)
&& !isDynamicCodeSupported)
{
_featureCheckValues[method] = value;
return true;
}
break;
}
}
Expand Down
Loading