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

Report SIP survivors #67940

Merged
merged 2 commits into from
Apr 14, 2022
Merged

Report SIP survivors #67940

merged 2 commits into from
Apr 14, 2022

Conversation

cshung
Copy link
Member

@cshung cshung commented Apr 13, 2022

This change is intended to complete the work missed in #67889.
Regions swept in the plan phase can have survivors too, so we must also report them.

@cshung cshung self-assigned this Apr 13, 2022
@ghost
Copy link

ghost commented Apr 13, 2022

Tagging subscribers to this area: @dotnet/gc
See info in area-owners.md if you want to be subscribed.

Issue Details

This change is intended to complete the work missed in #67889.
Regions swept in the plan phase can have survivors too, so we must also report them.

Author: cshung
Assignees: cshung
Labels:

area-GC-coreclr

Milestone: -

@cshung cshung changed the title [WIP] Report SIP survivors Report SIP survivors Apr 13, 2022
@Maoni0
Copy link
Member

Maoni0 commented Apr 14, 2022

I've written this in a slightly different way, let me know what you think. the idea is we form the start of a plug (if it hasn't been set) when we see a non free object , and end a plug when we see a free object. I think this code seems to convey that idea a bit more intuitively.

heap_segment* gc_heap::walk_relocation_sip (heap_segment* current_heap_segment, void* profiling_context, record_surv_fn fn)
{
    while (current_heap_segment && 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)
        {
            if (((CObjectHeader*)obj)->IsFree())
            {
                if (plug_start)
                {
                    fn (plug_start, obj, 0, profiling_context, false, false);
                    plug_start = nullptr;
                }
            }
            else
            {
                if (!plug_start) 
                {
                    plug_start = obj;
                }
            }

            obj += Align (size (obj));
        }
        if (plug_start)
        {
            fn (plug_start, end, 0, profiling_context, false, false);
        }
        current_heap_segment = heap_segment_next_rw (current_heap_segment);
    }
    return current_heap_segment;
}

@cshung cshung merged commit 23c22ce into dotnet:main Apr 14, 2022
@cshung cshung deleted the public/report-sip-survivors branch April 14, 2022 22:01
@ghost ghost locked as resolved and limited conversation to collaborators May 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants