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

Don't scan bricks of frozen segments in verify_heap #76645

Merged
merged 2 commits into from
Oct 5, 2022
Merged
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
24 changes: 22 additions & 2 deletions src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44422,7 +44422,27 @@ 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
assert (!heap_segment_read_only_p (seg));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's make this FATAL_GC_ERROR too.

Suggested change
assert (!heap_segment_read_only_p (seg));
if (heap_segment_read_only_p (seg))
{
dprintf (1, ("seg %Ix is ro! Shouldn't happen with regions", (size_t)seg));
FATAL_GC_ERROR();
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ugh, no matter how many times I tried github refuses to apply this diff:
image

so I'm going to apply by hands and add you as co-authored

#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

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",
Expand Down Expand Up @@ -44470,11 +44490,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
{
Expand Down