未验证 提交 62cb5f1e 编写于 作者: P Peter Sollich 提交者: GitHub

Issue was that if a BGC thread handles a mark stack overflow, but runs into...

Issue was that if a BGC thread handles a mark stack overflow, but runs into yet another mark stack overflow on another heap, we set a flag on the region, and the containing heap. However, the BGC handling the other heap may have already decided to move on, and may thus not see the flag. (#74571)

Fix is to set the flag on the heap doing the scan rather than the heap containing the object causing the mark stack stack overflow. The thread handling that heap will indeed recheck the flag and rescan if necessary. This necessitates another change because in the concurrent case, we need each BGC thread to enter mark stack overflow scanning if there was a mark stack overflow on its heap. So we need to propagate the per-heap flag to all the heaps.

Fixed another issue for regions where the small_object_segments local variable in background_process_mark_overflow_internal would be set incorrectly in the non-concurrent case. It would be set to FALSE as soon as all the regions for gen 0 are processed.
上级 e94c2368
......@@ -24659,12 +24659,7 @@ void gc_heap::set_background_overflow_p (uint8_t* oo)
heap_segment* overflow_region = get_region_info_for_address (oo);
overflow_region->flags |= heap_segment_flags_overflow;
dprintf (3,("setting overflow flag for region %p", heap_segment_mem (overflow_region)));
#ifdef MULTIPLE_HEAPS
gc_heap* overflow_heap = heap_segment_heap (overflow_region);
#else
gc_heap* overflow_heap = nullptr;
#endif
overflow_heap->background_overflow_p = TRUE;
background_overflow_p = TRUE;
}
#endif //USE_REGIONS
......@@ -25311,13 +25306,13 @@ void gc_heap::background_process_mark_overflow_internal (uint8_t* min_add, uint8
dprintf (2, ("h%d: SOH: ov-mo: %Id", heap_number, total_marked_objects));
fire_overflow_event (min_add, max_add, total_marked_objects, i);
if (small_object_segments)
if (i >= soh_gen2)
{
concurrent_print_time_delta (concurrent_p ? "Cov SOH" : "Nov SOH");
small_object_segments = FALSE;
}
total_marked_objects = 0;
small_object_segments = FALSE;
}
}
}
......@@ -33983,23 +33978,35 @@ void gc_heap::background_scan_dependent_handles (ScanContext *sc)
if (!s_fScanRequired)
{
#ifndef USE_REGIONS
#ifdef USE_REGIONS
BOOL all_heaps_background_overflow_p = FALSE;
#else //USE_REGIONS
uint8_t* all_heaps_max = 0;
uint8_t* all_heaps_min = MAX_PTR;
#endif //USE_REGIONS
int i;
for (i = 0; i < n_heaps; i++)
{
#ifdef USE_REGIONS
// in the regions case, compute the OR of all the per-heap flags
if (g_heaps[i]->background_overflow_p)
all_heaps_background_overflow_p = TRUE;
#else //USE_REGIONS
if (all_heaps_max < g_heaps[i]->background_max_overflow_address)
all_heaps_max = g_heaps[i]->background_max_overflow_address;
if (all_heaps_min > g_heaps[i]->background_min_overflow_address)
all_heaps_min = g_heaps[i]->background_min_overflow_address;
#endif //USE_REGIONS
}
for (i = 0; i < n_heaps; i++)
{
#ifdef USE_REGIONS
g_heaps[i]->background_overflow_p = all_heaps_background_overflow_p;
#else //USE_REGIONS
g_heaps[i]->background_max_overflow_address = all_heaps_max;
g_heaps[i]->background_min_overflow_address = all_heaps_min;
#endif //USE_REGIONS
}
#endif //!USE_REGIONS
}
dprintf(2, ("Starting all gc thread mark stack overflow processing"));
......@@ -34743,15 +34750,24 @@ void gc_heap::background_mark_phase ()
enable_preemptive ();
#if defined(MULTIPLE_HEAPS) && !defined(USE_REGIONS)
#if defined(MULTIPLE_HEAPS)
bgc_t_join.join(this, gc_join_concurrent_overflow);
if (bgc_t_join.joined())
{
#ifdef USE_REGIONS
BOOL all_heaps_background_overflow_p = FALSE;
#else //USE_REGIONS
uint8_t* all_heaps_max = 0;
uint8_t* all_heaps_min = MAX_PTR;
#endif //USE_REGIONS
int i;
for (i = 0; i < n_heaps; i++)
{
#ifdef USE_REGIONS
// in the regions case, compute the OR of all the per-heap flags
if (g_heaps[i]->background_overflow_p)
all_heaps_background_overflow_p = TRUE;
#else //USE_REGIONS
dprintf (3, ("heap %d overflow max is %Ix, min is %Ix",
i,
g_heaps[i]->background_max_overflow_address,
......@@ -34760,17 +34776,21 @@ void gc_heap::background_mark_phase ()
all_heaps_max = g_heaps[i]->background_max_overflow_address;
if (all_heaps_min > g_heaps[i]->background_min_overflow_address)
all_heaps_min = g_heaps[i]->background_min_overflow_address;
#endif //USE_REGIONS
}
for (i = 0; i < n_heaps; i++)
{
#ifdef USE_REGIONS
g_heaps[i]->background_overflow_p = all_heaps_background_overflow_p;
#else //USE_REGIONS
g_heaps[i]->background_max_overflow_address = all_heaps_max;
g_heaps[i]->background_min_overflow_address = all_heaps_min;
#endif //USE_REGIONS
}
dprintf(3, ("Starting all bgc threads after updating the overflow info"));
bgc_t_join.restart();
}
#endif //MULTIPLE_HEAPS && !USE_REGIONS
#endif //MULTIPLE_HEAPS
disable_preemptive (true);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册