Skip to content

Commit f80b057

Browse files
authored
Fix call to GcWeakPtrScanBySingleThread (#47225)
When running with MARK_LIST not defined, I noticed a crash due an incorrect #ifdef, which caused GcWeakPtrScanBySingleThread to be executed by multiple threads. The #endif is in the wrong place - we didn't notice because we usually have MARK_LIST defined.
1 parent 3c2cdac commit f80b057

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/coreclr/gc/gc.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23108,11 +23108,13 @@ void gc_heap::mark_phase (int condemned_gen_number, BOOL mark_only_p)
2310823108
// null out the target of long weakref that were not promoted.
2310923109
GCScan::GcWeakPtrScan (GCHeap::Promote, condemned_gen_number, max_generation, &sc);
2311023110

23111-
#if defined(MULTIPLE_HEAPS) && defined(MARK_LIST)
23111+
#ifdef MULTIPLE_HEAPS
23112+
#ifdef MARK_LIST
2311223113
size_t total_mark_list_size = sort_mark_list();
2311323114
// first thread to finish sorting will scan the sync syncblk cache
23115+
#endif //MARK_LIST
2311423116
if ((syncblock_scan_p == 0) && (Interlocked::Increment(&syncblock_scan_p) == 1))
23115-
#endif //MULTIPLE_HEAPS && MARK_LIST
23117+
#endif //MULTIPLE_HEAPS
2311623118
{
2311723119
// scan for deleted entries in the syncblk cache
2311823120
GCScan::GcWeakPtrScanBySingleThread(condemned_gen_number, max_generation, &sc);

0 commit comments

Comments
 (0)