Skip to content

Commit

Permalink
find_object
Browse files Browse the repository at this point in the history
Commit migrated from dotnet/coreclr@8d6583e
  • Loading branch information
Maoni0 authored and cshung committed Nov 7, 2018
1 parent 3324262 commit 1bb8d7e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 25 deletions.
55 changes: 33 additions & 22 deletions src/coreclr/src/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26099,7 +26099,7 @@ void gc_heap::background_mark_phase ()
}

void
gc_heap::suspend_EE ()
gc_heap::suspend_EE()
{
dprintf (2, ("suspend_EE"));
#ifdef MULTIPLE_HEAPS
Expand All @@ -26110,46 +26110,45 @@ gc_heap::suspend_EE ()
#endif //MULTIPLE_HEAPS
}

#ifdef MULTIPLE_HEAPS
void
gc_heap::bgc_suspend_EE ()
gc_heap::restart_EE()
{
dprintf (2, ("restart_EE"));
GCToEEInterface::RestartEE(FALSE);
}

void
gc_heap::bgc_suspend_EE()
{
#ifdef MULTIPLE_HEAPS
for (int i = 0; i < n_heaps; i++)
{
gc_heap::g_heaps[i]->reset_gc_done();
}
#else
reset_gc_done();
#endif //MULTIPLE_HEAPS

gc_started = TRUE;
dprintf (2, ("bgc_suspend_EE"));
GCToEEInterface::SuspendEE(SUSPEND_FOR_GC_PREP);
}

void
gc_heap::bgc_restart_EE()
{
gc_started = FALSE;
#ifdef MULTIPLE_HEAPS
for (int i = 0; i < n_heaps; i++)
{
gc_heap::g_heaps[i]->set_gc_done();
}
}
#else
void
gc_heap::bgc_suspend_EE ()
{
reset_gc_done();
gc_started = TRUE;
dprintf (2, ("bgc_suspend_EE"));
GCToEEInterface::SuspendEE(SUSPEND_FOR_GC_PREP);
gc_started = FALSE;
set_gc_done();
}
#endif //MULTIPLE_HEAPS

void
gc_heap::restart_EE ()
{
dprintf (2, ("restart_EE"));
#ifdef MULTIPLE_HEAPS
dprintf (2, ("bgc_restart_EE"));
GCToEEInterface::RestartEE(FALSE);
#else
GCToEEInterface::RestartEE(FALSE);
#endif //MULTIPLE_HEAPS
}

inline uint8_t* gc_heap::high_page ( heap_segment* seg, BOOL concurrent_p)
Expand Down Expand Up @@ -31280,7 +31279,7 @@ void gc_heap::background_sweep()

if (heap_number == 0)
{
restart_EE ();
bgc_restart_EE ();
}

FIRE_EVENT(BGC2ndConBegin);
Expand Down Expand Up @@ -34437,6 +34436,8 @@ GCHeap::FixAllocContext (gc_alloc_context* context, bool lockp, void* arg, void
Object*
GCHeap::GetContainingObject (void *pInteriorPtr, bool fCollectedGenOnly)
{
assert (g_fSuspensionPending > 0);

uint8_t *o = (uint8_t*)pInteriorPtr;

gc_heap* hp = gc_heap::heap_of (o);
Expand All @@ -34446,7 +34447,17 @@ GCHeap::GetContainingObject (void *pInteriorPtr, bool fCollectedGenOnly)

if (o >= lowest && o < highest)
{
if (!gc_heap::gc_started)
{
hp->fix_allocation_contexts (FALSE);
}

o = hp->find_object (o, lowest);

if (!gc_heap::gc_started)
{
hp->repair_allocation_contexts (TRUE);
}
}
else
{
Expand Down
9 changes: 6 additions & 3 deletions src/coreclr/src/gc/gcpriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2597,13 +2597,16 @@ class gc_heap
void concurrent_scan_dependent_handles (ScanContext *sc);

PER_HEAP_ISOLATED
void suspend_EE ();
void suspend_EE();

PER_HEAP_ISOLATED
void bgc_suspend_EE ();
void bgc_suspend_EE();

PER_HEAP_ISOLATED
void restart_EE ();
void restart_EE();

PER_HEAP_ISOLATED
void bgc_restart_EE();

PER_HEAP
void background_verify_mark (Object*& object, ScanContext* sc, uint32_t flags);
Expand Down

0 comments on commit 1bb8d7e

Please sign in to comment.