Commit 40891891 authored by simonmar's avatar simonmar
Browse files

[project @ 2002-06-19 12:01:28 by simonmar]

Fix wibble in previous commit to Weak.c.  Should fix problems with
--enable-threaded-rts.
parent e199c200
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* $Id: Weak.c,v 1.24 2002/06/13 11:41:15 simonmar Exp $ * $Id: Weak.c,v 1.25 2002/06/19 12:01:28 simonmar Exp $
* *
* (c) The GHC Team, 1998-1999 * (c) The GHC Team, 1998-1999
* *
...@@ -70,9 +70,14 @@ scheduleFinalizers(StgWeak *list) ...@@ -70,9 +70,14 @@ scheduleFinalizers(StgWeak *list)
nat n; nat n;
// count number of finalizers, and kill all the weak pointers first... // count number of finalizers, and kill all the weak pointers first...
for (n = 0, w = list; w; w = w->link) { n = 0;
if (w->header.info != &stg_DEAD_WEAK_info && for (w = list; w; w = w->link) {
w->finalizer != &stg_NO_FINALIZER_closure) {
// Better not be a DEAD_WEAK at this stage; the garbage
// collector removes DEAD_WEAKs from the weak pointer list.
ASSERT(w->header.info != &stg_DEAD_WEAK_info);
if (w->finalizer != &stg_NO_FINALIZER_closure) {
n++; n++;
} }
...@@ -88,6 +93,7 @@ scheduleFinalizers(StgWeak *list) ...@@ -88,6 +93,7 @@ scheduleFinalizers(StgWeak *list)
SET_HDR(w, &stg_DEAD_WEAK_info, w->header.prof.ccs); SET_HDR(w, &stg_DEAD_WEAK_info, w->header.prof.ccs);
} }
// No finalizers to run?
if (n == 0) return; if (n == 0) return;
IF_DEBUG(weak,fprintf(stderr,"weak: batching %d finalizers\n", n)); IF_DEBUG(weak,fprintf(stderr,"weak: batching %d finalizers\n", n));
...@@ -96,9 +102,9 @@ scheduleFinalizers(StgWeak *list) ...@@ -96,9 +102,9 @@ scheduleFinalizers(StgWeak *list)
SET_HDR(arr, &stg_MUT_ARR_PTRS_FROZEN_info, CCS_SYSTEM); SET_HDR(arr, &stg_MUT_ARR_PTRS_FROZEN_info, CCS_SYSTEM);
arr->ptrs = n; arr->ptrs = n;
for (n = 0, w = list; w; w = w->link) { n = 0;
if (w->header.info != &stg_DEAD_WEAK_info && for (w = list; w; w = w->link) {
w->finalizer != &stg_NO_FINALIZER_closure) { if (w->finalizer != &stg_NO_FINALIZER_closure) {
arr->payload[n] = w->finalizer; arr->payload[n] = w->finalizer;
n++; n++;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment