Skip to content

Commit

Permalink
Move sync block scan (#41600)
Browse files Browse the repository at this point in the history
This change implements some primitive work stealing by executing GCScan::GcWeakPtrScanBySingleThread on the first thread that finishes GCScan::GcWeakPtrScan and sort_mark_list.
  • Loading branch information
PeterSolMS authored Nov 26, 2020
1 parent 05cd29c commit f265abd
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/coreclr/src/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21819,11 +21819,13 @@ void gc_heap::mark_phase (int condemned_gen_number, BOOL mark_only_p)
scan_dependent_handles(condemned_gen_number, &sc, false);

#ifdef MULTIPLE_HEAPS
static VOLATILE(int32_t) syncblock_scan_p;
dprintf(3, ("Joining for weak pointer deletion"));
gc_t_join.join(this, gc_join_null_dead_long_weak);
if (gc_t_join.joined())
{
dprintf(3, ("Starting all gc thread for weak pointer deletion"));
syncblock_scan_p = 0;
gc_t_join.restart();
}
#endif //MULTIPLE_HEAPS
Expand All @@ -21838,17 +21840,21 @@ void gc_heap::mark_phase (int condemned_gen_number, BOOL mark_only_p)
// unsigned long start = GetCycleCount32();
sort_mark_list();
// printf("sort_mark_list took %u cycles\n", GetCycleCount32() - start);
// first thread to finish sorting will scan the sync syncblk cache
if ((syncblock_scan_p == 0) && (Interlocked::Increment(&syncblock_scan_p) == 1))
#endif //PARALLEL_MARK_LIST_SORT
#endif //MARK_LIST

#endif //MULTIPLE_HEAPS
{
// scan for deleted entries in the syncblk cache
GCScan::GcWeakPtrScanBySingleThread(condemned_gen_number, max_generation, &sc);
}
#ifdef MULTIPLE_HEAPS
dprintf (3, ("Joining for sync block cache entry scanning"));
gc_t_join.join(this, gc_join_null_dead_syncblk);
if (gc_t_join.joined())
#endif //MULTIPLE_HEAPS
{
// scan for deleted entries in the syncblk cache
GCScan::GcWeakPtrScanBySingleThread (condemned_gen_number, max_generation, &sc);

#ifdef MULTIPLE_HEAPS
#if defined(MARK_LIST) && !defined(PARALLEL_MARK_LIST_SORT)
//compact g_mark_list and sort it.
Expand Down

0 comments on commit f265abd

Please sign in to comment.