diff options
author | David Wrighton <davidwr@microsoft.com> | 2017-10-07 03:42:21 +0300 |
---|---|---|
committer | David Wrighton <davidwr@microsoft.com> | 2017-10-07 03:42:21 +0300 |
commit | aa7eaba7939fbd577c686ccadb57652f7e3e3060 (patch) | |
tree | fe851d471f08ac6a73e7d874e359ca59ee0702d8 /src/ILCompiler.Compiler | |
parent | 814a48da9b896bb0021160aa1d62daf02d99cfeb (diff) |
Ensure that the IntegerLookupResult and PointerToSlotLookupResult are actually handled as singletons
- Do not re-initialize the global dictionary whenever a NodeFactory is created
[tfs-changeset: 1677563]
Diffstat (limited to 'src/ILCompiler.Compiler')
-rw-r--r-- | src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NodeFactory.GenericLookups.cs | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NodeFactory.GenericLookups.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NodeFactory.GenericLookups.cs index 8d0d3a0e1..a7649e88a 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NodeFactory.GenericLookups.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NodeFactory.GenericLookups.cs @@ -132,16 +132,6 @@ namespace ILCompiler.DependencyAnalysis { return new ConstrainedMethodUseLookupResult(constrainedMethodUse.ConstrainedMethod, constrainedMethodUse.ConstraintType, constrainedMethodUse.DirectCall); }); - - _integers = new NodeCache<int, GenericLookupResult>(integer => - { - return new IntegerLookupResult(integer); - }); - - _pointersToSlots = new NodeCache<int, GenericLookupResult>(slotIndex => - { - return new PointerToSlotLookupResult(slotIndex); - }); } private NodeCache<TypeDesc, GenericLookupResult> _typeSymbols; @@ -308,24 +298,24 @@ namespace ILCompiler.DependencyAnalysis return _constrainedMethodUses.GetOrAdd(new ConstrainedMethodUseKey(constrainedMethod, constraintType, directCall)); } - private static NodeCache<int, GenericLookupResult> _integers = new NodeCache<int, GenericLookupResult>(slotIndex => + private static NodeCache<int, GenericLookupResult> s_integers = new NodeCache<int, GenericLookupResult>(slotIndex => { - return new PointerToSlotLookupResult(slotIndex); + return new IntegerLookupResult(slotIndex); }); public static GenericLookupResult Integer(int integer) { - return _integers.GetOrAdd(integer); + return s_integers.GetOrAdd(integer); } - private static NodeCache<int, GenericLookupResult> _pointersToSlots = new NodeCache<int, GenericLookupResult>(slotIndex => + private static NodeCache<int, GenericLookupResult> s_pointersToSlots = new NodeCache<int, GenericLookupResult>(slotIndex => { return new PointerToSlotLookupResult(slotIndex); }); public static GenericLookupResult PointerToSlot(int slotIndex) { - return _pointersToSlots.GetOrAdd(slotIndex); + return s_pointersToSlots.GetOrAdd(slotIndex); } } |