Skip to content

Commit

Permalink
Don't scan bricks of frozen segments in verify_heap (dotnet#76645)
Browse files Browse the repository at this point in the history
Co-authored-by: Maoni0 <[email protected]>
EgorBo and Maoni0 authored Oct 5, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent fec0221 commit 2e698fb
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
@@ -44422,13 +44422,35 @@ void gc_heap::verify_heap (BOOL begin_gc_p)
uint8_t* curr_object = heap_segment_mem (seg);
uint8_t* prev_object = 0;

bool verify_bricks_p = true;
#ifdef USE_REGIONS
if (heap_segment_read_only_p(seg))
{
dprintf(1, ("seg %Ix is ro! Shouldn't happen with regions", (size_t)seg));
FATAL_GC_ERROR();
}
if (heap_segment_gen_num (seg) != heap_segment_plan_gen_num (seg))
{
dprintf (1, ("Seg %Ix, gen num is %d, plan gen num is %d",
heap_segment_mem (seg), heap_segment_gen_num (seg), heap_segment_plan_gen_num (seg)));
FATAL_GC_ERROR();
}
#else //USE_REGIONS
if (heap_segment_read_only_p(seg))
{
size_t current_brick = brick_of(max(heap_segment_mem(seg), lowest_address));
size_t end_brick = brick_of(min(heap_segment_reserved(seg), highest_address) - 1);
while (current_brick <= end_brick)
{
if (brick_table[current_brick] != 0)
{
dprintf(1, ("Verifying Heap: %Ix brick of a frozen segment is not zeroed", current_brick));
FATAL_GC_ERROR();
}
current_brick++;
}
verify_bricks_p = false;
}
#endif //USE_REGIONS

#ifdef BACKGROUND_GC
@@ -44470,11 +44492,11 @@ void gc_heap::verify_heap (BOOL begin_gc_p)
#endif //!USE_REGIONS

#ifdef USE_REGIONS
if (curr_gen_num != 0)
if (verify_bricks_p && curr_gen_num != 0)
#else
// If object is not in the youngest generation, then lets
// verify that the brick table is correct....
if (((seg != ephemeral_heap_segment) ||
if (verify_bricks_p && ((seg != ephemeral_heap_segment) ||
(brick_of(curr_object) < brick_of(begin_youngest))))
#endif //USE_REGIONS
{

0 comments on commit 2e698fb

Please sign in to comment.