From 1bb2fb9d38a0ee0367ebf166468d410097b4b48c Mon Sep 17 00:00:00 2001 From: Jackson Schuster Date: Mon, 15 Aug 2022 17:02:03 -0700 Subject: [PATCH 1/2] Use HashSet instead of List for _virtual_methods --- src/linker/Linker.Steps/MarkStep.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/linker/Linker.Steps/MarkStep.cs b/src/linker/Linker.Steps/MarkStep.cs index 66733c12a402..638029a10d80 100644 --- a/src/linker/Linker.Steps/MarkStep.cs +++ b/src/linker/Linker.Steps/MarkStep.cs @@ -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 _assemblyLevelAttributes; readonly List _ivt_attributes; protected Queue<(AttributeProviderPair, DependencyInfo, MarkScopeStack.Scope)> _lateMarkedAttributes; @@ -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 (); _ivt_attributes = new List (); _lateMarkedAttributes = new Queue<(AttributeProviderPair, DependencyInfo, MarkScopeStack.Scope)> (); From 12b2ccef06a721648a9f8f2860a3d80588fc0c5b Mon Sep 17 00:00:00 2001 From: Jackson Schuster Date: Mon, 15 Aug 2022 17:12:49 -0700 Subject: [PATCH 2/2] Remove comment about _virtual_methods being a List --- src/linker/Linker.Steps/MarkStep.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/linker/Linker.Steps/MarkStep.cs b/src/linker/Linker.Steps/MarkStep.cs index 638029a10d80..81b4b5909001 100644 --- a/src/linker/Linker.Steps/MarkStep.cs +++ b/src/linker/Linker.Steps/MarkStep.cs @@ -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; }