Skip to content
Closed
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace ILLink.Shared.TrimAnalysis
{
public partial record FieldReferenceValue(FieldDesc FieldDefinition)
internal sealed partial record FieldReferenceValue(FieldDesc FieldDefinition)
: ReferenceValue(FieldDefinition.FieldType)
{
public override SingleValue DeepCopy() => this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace ILLink.Shared.TrimAnalysis
{
public partial record LocalVariableReferenceValue : ReferenceValue
internal sealed partial record LocalVariableReferenceValue : ReferenceValue
{
public int LocalIndex { get; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ namespace ILLink.Shared.TrimAnalysis
/// <summary>
/// Acts as the base class for all values that represent a reference to another value. These should only be held in a ref type or on the stack as a result of a 'load address' instruction (e.g. ldloca).
/// </summary>
public abstract record ReferenceValue(TypeDesc ReferencedType) : SingleValue { }
internal abstract record ReferenceValue(TypeDesc ReferencedType) : SingleValue { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace ILCompiler.Dataflow
{
public readonly record struct TrimAnalysisAssignmentPattern
internal readonly record struct TrimAnalysisAssignmentPattern
{
public MultiValue Source { get; init; }
public MultiValue Target { get; init; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

namespace ILCompiler.Dataflow
{
public readonly record struct TrimAnalysisMethodCallPattern
internal readonly record struct TrimAnalysisMethodCallPattern
{
public readonly MethodIL MethodBody;
public readonly ILOpcode Operation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace ILCompiler.Dataflow
{
public readonly struct TrimAnalysisPatternStore
internal readonly struct TrimAnalysisPatternStore
{
private readonly Dictionary<(MessageOrigin, bool), TrimAnalysisAssignmentPattern> AssignmentPatterns;
private readonly Dictionary<MessageOrigin, TrimAnalysisMethodCallPattern> MethodCallPatterns;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace ILCompiler.Dataflow
{
public class ValueNodeList : List<MultiValue>
internal sealed class ValueNodeList : List<MultiValue>
{
public ValueNodeList()
{
Expand Down Expand Up @@ -51,7 +51,7 @@ public override bool Equals(object? other)
}
}

public struct ValueBasicBlockPair : IEquatable<ValueBasicBlockPair>
internal struct ValueBasicBlockPair : IEquatable<ValueBasicBlockPair>
{
public ValueBasicBlockPair(MultiValue value, int basicBlockIndex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace ILLink.RoslynAnalyzer.DataFlow
// any kind of value equality for different block instances. In practice
// this should be fine as long as we consistently use block instances from
// a single ControlFlowGraph.
public readonly record struct BlockProxy (BasicBlock Block) : IBlock<BlockProxy>
internal readonly record struct BlockProxy (BasicBlock Block) : IBlock<BlockProxy>
{
public override string ToString ()
{
Expand All @@ -33,7 +33,7 @@ public override string ToString ()
public ConditionKind ConditionKind => (ConditionKind) Block.ConditionKind;
}

public readonly record struct RegionProxy (ControlFlowRegion Region) : IRegion<RegionProxy>
internal readonly record struct RegionProxy (ControlFlowRegion Region) : IRegion<RegionProxy>
{
public RegionKind Kind => Region.Kind switch {
ControlFlowRegionKind.Try => RegionKind.Try,
Expand All @@ -44,7 +44,7 @@ public readonly record struct RegionProxy (ControlFlowRegion Region) : IRegion<R
};
}

public readonly record struct ControlFlowGraphProxy (ControlFlowGraph ControlFlowGraph) : IControlFlowGraph<BlockProxy, RegionProxy>
internal readonly record struct ControlFlowGraphProxy (ControlFlowGraph ControlFlowGraph) : IControlFlowGraph<BlockProxy, RegionProxy>
{
public IEnumerable<BlockProxy> Blocks {
get {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace ILLink.RoslynAnalyzer.DataFlow
// For now, this is only designed to track the built-in "features"/"capabilities"
// like RuntimeFeatures.IsDynamicCodeSupported, where a true return value
// indicates that a feature/capability is available.
public record struct FeatureChecksValue : INegate<FeatureChecksValue>, IDeepCopyValue<FeatureChecksValue>
internal record struct FeatureChecksValue : INegate<FeatureChecksValue>, IDeepCopyValue<FeatureChecksValue>
{
public ValueSet<string> EnabledFeatures;
public ValueSet<string> DisabledFeatures;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace ILLink.RoslynAnalyzer.DataFlow
// (a set features that are checked to be enabled or disabled).
// The visitor takes a LocalDataFlowState as an argument, allowing for checks that
// depend on the current dataflow state.
public class FeatureChecksVisitor : OperationVisitor<StateValue, FeatureChecksValue>
internal sealed class FeatureChecksVisitor : OperationVisitor<StateValue, FeatureChecksValue>
{
DataFlowAnalyzerContext _dataFlowAnalyzerContext;

Expand Down Expand Up @@ -77,7 +77,7 @@ public override FeatureChecksValue VisitLiteral (ILiteralOperation operation, St
return FeatureChecksValue.None;
}

public bool? GetLiteralBool (IOperation operation)
static bool? GetLiteralBool (IOperation operation)
{
if (operation is not ILiteralOperation literal)
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace ILLink.RoslynAnalyzer.DataFlow
{
public struct FeatureContext : IEquatable<FeatureContext>, IDeepCopyValue<FeatureContext>
internal struct FeatureContext : IEquatable<FeatureContext>, IDeepCopyValue<FeatureContext>
{
// The set of features known to be enabled in this context.
// Unknown represents "all possible features".
Expand Down Expand Up @@ -54,7 +54,7 @@ public FeatureContext Union (FeatureContext other)
}
}

public readonly struct FeatureContextLattice : ILattice<FeatureContext>
internal readonly struct FeatureContextLattice : ILattice<FeatureContext>
{
public FeatureContextLattice () { }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace ILLink.RoslynAnalyzer.DataFlow
{
// Tracks the set of methods which get analyzed together during interprocedural analysis,
// and the possible states of hoisted locals in state machine methods and lambdas/local functions.
public struct InterproceduralState<TValue, TValueLattice> : IEquatable<InterproceduralState<TValue, TValueLattice>>
internal struct InterproceduralState<TValue, TValueLattice> : IEquatable<InterproceduralState<TValue, TValueLattice>>
where TValue : struct, IEquatable<TValue>
where TValueLattice : ILattice<TValue>
{
Expand Down Expand Up @@ -85,7 +85,7 @@ public bool TryGetHoistedLocal (LocalKey key, [NotNullWhen (true)] out TValue? v
=> (value = HoistedLocals.Get (key).MaybeValue) != null;
}

public struct InterproceduralStateLattice<TValue, TValueLattice> : ILattice<InterproceduralState<TValue, TValueLattice>>
internal struct InterproceduralStateLattice<TValue, TValueLattice> : ILattice<InterproceduralState<TValue, TValueLattice>>
where TValue : struct, IEquatable<TValue>
where TValueLattice : ILattice<TValue>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace ILLink.RoslynAnalyzer.DataFlow
// It substitutes type arguments into the generic forward dataflow analysis,
// creating a simpler abstraction that can track the values of local variables using Roslyn APIs.
// The kinds of values tracked are still left as unspecified generic parameters TValue and TLattice.
public abstract class LocalDataFlowAnalysis<TValue, TContext, TLattice, TContextLattice, TTransfer, TConditionValue>
internal abstract class LocalDataFlowAnalysis<TValue, TContext, TLattice, TContextLattice, TTransfer, TConditionValue>
: ForwardDataFlowAnalysis<
LocalStateAndContext<TValue, TContext>,
LocalDataFlowState<TValue, TContext, TLattice, TContextLattice>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace ILLink.RoslynAnalyzer.DataFlow
{
public class LocalDataFlowState<TValue, TContext, TValueLattice, TContextLattice>
internal sealed class LocalDataFlowState<TValue, TContext, TValueLattice, TContextLattice>
: IDataFlowState<LocalStateAndContext<TValue, TContext>, LocalStateAndContextLattice<TValue, TContext, TValueLattice, TContextLattice>>
where TValue : struct, IEquatable<TValue>
where TContext : struct, IEquatable<TContext>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace ILLink.RoslynAnalyzer.DataFlow
// - field
// - parameter
// - method return
public abstract class LocalDataFlowVisitor<TValue, TContext, TValueLattice, TContextLattice, TConditionValue> :
internal abstract class LocalDataFlowVisitor<TValue, TContext, TValueLattice, TContextLattice, TConditionValue> :
OperationWalker<LocalDataFlowState<TValue, TContext, TValueLattice, TContextLattice>, TValue>,
ITransfer<
BlockProxy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace ILLink.RoslynAnalyzer.DataFlow
{
// A lattice value that holds both a local state, and a context
public struct LocalStateAndContext<TValue, TContext> : IEquatable<LocalStateAndContext<TValue, TContext>>
internal struct LocalStateAndContext<TValue, TContext> : IEquatable<LocalStateAndContext<TValue, TContext>>
where TValue : IEquatable<TValue>
where TContext : IEquatable<TContext>
{
Expand All @@ -28,7 +28,7 @@ public bool Equals (LocalStateAndContext<TValue, TContext> other) =>
public override int GetHashCode () => HashUtils.Combine (LocalState, Context);
}

public readonly struct LocalStateAndContextLattice<TValue, TContext, TValueLattice, TContextLattice> : ILattice<LocalStateAndContext<TValue, TContext>>
internal readonly struct LocalStateAndContextLattice<TValue, TContext, TValueLattice, TContextLattice> : ILattice<LocalStateAndContext<TValue, TContext>>
where TValue : struct, IEquatable<TValue>
where TContext : struct, IEquatable<TContext>
where TValueLattice : ILattice<TValue>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public override string ToString ()
}
}

public struct LocalState<TValue> : IEquatable<LocalState<TValue>>
internal struct LocalState<TValue> : IEquatable<LocalState<TValue>>
where TValue : IEquatable<TValue>
{
public DefaultValueDictionary<LocalKey, TValue> Dictionary;
Expand Down Expand Up @@ -78,7 +78,7 @@ public override int GetHashCode ()
}

// Wrapper struct exists purely to substitute a concrete LocalKey for TKey of DictionaryLattice
public readonly struct LocalStateLattice<TValue, TValueLattice> : ILattice<LocalState<TValue>>
internal readonly struct LocalStateLattice<TValue, TValueLattice> : ILattice<LocalState<TValue>>
where TValue : struct, IEquatable<TValue>
where TValueLattice : ILattice<TValue>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static DiagnosticDescriptor GetDiagnosticDescriptor (DiagnosticId diagnos
diagnosticId.GetHelpUri());
}

public static DiagnosticDescriptor GetDiagnosticDescriptor (DiagnosticId diagnosticId, DiagnosticString diagnosticString)
internal static DiagnosticDescriptor GetDiagnosticDescriptor (DiagnosticId diagnosticId, DiagnosticString diagnosticString)
=> new DiagnosticDescriptor (diagnosticId.AsString (),
diagnosticString.GetTitle (),
diagnosticString.GetMessage (),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace ILLink.RoslynAnalyzer.TrimAnalysis
{
public readonly record struct FeatureCheckReturnValuePattern
internal readonly record struct FeatureCheckReturnValuePattern
{
public FeatureChecksValue ReturnValue { get; init; }
public ValueSet<string> FeatureCheckAnnotations { get; init; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace ILLink.RoslynAnalyzer.TrimAnalysis
{
public static class SingleValueExtensions
internal static class SingleValueExtensions
{
public static SingleValue? FromTypeSymbol (ITypeSymbol type)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace ILLink.RoslynAnalyzer.TrimAnalysis
{
public readonly record struct TrimAnalysisAssignmentPattern
internal readonly record struct TrimAnalysisAssignmentPattern
{
public MultiValue Source { get; init; }
public MultiValue Target { get; init; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace ILLink.RoslynAnalyzer.TrimAnalysis
{
public readonly record struct TrimAnalysisFieldAccessPattern
internal readonly record struct TrimAnalysisFieldAccessPattern
{
public IFieldSymbol Field { get; init; }
public IFieldReferenceOperation Operation { get; init; }
Expand All @@ -31,7 +31,6 @@ public TrimAnalysisFieldAccessPattern (
}

public TrimAnalysisFieldAccessPattern Merge (
ValueSetLattice<SingleValue> lattice,
FeatureContextLattice featureContextLattice,
TrimAnalysisFieldAccessPattern other)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace ILLink.RoslynAnalyzer.TrimAnalysis
{
public readonly record struct TrimAnalysisGenericInstantiationPattern
internal readonly record struct TrimAnalysisGenericInstantiationPattern
{
public ISymbol GenericInstantiation { get; init; }
public IOperation Operation { get; init; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace ILLink.RoslynAnalyzer.TrimAnalysis
{
public readonly record struct TrimAnalysisMethodCallPattern
internal readonly record struct TrimAnalysisMethodCallPattern
{
public IMethodSymbol CalledMethod { get; init; }
public MultiValue Instance { get; init; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace ILLink.RoslynAnalyzer.TrimAnalysis
{
public readonly struct TrimAnalysisPatternStore
internal readonly struct TrimAnalysisPatternStore
{
readonly Dictionary<(IOperation, bool), TrimAnalysisAssignmentPattern> AssignmentPatterns;
readonly Dictionary<IOperation, TrimAnalysisFieldAccessPattern> FieldAccessPatterns;
Expand Down Expand Up @@ -60,7 +60,7 @@ public void Add (TrimAnalysisFieldAccessPattern pattern)
return;
}

FieldAccessPatterns[pattern.Operation] = pattern.Merge (Lattice, FeatureContextLattice, existingPattern);
FieldAccessPatterns[pattern.Operation] = pattern.Merge (FeatureContextLattice, existingPattern);
}

public void Add (TrimAnalysisGenericInstantiationPattern pattern)
Expand Down Expand Up @@ -90,7 +90,7 @@ public void Add (TrimAnalysisReflectionAccessPattern pattern)
return;
}

ReflectionAccessPatterns[pattern.Operation] = pattern.Merge (Lattice, FeatureContextLattice, existingPattern);
ReflectionAccessPatterns[pattern.Operation] = pattern.Merge (FeatureContextLattice, existingPattern);
}

public void Add (FeatureCheckReturnValuePattern pattern)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace ILLink.RoslynAnalyzer.TrimAnalysis
{
public readonly record struct TrimAnalysisReflectionAccessPattern
internal readonly record struct TrimAnalysisReflectionAccessPattern
{
public IMethodSymbol ReferencedMethod { get; init; }
public IOperation Operation { get; init; }
Expand All @@ -30,7 +30,6 @@ public TrimAnalysisReflectionAccessPattern (
}

public TrimAnalysisReflectionAccessPattern Merge (
ValueSetLattice<SingleValue> lattice,
FeatureContextLattice featureContextLattice,
TrimAnalysisReflectionAccessPattern other)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

namespace ILLink.RoslynAnalyzer.TrimAnalysis
{
public class TrimAnalysisVisitor : LocalDataFlowVisitor<
internal sealed class TrimAnalysisVisitor : LocalDataFlowVisitor<
MultiValue,
FeatureContext,
ValueSetLattice<SingleValue>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

namespace ILLink.RoslynAnalyzer.TrimAnalysis
{
public class TrimDataFlowAnalysis : LocalDataFlowAnalysis<
internal sealed class TrimDataFlowAnalysis : LocalDataFlowAnalysis<
MultiValue,
FeatureContext,
ValueSetLattice<SingleValue>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace ILLink.Shared.DataFlow
// the default value, or another value. The default value is never explicitly stored in the dictionary,
// and the empty dictionary (where all possible keys have the default value) is represented without
// actually allocating a dictionary.
public struct DefaultValueDictionary<TKey, TValue> : IEquatable<DefaultValueDictionary<TKey, TValue>>,
internal struct DefaultValueDictionary<TKey, TValue> : IEquatable<DefaultValueDictionary<TKey, TValue>>,
IEnumerable<KeyValuePair<TKey, TValue>>
where TKey : IEquatable<TKey>
where TValue : IEquatable<TValue>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace ILLink.Shared.DataFlow
{
// A lattice over dictionaries where the stored values are also from a lattice.
public readonly struct DictionaryLattice<TKey, TValue, TValueLattice> : ILattice<DefaultValueDictionary<TKey, TValue>>
internal readonly struct DictionaryLattice<TKey, TValue, TValueLattice> : ILattice<DefaultValueDictionary<TKey, TValue>>
where TKey : IEquatable<TKey>
where TValue : IEquatable<TValue>
where TValueLattice : ILattice<TValue>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace ILLink.Shared.DataFlow
// A generic implementation of a forward dataflow analysis. Forward means that it flows facts
// across code in the order of execution, starting from the beginning of a method,
// and merging values from predecessors.
public abstract class ForwardDataFlowAnalysis<TValue, TState, TLattice, TBlock, TRegion, TControlFlowGraph, TTransfer, TConditionValue>
internal abstract class ForwardDataFlowAnalysis<TValue, TState, TLattice, TBlock, TRegion, TControlFlowGraph, TTransfer, TConditionValue>
where TValue : struct, IEquatable<TValue>
where TState : class, IDataFlowState<TValue, TLattice>, new()
where TLattice : ILattice<TValue>
Expand Down
Loading