summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsewardj <unknown>1999-10-26 17:15:39 +0000
committersewardj <unknown>1999-10-26 17:15:39 +0000
commit37cb07db3d7827c8b5058411b12e23e86e6a6520 (patch)
tree480b191b3ff66d3553ed7aba11068c84efac4ddd
parentbdb6474f50f498ec932b8a3a3a1706f358fe63d4 (diff)
downloadhaskell-37cb07db3d7827c8b5058411b12e23e86e6a6520.tar.gz
[project @ 1999-10-26 17:15:39 by sewardj]
markStablePtrTable: correctly handle case when one stable ptr refers to an indirection to an item referred to directly by a second stable ptr (I think!).
-rw-r--r--ghc/rts/Stable.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ghc/rts/Stable.c b/ghc/rts/Stable.c
index 01982b3471..2d280a4c61 100644
--- a/ghc/rts/Stable.c
+++ b/ghc/rts/Stable.c
@@ -1,5 +1,5 @@
/* -----------------------------------------------------------------------------
- * $Id: Stable.c,v 1.8 1999/09/15 13:50:14 sof Exp $
+ * $Id: Stable.c,v 1.9 1999/10/26 17:15:39 sewardj Exp $
*
* (c) The GHC Team, 1998-1999
*
@@ -199,7 +199,6 @@ getStablePtr(StgPtr p)
{
StgWord sn = lookupStableName(p);
StgWord weight, weight_2;
-
weight = stable_ptr_table[sn].weight;
if (weight == 0) {
weight = (StgWord)1 << (BITS_IN(StgWord)-1);
@@ -290,8 +289,10 @@ markStablePtrTable(rtsBool full)
(StgClosure *)p->addr = new;
} else if ((P_)new != q) {
removeHashTable(addrToStableHash, (W_)q, NULL);
- insertHashTable(addrToStableHash, (W_)new,
- (void *)(p - stable_ptr_table));
+ if (!lookupHashTable(addrToStableHash, (W_)new)) {
+ insertHashTable(addrToStableHash, (W_)new,
+ (void *)(p - stable_ptr_table));
+ }
(StgClosure *)p->addr = new;
}
IF_DEBUG(stable, fprintf(stderr,"Stable ptr %d still alive at %p, weight %d\n", p - stable_ptr_table, new, p->weight));