From 8d6583e38f4e9b00ec21666225760a0df97afaec Mon Sep 17 00:00:00 2001 From: Maoni0 Date: Wed, 23 May 2018 13:52:08 -0700 Subject: [PATCH] find_object --- src/gc/gc.cpp | 55 +++++++++++++++++++++++++++++++++---------------------- src/gc/gcpriv.h | 9 ++++++--- 2 files changed, 39 insertions(+), 25 deletions(-) diff --git a/src/gc/gc.cpp b/src/gc/gc.cpp index a8a47c7..5f653fa 100644 --- a/src/gc/gc.cpp +++ b/src/gc/gc.cpp @@ -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 @@ -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) @@ -31280,7 +31279,7 @@ void gc_heap::background_sweep() if (heap_number == 0) { - restart_EE (); + bgc_restart_EE (); } FIRE_EVENT(BGC2ndConBegin); @@ -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); @@ -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 { diff --git a/src/gc/gcpriv.h b/src/gc/gcpriv.h index c2f7356..f0c9d03 100644 --- a/src/gc/gcpriv.h +++ b/src/gc/gcpriv.h @@ -2597,13 +2597,16 @@ protected: 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); -- 2.7.4