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

Fix issues with verify_regions, clear_batch_mark_array_bits. #63798

Merged
merged 3 commits into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
30 changes: 20 additions & 10 deletions src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10914,8 +10914,12 @@ void gc_heap::clear_batch_mark_array_bits (uint8_t* start, uint8_t* end)

if (startwrd == endwrd)
{
unsigned int wrd = firstwrd | lastwrd;
mark_array[startwrd] &= wrd;
assert (startbit <= endbit);
if (endbit)
{
unsigned int wrd = firstwrd | lastwrd;
mark_array[startwrd] &= wrd;
}
return;
}

Expand Down Expand Up @@ -29701,7 +29705,7 @@ void gc_heap::thread_final_regions (bool compact_p)
}
}

verify_regions (true);
verify_regions (true, false);
}

void gc_heap::thread_start_region (generation* gen, heap_segment* region)
Expand Down Expand Up @@ -29752,7 +29756,7 @@ heap_segment* gc_heap::get_new_region (int gen_number, size_t size)
heap_segment_next (generation_tail_region (gen)) = new_region;
generation_tail_region (gen) = new_region;

verify_regions (gen_number, false);
verify_regions (gen_number, false, settings.concurrent);
}

return new_region;
Expand Down Expand Up @@ -29815,7 +29819,7 @@ void gc_heap::update_start_tail_regions (generation* gen,
(size_t)prev_region, heap_segment_mem (prev_region)));
}

verify_regions (false);
verify_regions (false, settings.concurrent);
}

// There's one complication with deciding whether we can make a region SIP or not - if the plan_gen_num of
Expand Down Expand Up @@ -42103,7 +42107,7 @@ gc_heap::verify_free_lists ()
}
}

void gc_heap::verify_regions (int gen_number, bool can_verify_gen_num)
void gc_heap::verify_regions (int gen_number, bool can_verify_gen_num, bool can_verify_tail)
{
#ifdef USE_REGIONS
// For the given generation, verify that
Expand Down Expand Up @@ -42166,7 +42170,7 @@ void gc_heap::verify_regions (int gen_number, bool can_verify_gen_num)
FATAL_GC_ERROR();
}

if (tail_region != prev_region_in_gen)
if (can_verify_tail && (tail_region != prev_region_in_gen))
{
dprintf (REGIONS_LOG, ("h%d gen%d tail region is %Ix(%Ix), diff from last region %Ix(%Ix)!!",
heap_number, gen_number,
Expand All @@ -42177,12 +42181,18 @@ void gc_heap::verify_regions (int gen_number, bool can_verify_gen_num)
#endif //USE_REGIONS
}

void gc_heap::verify_regions (bool can_verify_gen_num)
inline bool is_user_alloc_gen (int gen_number)
{
return ((gen_number == soh_gen0) || (gen_number == loh_generation) || (gen_number == poh_generation));
}

void gc_heap::verify_regions (bool can_verify_gen_num, bool concurrent_p)
{
#ifdef USE_REGIONS
for (int i = 0; i < total_generation_count; i++)
{
verify_regions (i, can_verify_gen_num);
bool can_verify_tail = (concurrent_p ? !is_user_alloc_gen (i) : true);
verify_regions (i, can_verify_gen_num, can_verify_tail);
}
#endif //USE_REGIONS
}
Expand Down Expand Up @@ -42313,7 +42323,7 @@ void gc_heap::verify_heap (BOOL begin_gc_p)
//verify that the generation structures makes sense
{
#ifdef USE_REGIONS
verify_regions (true);
verify_regions (true, settings.concurrent);
#else //USE_REGIONS
generation* gen = generation_of (max_generation);

Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/gc/gcpriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1286,9 +1286,9 @@ class gc_heap
PER_HEAP
void verify_free_lists();
PER_HEAP
void verify_regions (int gen_number, bool can_verify_gen_num);
void verify_regions (int gen_number, bool can_verify_gen_num, bool can_verify_tail);
PER_HEAP
void verify_regions (bool can_verify_gen_num);
void verify_regions (bool can_verify_gen_num, bool concurrent_p);
PER_HEAP_ISOLATED
void enter_gc_lock_for_verify_heap();
PER_HEAP_ISOLATED
Expand Down