X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FWeak.c;h=012acc90f1653c3ba2f6118ccb90d7eb3c2c93b3;hb=caa7c91dd13a69110a55d68b61967f8239de15ce;hp=787c9e42acec45539da0b486bd969638cd0f8fed;hpb=94e06463420582cc2d336b39a297e82af39e4cc4;p=ghc-hetmet.git diff --git a/ghc/rts/Weak.c b/ghc/rts/Weak.c index 787c9e4..012acc9 100644 --- a/ghc/rts/Weak.c +++ b/ghc/rts/Weak.c @@ -21,37 +21,6 @@ StgWeak *weak_ptr_list; /* - * finalizeWeakPointersNow() is called just before the system is shut - * down. It runs the finalizer for each weak pointer still in the - * system. - * - * Careful here - rts_evalIO might cause a garbage collection, which - * might change weak_ptr_list. Must re-load weak_ptr_list each time - * around the loop. - */ - -void -finalizeWeakPointersNow(void) -{ - StgWeak *w; - - rts_lock(); - while ((w = weak_ptr_list)) { - weak_ptr_list = w->link; - if (w->header.info != &stg_DEAD_WEAK_info) { - SET_HDR(w, &stg_DEAD_WEAK_info, w->header.prof.ccs); - IF_DEBUG(weak,debugBelch("Finalising weak pointer at %p -> %p\n", w, w->key)); - if (w->finalizer != &stg_NO_FINALIZER_closure) { - rts_evalLazyIO(w->finalizer,NULL); - rts_unlock(); - rts_lock(); - } - } - } - rts_unlock(); -} - -/* * scheduleFinalizers() is called on the list of weak pointers found * to be dead after a garbage collection. It overwrites each object * with DEAD_WEAK, and creates a new thread to run the pending finalizers. @@ -106,7 +75,6 @@ scheduleFinalizers(StgWeak *list) arr = (StgMutArrPtrs *)allocate(sizeofW(StgMutArrPtrs) + n); TICK_ALLOC_PRIM(sizeofW(StgMutArrPtrs), n, 0); SET_HDR(arr, &stg_MUT_ARR_PTRS_FROZEN_info, CCS_SYSTEM); - arr->mut_link = NULL; arr->ptrs = n; n = 0;