Fix #16402 (#16406)
authorSteve MacLean <sdmaclea.qdt@qualcommdatacenter.com>
Sat, 17 Feb 2018 16:15:34 +0000 (11:15 -0500)
committerJan Kotas <jkotas@microsoft.com>
Sat, 17 Feb 2018 16:15:34 +0000 (06:15 -1000)
* Handle matching null binder

* Early out HashMap::Rehash()

src/vm/assemblyspec.cpp
src/vm/hash.cpp

index 7f2829d..8d3f76f 100644 (file)
@@ -792,9 +792,9 @@ BOOL AreSameBinderInstance(ICLRPrivBinder *pBinderA, ICLRPrivBinder *pBinderB)
 {
     LIMITED_METHOD_CONTRACT;
     
-    BOOL fIsSameInstance = FALSE;
+    BOOL fIsSameInstance = (pBinderA == pBinderB);
     
-    if ((pBinderA != NULL) && (pBinderB != NULL))
+    if (!fIsSameInstance && (pBinderA != NULL) && (pBinderB != NULL))
     {
         // Get the ID for the first binder
         UINT_PTR binderIDA = 0, binderIDB = 0;
index 6b6b213..20eddfd 100644 (file)
@@ -878,9 +878,18 @@ void HashMap::Rehash()
     _ASSERTE (OwnLock());
 #endif
 
-    DWORD cbNewSize = g_rgPrimes[m_iPrimeIndex = NewSize()];
+    UPTR newPrimeIndex = NewSize();
 
-    ASSERT(m_iPrimeIndex < 70);
+    ASSERT(newPrimeIndex < g_rgNumPrimes);
+
+    if ((m_iPrimeIndex == newPrimeIndex) && (m_cbDeletes == 0))
+    {
+        return;
+    }
+
+    m_iPrimeIndex = newPrimeIndex;
+
+    DWORD cbNewSize = g_rgPrimes[m_iPrimeIndex];
 
     Bucket* rgBuckets = Buckets();
     UPTR cbCurrSize =   GetSize(rgBuckets);