@@ -32150,11 +32150,7 @@ void gc_heap::walk_relocation (void* profiling_context, record_surv_fn fn)
32150
32150
generation* condemned_gen = generation_of (i);
32151
32151
heap_segment* current_heap_segment = heap_segment_rw (generation_start_segment (condemned_gen));
32152
32152
#ifdef USE_REGIONS
32153
- while (current_heap_segment && heap_segment_swept_in_plan (current_heap_segment))
32154
- {
32155
- // TODO: Walk the heap segment and report the plugs.
32156
- current_heap_segment = heap_segment_next_rw (current_heap_segment);
32157
- }
32153
+ current_heap_segment = walk_relocation_sip (current_heap_segment, profiling_context, fn);
32158
32154
if (!current_heap_segment)
32159
32155
continue;
32160
32156
#endif // USE_REGIONS
@@ -32187,11 +32183,7 @@ void gc_heap::walk_relocation (void* profiling_context, record_surv_fn fn)
32187
32183
}
32188
32184
current_heap_segment = heap_segment_next_rw (current_heap_segment);
32189
32185
#ifdef USE_REGIONS
32190
- while (current_heap_segment && heap_segment_swept_in_plan (current_heap_segment))
32191
- {
32192
- // TODO: Walk the heap segment and report the plugs.
32193
- current_heap_segment = heap_segment_next_rw (current_heap_segment);
32194
- }
32186
+ current_heap_segment = walk_relocation_sip (current_heap_segment, profiling_context, fn);
32195
32187
#endif // USE_REGIONS
32196
32188
if (current_heap_segment)
32197
32189
{
@@ -32218,6 +32210,45 @@ void gc_heap::walk_relocation (void* profiling_context, record_surv_fn fn)
32218
32210
}
32219
32211
}
32220
32212
32213
+ #ifdef USE_REGIONS
32214
+ heap_segment* gc_heap::walk_relocation_sip (heap_segment* current_heap_segment, void* profiling_context, record_surv_fn fn)
32215
+ {
32216
+ while (current_heap_segment && heap_segment_swept_in_plan (current_heap_segment))
32217
+ {
32218
+ uint8_t* start = heap_segment_mem (current_heap_segment);
32219
+ uint8_t* end = heap_segment_allocated (current_heap_segment);
32220
+ uint8_t* obj = start;
32221
+ uint8_t* plug_start = nullptr;
32222
+ while (obj < end)
32223
+ {
32224
+ if (((CObjectHeader*)obj)->IsFree())
32225
+ {
32226
+ if (plug_start)
32227
+ {
32228
+ fn (plug_start, obj, 0, profiling_context, false, false);
32229
+ plug_start = nullptr;
32230
+ }
32231
+ }
32232
+ else
32233
+ {
32234
+ if (!plug_start)
32235
+ {
32236
+ plug_start = obj;
32237
+ }
32238
+ }
32239
+
32240
+ obj += Align (size (obj));
32241
+ }
32242
+ if (plug_start)
32243
+ {
32244
+ fn (plug_start, end, 0, profiling_context, false, false);
32245
+ }
32246
+ current_heap_segment = heap_segment_next_rw (current_heap_segment);
32247
+ }
32248
+ return current_heap_segment;
32249
+ }
32250
+ #endif // USE_REGIONS
32251
+
32221
32252
void gc_heap::walk_survivors (record_surv_fn fn, void* context, walk_surv_type type)
32222
32253
{
32223
32254
if (type == walk_for_gc)
0 commit comments