Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit e02a3e1

Browse files
author
Fadi Hanna
authored
Fix read ordering bug between buckets pointer and counter (#26997) (#27009)
* Fix read ordering bug between buckets pointer and counter Use VolaiteLoad to read counter
1 parent b5d2015 commit e02a3e1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/vm/ngenhash.inl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1263,8 +1263,11 @@ DPTR(VALUE) NgenHashTable<NGEN_HASH_ARGS>::FindVolatileEntryByHash(NgenHashValue
12631263
// Since there is at least one entry there must be at least one bucket.
12641264
_ASSERTE(m_cWarmBuckets > 0);
12651265

1266+
// Compute which bucket the entry belongs in based on the hash.
1267+
DWORD dwBucket = iHash % VolatileLoad(&m_cWarmBuckets);
1268+
12661269
// Point at the first entry in the bucket chain which would contain any entries with the given hash code.
1267-
PTR_VolatileEntry pEntry = (GetWarmBuckets())[iHash % m_cWarmBuckets];
1270+
PTR_VolatileEntry pEntry = (GetWarmBuckets())[dwBucket];
12681271

12691272
// Walk the bucket chain one entry at a time.
12701273
while (pEntry)

0 commit comments

Comments
 (0)