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

Fixed a WKS specific issue by not clobbering the heap_segment_saved_allocated #72923

Merged
merged 2 commits into from
Aug 1, 2022
Merged
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
21 changes: 16 additions & 5 deletions src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28151,6 +28151,16 @@ void gc_heap::add_plug_in_condemned_info (generation* gen, size_t plug_size)
}
#endif //FEATURE_EVENT_TRACE

inline void save_allocated(heap_segment* seg)
{
#ifndef MULTIPLE_HEAP
if (!heap_segment_saved_allocated(seg))
#endif // !MULTIPLE_HEAP
{
heap_segment_saved_allocated (seg) = heap_segment_allocated (seg);
}
}

#ifdef _PREFAST_
#pragma warning(push)
#pragma warning(disable:21000) // Suppress PREFast warning about overly large function
Expand Down Expand Up @@ -28236,6 +28246,7 @@ void gc_heap::plan_phase (int condemned_gen_number)
heap_segment* fseg = seg;
do
{
heap_segment_saved_allocated(seg) = 0;
if (in_range_for_segment (slow, seg))
{
uint8_t* start_unmarked = 0;
Expand Down Expand Up @@ -28283,7 +28294,7 @@ void gc_heap::plan_phase (int condemned_gen_number)
bgc_clear_batch_mark_array_bits ((shigh + Align (size (shigh))), heap_segment_allocated (seg));
}
#endif //BACKGROUND_GC
heap_segment_saved_allocated (seg) = heap_segment_allocated (seg);
save_allocated(seg);
heap_segment_allocated (seg) = shigh + Align (size (shigh));
}
// test if the segment is in the range of [slow, shigh]
Expand All @@ -28302,7 +28313,7 @@ void gc_heap::plan_phase (int condemned_gen_number)
#endif //USE_REGIONS
}
#endif //BACKGROUND_GC
heap_segment_saved_allocated (seg) = heap_segment_allocated (seg);
save_allocated(seg);
// shorten it to minimum
heap_segment_allocated (seg) = heap_segment_mem (seg);
}
Expand Down Expand Up @@ -28336,7 +28347,7 @@ void gc_heap::plan_phase (int condemned_gen_number)
bgc_clear_batch_mark_array_bits (start_unmarked, heap_segment_allocated (seg));
}
#endif //BACKGROUND_GC
heap_segment_saved_allocated (seg) = heap_segment_allocated (seg);
save_allocated(seg);
heap_segment_allocated (seg) = start_unmarked;

seg = heap_segment_next_rw (seg);
Expand Down Expand Up @@ -28619,7 +28630,7 @@ void gc_heap::plan_phase (int condemned_gen_number)
#endif //USE_REGIONS
{
assert (heap_segment_allocated (seg1) == end);
heap_segment_saved_allocated (seg1) = heap_segment_allocated (seg1);
save_allocated(seg1);
heap_segment_allocated (seg1) = plug_end;
current_brick = update_brick_table (tree, current_brick, x, plug_end);
dprintf (REGIONS_LOG, ("region %Ix-%Ix(%Ix) non SIP",
Expand Down Expand Up @@ -30897,7 +30908,7 @@ void gc_heap::sweep_region_in_plan (heap_segment* region,
#endif //_DEBUG

assert (last_marked_obj_end);
heap_segment_saved_allocated (region) = heap_segment_allocated (region);
save_allocated(region);
heap_segment_allocated (region) = last_marked_obj_end;
heap_segment_plan_allocated (region) = heap_segment_allocated (region);

Expand Down