Skip to content

Commit

Permalink
Use HashSet instead of List for _virtual_methods (#2976)
Browse files Browse the repository at this point in the history
* Use a HashSet instead of List for MarkStep._virtual_methods
  • Loading branch information
jtschuster committed Aug 16, 2022
1 parent 6b5bc03 commit 6252a21
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/linker/Linker.Steps/MarkStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected LinkContext Context {
}

protected Queue<(MethodDefinition, DependencyInfo, MessageOrigin)> _methods;
protected List<(MethodDefinition, MarkScopeStack.Scope)> _virtual_methods;
protected HashSet<(MethodDefinition, MarkScopeStack.Scope)> _virtual_methods;
protected Queue<AttributeProviderPair> _assemblyLevelAttributes;
readonly List<AttributeProviderPair> _ivt_attributes;
protected Queue<(AttributeProviderPair, DependencyInfo, MarkScopeStack.Scope)> _lateMarkedAttributes;
Expand Down Expand Up @@ -224,7 +224,7 @@ internal DynamicallyAccessedMembersTypeHierarchy DynamicallyAccessedMembersTypeH
public MarkStep ()
{
_methods = new Queue<(MethodDefinition, DependencyInfo, MessageOrigin)> ();
_virtual_methods = new List<(MethodDefinition, MarkScopeStack.Scope)> ();
_virtual_methods = new HashSet<(MethodDefinition, MarkScopeStack.Scope)> ();
_assemblyLevelAttributes = new Queue<AttributeProviderPair> ();
_ivt_attributes = new List<AttributeProviderPair> ();
_lateMarkedAttributes = new Queue<(AttributeProviderPair, DependencyInfo, MarkScopeStack.Scope)> ();
Expand Down Expand Up @@ -3352,7 +3352,6 @@ void MarkBaseMethods (MethodDefinition method)
if (base_method.DeclaringType.IsInterface && !method.DeclaringType.IsInterface) {
// These are all virtual, no need to check IsVirtual before adding to list
_virtual_methods.Add ((base_method, ScopeStack.CurrentScope));
// _virtual_methods is a list and might have duplicates, but it's mostly just used for override validation, so it shouldn't matter
continue;
}

Expand Down

0 comments on commit 6252a21

Please sign in to comment.