Skip to content
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
37 changes: 22 additions & 15 deletions src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4473,8 +4473,12 @@ class CObjectHeader : public Object
return ((ArrayBase *)this)->GetNumComponents();
}

void Validate(BOOL bDeep=TRUE)
void Validate(BOOL bDeep=TRUE, BOOL bVerifyNextHeader = FALSE, BOOL bVerifySyncBlock = FALSE)
{
// declaration of extra parameters just so the call site would need no #ifdefs
UNREFERENCED_PARAMETER(bVerifyNextHeader);
UNREFERENCED_PARAMETER(bVerifySyncBlock);

MethodTable * pMT = GetMethodTable();

_ASSERTE(pMT->SanityCheck());
Expand Down Expand Up @@ -45142,15 +45146,10 @@ HRESULT GCHeap::Initialize()
// GC callback functions
bool GCHeap::IsPromoted(Object* object)
{
#ifdef _DEBUG
if (object)
{
((CObjectHeader*)object)->Validate();
}
#endif //_DEBUG

uint8_t* o = (uint8_t*)object;

bool is_marked;

if (gc_heap::settings.condemned_generation == max_generation)
{
#ifdef MULTIPLE_HEAPS
Expand All @@ -45162,27 +45161,35 @@ bool GCHeap::IsPromoted(Object* object)
#ifdef BACKGROUND_GC
if (gc_heap::settings.concurrent)
{
bool is_marked = (!((o < hp->background_saved_highest_address) && (o >= hp->background_saved_lowest_address))||
is_marked = (!((o < hp->background_saved_highest_address) && (o >= hp->background_saved_lowest_address))||
hp->background_marked (o));
return is_marked;
}
else
#endif //BACKGROUND_GC
{
return (!((o < hp->highest_address) && (o >= hp->lowest_address))
|| hp->is_mark_set (o));
is_marked = (!((o < hp->highest_address) && (o >= hp->lowest_address))
|| hp->is_mark_set (o));
}
}
else
{
#ifdef USE_REGIONS
return (gc_heap::is_in_gc_range (o) ? (gc_heap::is_in_condemned_gc (o) ? gc_heap::is_mark_set (o) : true) : true);
is_marked = (gc_heap::is_in_gc_range (o) ? (gc_heap::is_in_condemned_gc (o) ? gc_heap::is_mark_set (o) : true) : true);
#else
gc_heap* hp = gc_heap::heap_of (o);
return (!((o < hp->gc_high) && (o >= hp->gc_low))
|| hp->is_mark_set (o));
is_marked = (!((o < hp->gc_high) && (o >= hp->gc_low))
|| hp->is_mark_set (o));
#endif //USE_REGIONS
}

#ifdef _DEBUG
if (o)
{
((CObjectHeader*)o)->Validate(TRUE, TRUE, is_marked);
}
#endif //_DEBUG

return is_marked;
}

size_t GCHeap::GetPromotedBytes(int heap_index)
Expand Down