Skip to content

Commit

Permalink
Revert surviving frozen segment change
Browse files Browse the repository at this point in the history
  • Loading branch information
cshung committed Jan 9, 2023
1 parent b9d0a45 commit 38c0e6e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 43 deletions.
72 changes: 31 additions & 41 deletions src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33330,10 +33330,12 @@ void gc_heap::walk_relocation (void* profiling_context, record_surv_fn fn)
for (int i = condemned_gen_number; i >= stop_gen_idx; i--)
{
generation* condemned_gen = generation_of (i);
heap_segment* current_heap_segment = generation_start_segment (condemned_gen);
current_heap_segment = walk_relocation_special_segments (current_heap_segment, profiling_context, fn);
heap_segment* current_heap_segment = heap_segment_rw (generation_start_segment (condemned_gen));
#ifdef USE_REGIONS
current_heap_segment = walk_relocation_sip (current_heap_segment, profiling_context, fn);
if (!current_heap_segment)
continue;
#endif // USE_REGIONS
uint8_t* start_address = get_soh_start_object (current_heap_segment, condemned_gen);
size_t current_brick = brick_of (start_address);

Expand All @@ -33358,8 +33360,10 @@ void gc_heap::walk_relocation (void* profiling_context, record_surv_fn fn)
&args);
args.last_plug = 0;
}
current_heap_segment = heap_segment_next (current_heap_segment);
current_heap_segment = walk_relocation_special_segments (current_heap_segment, profiling_context, fn);
current_heap_segment = heap_segment_next_rw (current_heap_segment);
#ifdef USE_REGIONS
current_heap_segment = walk_relocation_sip (current_heap_segment, profiling_context, fn);
#endif // USE_REGIONS
if (current_heap_segment)
{
current_brick = brick_of (heap_segment_mem (current_heap_segment));
Expand All @@ -33385,58 +33389,44 @@ void gc_heap::walk_relocation (void* profiling_context, record_surv_fn fn)
}
}

heap_segment* gc_heap::walk_relocation_special_segments (heap_segment* current_heap_segment, void* profiling_context, record_surv_fn fn)
#ifdef USE_REGIONS
heap_segment* gc_heap::walk_relocation_sip (heap_segment* current_heap_segment, void* profiling_context, record_surv_fn fn)
{
while (current_heap_segment)
while (current_heap_segment && heap_segment_swept_in_plan (current_heap_segment))
{
if (heap_segment_read_only_p (current_heap_segment))
{
uint8_t* start = heap_segment_mem (current_heap_segment);
uint8_t* end = heap_segment_allocated (current_heap_segment);
fn (start, end, 0, profiling_context, !!settings.compaction, false);
current_heap_segment = heap_segment_next (current_heap_segment);
}
#ifdef USE_REGIONS
else if (heap_segment_swept_in_plan (current_heap_segment))
uint8_t* start = heap_segment_mem (current_heap_segment);
uint8_t* end = heap_segment_allocated (current_heap_segment);
uint8_t* obj = start;
uint8_t* plug_start = nullptr;
while (obj < end)
{
uint8_t* start = heap_segment_mem (current_heap_segment);
uint8_t* end = heap_segment_allocated (current_heap_segment);
uint8_t* obj = start;
uint8_t* plug_start = nullptr;
while (obj < end)
if (((CObjectHeader*)obj)->IsFree())
{
if (((CObjectHeader*)obj)->IsFree())
{
if (plug_start)
{
fn (plug_start, obj, 0, profiling_context, !!settings.compaction, false);
plug_start = nullptr;
}
}
else
if (plug_start)
{
if (!plug_start)
{
plug_start = obj;
}
fn (plug_start, obj, 0, profiling_context, false, false);
plug_start = nullptr;
}

obj += Align (size (obj));
}
if (plug_start)
else
{
fn (plug_start, end, 0, profiling_context, false, false);
if (!plug_start)
{
plug_start = obj;
}
}
current_heap_segment = heap_segment_next (current_heap_segment);

obj += Align (size (obj));
}
#endif //USE_REGIONS
else
if (plug_start)
{
break;
fn (plug_start, end, 0, profiling_context, false, false);
}
current_heap_segment = heap_segment_next_rw (current_heap_segment);
}
return current_heap_segment;
}
#endif // USE_REGIONS

void gc_heap::walk_survivors (record_surv_fn fn, void* context, walk_surv_type type)
{
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/gc/gcee.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ segment_handle GCHeap::RegisterFrozenSegment(segment_info *pseginfo)
heap_segment_used(seg) = heap_segment_allocated(seg);
heap_segment_plan_allocated(seg) = 0;
#ifdef USE_REGIONS
heap_segment_gen_num(seg) = 2;
heap_segment_gen_num(seg) = max_generation;
#endif //USE_REGIONS
seg->flags = heap_segment_flags_readonly;

Expand Down
4 changes: 3 additions & 1 deletion src/coreclr/gc/gcpriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1697,8 +1697,10 @@ class gc_heap

PER_HEAP
void walk_relocation (void* profiling_context, record_surv_fn fn);
#ifdef USE_REGIONS
PER_HEAP
heap_segment* walk_relocation_special_segments (heap_segment* current_heap_segment, void* profiling_context, record_surv_fn fn);
heap_segment* walk_relocation_sip (heap_segment* current_heap_segment, void* profiling_context, record_surv_fn fn);
#endif // USE_REGIONS
PER_HEAP
void walk_relocation_in_brick (uint8_t* tree, walk_relocate_args* args);

Expand Down

0 comments on commit 38c0e6e

Please sign in to comment.