@@ -309,8 +309,8 @@ DPTR(VALUE) DacEnumerableHashTable<DAC_ENUM_HASH_ARGS>::BaseFindFirstEntryByHash
309
309
// +2 to skip "length" and "next" slots
310
310
DWORD dwBucket = iHash % cBuckets + SKIP_SPECIAL_SLOTS;
311
311
312
- // Point at the first entry in the bucket chain which would contain any entries with the given hash code.
313
- PTR_VolatileEntry pEntry = curBuckets[dwBucket];
312
+ // Point at the first entry in the bucket chain that stores entries with the given hash code.
313
+ PTR_VolatileEntry pEntry = VolatileLoadWithoutBarrier (& curBuckets[dwBucket]) ;
314
314
315
315
// Walk the bucket chain one entry at a time.
316
316
while (pEntry)
@@ -329,13 +329,13 @@ DPTR(VALUE) DacEnumerableHashTable<DAC_ENUM_HASH_ARGS>::BaseFindFirstEntryByHash
329
329
}
330
330
331
331
// Move to the next entry in the chain.
332
- pEntry = pEntry->m_pNextEntry ;
332
+ pEntry = VolatileLoadWithoutBarrier (& pEntry->m_pNextEntry ) ;
333
333
}
334
334
335
335
// in a rare case if resize is in progress, look in the new table as well.
336
336
// if existing entry is not in the old table, it must be in the new
337
337
// since we unlink it from old only after linking into the new.
338
- // check for next table must hapen after we looked through the current.
338
+ // check for next table must happen after we looked through the current.
339
339
VolatileLoadBarrier ();
340
340
curBuckets = GetNext (curBuckets);
341
341
} while (curBuckets != nullptr );
@@ -367,11 +367,9 @@ DPTR(VALUE) DacEnumerableHashTable<DAC_ENUM_HASH_ARGS>::BaseFindNextEntryByHash(
367
367
PTR_VolatileEntry pVolatileEntry = dac_cast<PTR_VolatileEntry>(pContext->m_pEntry );
368
368
iHash = pVolatileEntry->m_iHashValue ;
369
369
370
- // Iterate over the bucket chain.
371
- while (pVolatileEntry->m_pNextEntry )
370
+ // Iterate over the rest ot the bucket chain.
371
+ while (( pVolatileEntry = VolatileLoadWithoutBarrier (&pVolatileEntry ->m_pNextEntry )) != nullptr )
372
372
{
373
- // Advance to the next entry.
374
- pVolatileEntry = pVolatileEntry->m_pNextEntry ;
375
373
if (pVolatileEntry->m_iHashValue == iHash)
376
374
{
377
375
// Found a match on hash code. Update our find context to indicate where we got to and return
@@ -381,7 +379,7 @@ DPTR(VALUE) DacEnumerableHashTable<DAC_ENUM_HASH_ARGS>::BaseFindNextEntryByHash(
381
379
}
382
380
}
383
381
384
- // check for next table must hapen after we looked through the current.
382
+ // check for next table must happen after we looked through the current.
385
383
VolatileLoadBarrier ();
386
384
387
385
// in a case if resize is in progress, look in the new table as well.
0 commit comments