diff options
author | Jackson Schuster <36744439+jtschuster@users.noreply.github.com> | 2022-08-16 03:39:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-16 03:39:01 +0300 |
commit | 6252a2194dd32911db2c0669fc818555687d5570 (patch) | |
tree | 0c62504002f2f51a818c0d9f7ad41c93f96a23b4 | |
parent | 6b5bc03dbc6ca0553fac7dd6f36feefe09924bb8 (diff) |
Use HashSet instead of List for _virtual_methods (#2976)
* Use a HashSet instead of List for MarkStep._virtual_methods
-rw-r--r-- | src/linker/Linker.Steps/MarkStep.cs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/linker/Linker.Steps/MarkStep.cs b/src/linker/Linker.Steps/MarkStep.cs index 66733c12a..81b4b5909 100644 --- a/src/linker/Linker.Steps/MarkStep.cs +++ b/src/linker/Linker.Steps/MarkStep.cs @@ -59,7 +59,7 @@ namespace Mono.Linker.Steps } 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; @@ -224,7 +224,7 @@ namespace Mono.Linker.Steps 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)> (); @@ -3352,7 +3352,6 @@ namespace Mono.Linker.Steps 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; } |