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

Doubly linked freelist fix #44585

Merged
merged 10 commits into from
Nov 13, 2020
17 changes: 13 additions & 4 deletions src/coreclr/src/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34133,10 +34133,19 @@ CObjectHeader* gc_heap::allocate_uoh_object (size_t jsize, uint32_t flags, int g
//mark the new block specially so we know it is a new object
if ((result < current_highest_address) && (result >= current_lowest_address))
{
dprintf (3, ("Setting mark bit at address %Ix",
(size_t)(&mark_array [mark_word_of (result)])));
#ifdef DOUBLY_LINKED_FL
heap_segment* seg = seg_mapping_table_segment_of (result);
// if bgc_allocated is 0 it means it was allocated during bgc sweep,
// and since sweep does not look at this seg we cannot set the mark array bit.
uint8_t* background_allocated = heap_segment_background_allocated(seg);
if (background_allocated != 0)
#endif //DOUBLY_LINKED_FL
{
dprintf(3, ("Setting mark bit at address %Ix",
(size_t)(&mark_array[mark_word_of(result)])));

mark_array_set_marked (result);
mark_array_set_marked(result);
}
}
}
}
Expand Down Expand Up @@ -34515,7 +34524,7 @@ BOOL gc_heap::fgc_should_consider_object (uint8_t* o,
no_bgc_mark_p = TRUE;
}

dprintf (3, ("bgc mark %Ix: %s (bm: %s)", o, (no_bgc_mark_p ? "no" : "yes"), (background_object_marked (o, FALSE) ? "yes" : "no")));
dprintf (3, ("bgc mark %Ix: %s (bm: %s)", o, (no_bgc_mark_p ? "no" : "yes"), ((no_bgc_mark_p || background_object_marked (o, FALSE)) ? "yes" : "no")));
return (no_bgc_mark_p ? TRUE : background_object_marked (o, FALSE));
}

Expand Down
3 changes: 1 addition & 2 deletions src/coreclr/src/gc/gcpriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ inline void FATAL_GC_ERROR()

// We need the lower 3 bits in the MT to do our bookkeeping so doubly linked free list is only for 64-bit
#ifdef HOST_64BIT
// To be enabled.
// #define DOUBLY_LINKED_FL
#define DOUBLY_LINKED_FL
#endif //HOST_64BIT

#ifndef FEATURE_REDHAWK
Expand Down