Skip to content
Snippets Groups Projects
Commit 1144eacc authored by Simon Marlow's avatar Simon Marlow
Browse files

[project @ 2000-02-25 15:07:09 by simonmar]

The finalizer passed to mkWeak# might be NULL, so we'd better not
claim it's always pointer if we need to GC.  Another bug squashed...
parent 5e95eb49
No related branches found
No related tags found
No related merge requests found
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* $Id: PrimOps.hc,v 1.41 2000/02/14 10:56:47 sewardj Exp $ * $Id: PrimOps.hc,v 1.42 2000/02/25 15:07:09 simonmar Exp $
* *
* (c) The GHC Team, 1998-1999 * (c) The GHC Team, 1998-1999
* *
...@@ -361,12 +361,16 @@ FN_(mkWeakzh_fast) ...@@ -361,12 +361,16 @@ FN_(mkWeakzh_fast)
{ {
/* R1.p = key /* R1.p = key
R2.p = value R2.p = value
R3.p = finalizer R3.p = finalizer (or NULL)
*/ */
StgWeak *w; StgWeak *w;
FB_ FB_
HP_CHK_GEN_TICKY(sizeofW(StgWeak), R1_PTR|R2_PTR|R3_PTR, mkWeakzh_fast,); if (R3.cl == NULL) {
R3.cl = &NO_FINALIZER_closure;
}
HP_CHK_GEN_TICKY(sizeofW(StgWeak),R1_PTR|R2_PTR|R3_PTR, mkWeakzh_fast,);
TICK_ALLOC_PRIM(sizeofW(StgHeader)+1, // +1 is for the link field TICK_ALLOC_PRIM(sizeofW(StgHeader)+1, // +1 is for the link field
sizeofW(StgWeak)-sizeofW(StgHeader)-1, 0); sizeofW(StgWeak)-sizeofW(StgHeader)-1, 0);
CCS_ALLOC(CCCS,sizeofW(StgWeak)); /* ccs prof */ CCS_ALLOC(CCCS,sizeofW(StgWeak)); /* ccs prof */
...@@ -376,11 +380,7 @@ FN_(mkWeakzh_fast) ...@@ -376,11 +380,7 @@ FN_(mkWeakzh_fast)
w->key = R1.cl; w->key = R1.cl;
w->value = R2.cl; w->value = R2.cl;
if (R3.cl) { w->finalizer = R3.cl;
w->finalizer = R3.cl;
} else {
w->finalizer = &NO_FINALIZER_closure;
}
w->link = weak_ptr_list; w->link = weak_ptr_list;
weak_ptr_list = w; weak_ptr_list = w;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment