Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable mark list optimization if we hit a per region mark list overflow (#86508) #87339

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10280,7 +10280,7 @@ static int __cdecl cmp_mark_list_item (const void* vkey, const void* vdatum)
#endif // _DEBUG

#ifdef USE_REGIONS
uint8_t** gc_heap::get_region_mark_list (uint8_t* start, uint8_t* end, uint8_t*** mark_list_end_ptr)
uint8_t** gc_heap::get_region_mark_list (BOOL& use_mark_list, uint8_t* start, uint8_t* end, uint8_t*** mark_list_end_ptr)
{
size_t region_number = get_basic_region_index_for_address (start);
size_t source_number = region_number;
Expand Down Expand Up @@ -10410,6 +10410,13 @@ void gc_heap::merge_mark_lists (size_t total_mark_list_size)

// blast this piece to the mark list
append_to_mark_list(source[lowest_source], x);
#ifdef USE_REGIONS
if (mark_list_index > mark_list_end)
{
use_mark_list = false;
return nullptr;
}
#endif //USE_REGIONS
piece_count++;

source[lowest_source] = x;
Expand All @@ -10429,6 +10436,13 @@ void gc_heap::merge_mark_lists (size_t total_mark_list_size)
}
// we're left with just one source that we copy
append_to_mark_list(source[0], source_end[0]);
#ifdef USE_REGIONS
if (mark_list_index > mark_list_end)
{
use_mark_list = false;
return nullptr;
}
#endif //USE_REGIONS
piece_count++;
}

Expand Down Expand Up @@ -10485,7 +10499,7 @@ static uint8_t** binary_search (uint8_t** left, uint8_t** right, uint8_t* e)
return a + l;
}

uint8_t** gc_heap::get_region_mark_list (uint8_t* start, uint8_t* end, uint8_t*** mark_list_end_ptr)
uint8_t** gc_heap::get_region_mark_list (BOOL& use_mark_list, uint8_t* start, uint8_t* end, uint8_t*** mark_list_end_ptr)
{
// do a binary search over the sorted marked list to find start and end of the
// mark list for this region
Expand Down Expand Up @@ -29235,7 +29249,7 @@ void gc_heap::plan_phase (int condemned_gen_number)
uint8_t** mark_list_index = nullptr;
uint8_t** mark_list_next = nullptr;
if (use_mark_list)
mark_list_next = get_region_mark_list (x, end, &mark_list_index);
mark_list_next = get_region_mark_list (use_mark_list, x, end, &mark_list_index);
#else // USE_REGIONS
assert (!marked (x));
uint8_t** mark_list_next = &mark_list[0];
Expand Down Expand Up @@ -29523,7 +29537,7 @@ void gc_heap::plan_phase (int condemned_gen_number)
current_brick = brick_of (x);
#ifdef USE_REGIONS
if (use_mark_list)
mark_list_next = get_region_mark_list (x, end, &mark_list_index);
mark_list_next = get_region_mark_list (use_mark_list, x, end, &mark_list_index);

if (should_sweep_in_plan (seg1))
{
Expand Down Expand Up @@ -29593,7 +29607,7 @@ void gc_heap::plan_phase (int condemned_gen_number)
current_brick = brick_of (x);

if (use_mark_list)
mark_list_next = get_region_mark_list (x, end, &mark_list_index);
mark_list_next = get_region_mark_list (use_mark_list, x, end, &mark_list_index);

if (should_sweep_in_plan (seg1))
{
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/gc/gcpriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -3433,7 +3433,7 @@ class gc_heap

#ifdef USE_REGIONS
PER_HEAP
uint8_t** get_region_mark_list (uint8_t* start, uint8_t* end, uint8_t*** mark_list_end);
uint8_t** get_region_mark_list (BOOL& use_mark_list, uint8_t* start, uint8_t* end, uint8_t*** mark_list_end);
#endif //USE_REGIONS

#ifdef BACKGROUND_GC
Expand Down
Loading