Skip to content

Commit c1cebef

Browse files
authoredJun 10, 2024··
Optimize relocation counting in DehydratedDataNode.GetData (#103202)
1 parent 2bd1586 commit c1cebef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/DehydratedDataNode.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System;
55
using System.Collections.Generic;
6+
using System.Runtime.InteropServices;
67

78
using Internal.Runtime;
89
using Internal.Text;
@@ -74,8 +75,7 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
7475
ISymbolNode target = reloc.Target;
7576
if (target is ISymbolNodeWithLinkage withLinkage)
7677
target = withLinkage.NodeForLinkage(factory);
77-
relocOccurences.TryGetValue(target, out int num);
78-
relocOccurences[target] = ++num;
78+
CollectionsMarshal.GetValueRefOrAddDefault(relocOccurences, target, out _)++;
7979
}
8080
}
8181

0 commit comments

Comments
 (0)
Please sign in to comment.