X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FPrimOps.hc;h=134ed1bc0d83c08a89355df53ead97e1b700d95f;hb=553e90d9a32ee1b1809430f260c401cc4169c6c7;hp=45fd2cf20243ca2d9821d0c5c2888b5848690393;hpb=d3581a6a5789da15ab56c11cd02bece49273b41d;p=ghc-hetmet.git diff --git a/ghc/rts/PrimOps.hc b/ghc/rts/PrimOps.hc index 45fd2cf..134ed1b 100644 --- a/ghc/rts/PrimOps.hc +++ b/ghc/rts/PrimOps.hc @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: PrimOps.hc,v 1.114 2003/10/01 10:57:41 wolfgang Exp $ + * $Id: PrimOps.hc,v 1.116 2004/01/08 15:26:44 simonmar Exp $ * * (c) The GHC Team, 1998-2002 * @@ -402,7 +402,22 @@ FN_(unsafeThawArrayzh_fast) { FB_ SET_INFO((StgClosure *)R1.cl,&stg_MUT_ARR_PTRS_info); - recordMutable((StgMutClosure*)R1.cl); + + // SUBTLETY TO DO WITH THE OLD GEN MUTABLE LIST + // + // A MUT_ARR_PTRS lives on the mutable list, but a MUT_ARR_PTRS_FROZEN + // normally doesn't. However, when we freeze a MUT_ARR_PTRS, we leave + // it on the mutable list for the GC to remove (removing something from + // the mutable list is not easy, because the mut_list is only singly-linked). + // + // So, when we thaw a MUT_ARR_PTRS_FROZEN, we must cope with two cases: + // either it is on a mut_list, or it isn't. We adopt the convention that + // the mut_link field is NULL if it isn't on a mut_list, and the GC + // maintains this invariant. + // + if (((StgMutArrPtrs *)R1.cl)->mut_link == NULL) { + recordMutable((StgMutClosure*)R1.cl); + } TICK_RET_UNBOXED_TUP(1); RET_P(R1.p); @@ -1641,7 +1656,7 @@ FN_(delayzh_fast) CurrentTSO->why_blocked = BlockedOnDoProc; APPEND_TO_BLOCKED_QUEUE(CurrentTSO); #else - target = (R1.i / (TICK_MILLISECS*1000)) + getourtimeofday(); + target = ((R1.i + TICK_MILLISECS*1000-1) / (TICK_MILLISECS*1000)) + getourtimeofday(); CurrentTSO->block_info.target = target; /* Insert the new thread in the sleeping queue. */