Skip to content

Commit 6252a21

Browse files
authored
Use HashSet instead of List for _virtual_methods (#2976)
* Use a HashSet instead of List for MarkStep._virtual_methods
1 parent 6b5bc03 commit 6252a21

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/linker/Linker.Steps/MarkStep.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ protected LinkContext Context {
5959
}
6060

6161
protected Queue<(MethodDefinition, DependencyInfo, MessageOrigin)> _methods;
62-
protected List<(MethodDefinition, MarkScopeStack.Scope)> _virtual_methods;
62+
protected HashSet<(MethodDefinition, MarkScopeStack.Scope)> _virtual_methods;
6363
protected Queue<AttributeProviderPair> _assemblyLevelAttributes;
6464
readonly List<AttributeProviderPair> _ivt_attributes;
6565
protected Queue<(AttributeProviderPair, DependencyInfo, MarkScopeStack.Scope)> _lateMarkedAttributes;
@@ -224,7 +224,7 @@ internal DynamicallyAccessedMembersTypeHierarchy DynamicallyAccessedMembersTypeH
224224
public MarkStep ()
225225
{
226226
_methods = new Queue<(MethodDefinition, DependencyInfo, MessageOrigin)> ();
227-
_virtual_methods = new List<(MethodDefinition, MarkScopeStack.Scope)> ();
227+
_virtual_methods = new HashSet<(MethodDefinition, MarkScopeStack.Scope)> ();
228228
_assemblyLevelAttributes = new Queue<AttributeProviderPair> ();
229229
_ivt_attributes = new List<AttributeProviderPair> ();
230230
_lateMarkedAttributes = new Queue<(AttributeProviderPair, DependencyInfo, MarkScopeStack.Scope)> ();
@@ -3352,7 +3352,6 @@ void MarkBaseMethods (MethodDefinition method)
33523352
if (base_method.DeclaringType.IsInterface && !method.DeclaringType.IsInterface) {
33533353
// These are all virtual, no need to check IsVirtual before adding to list
33543354
_virtual_methods.Add ((base_method, ScopeStack.CurrentScope));
3355-
// _virtual_methods is a list and might have duplicates, but it's mostly just used for override validation, so it shouldn't matter
33563355
continue;
33573356
}
33583357

0 commit comments

Comments
 (0)