X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=rts%2FUpdates.h;h=3461c91144dfa553393cdde3d8191ba1302bf8e4;hp=f20b0884324043d790673e178003b4f100fca2f2;hb=842e9d6628a27cf1f420d53f6a5901935dc50c54;hpb=081e9e53205935280f1800f113760a8a72498a6f diff --git a/rts/Updates.h b/rts/Updates.h index f20b088..3461c91 100644 --- a/rts/Updates.h +++ b/rts/Updates.h @@ -23,21 +23,14 @@ -------------------------------------------------------------------------- */ -#ifdef TICKY_TICKY -# define UPD_IND(updclosure, heapptr) \ - UPD_PERM_IND(updclosure,heapptr) -# define UPD_SPEC_IND(updclosure, ind_info, heapptr, and_then) \ - UPD_PERM_IND(updclosure,heapptr); and_then -#else # define SEMI ; # define UPD_IND(updclosure, heapptr) \ UPD_REAL_IND(updclosure,INFO_PTR(stg_IND_info),heapptr,SEMI) # define UPD_SPEC_IND(updclosure, ind_info, heapptr, and_then) \ UPD_REAL_IND(updclosure,ind_info,heapptr,and_then) -#endif /* These macros have to work in both C and C--, so here's the - * impedence matching: + * impedance matching: */ #ifdef CMINUSMINUS #define BLOCK_BEGIN @@ -57,9 +50,10 @@ #define ARG_PTR /* nothing */ #endif -/* UPD_IND actually does a PERM_IND if TICKY_TICKY is on; - if you *really* need an IND use UPD_REAL_IND - */ +/* krc: there used to be an UPD_REAL_IND and an + UPD_PERM_IND, the latter of which was used for + ticky and cost-centre profiling. + for now, we just have UPD_REAL_IND. */ #define UPD_REAL_IND(updclosure, ind_info, heapptr, and_then) \ BLOCK_BEGIN \ DECLARE_IPTR(info); \ @@ -70,34 +64,18 @@ and_then); \ BLOCK_END -#if defined(PROFILING) || defined(TICKY_TICKY) -#define UPD_PERM_IND(updclosure, heapptr) \ - BLOCK_BEGIN \ - updateWithPermIndirection(updclosure, \ - heapptr); \ - BLOCK_END -#endif - #if defined(RTS_SUPPORTS_THREADS) -# ifdef TICKY_TICKY -# define UPD_IND_NOLOCK(updclosure, heapptr) \ - BLOCK_BEGIN \ - updateWithPermIndirection(updclosure, \ - heapptr); \ - BLOCK_END -# else # define UPD_IND_NOLOCK(updclosure, heapptr) \ BLOCK_BEGIN \ updateWithIndirection(INFO_PTR(stg_IND_info), \ updclosure, \ heapptr,); \ BLOCK_END -# endif #else #define UPD_IND_NOLOCK(updclosure,heapptr) UPD_IND(updclosure,heapptr) -#endif +#endif /* RTS_SUPPORTS_THREADS */ /* ----------------------------------------------------------------------------- Awaken any threads waiting on a blocking queue (BLACKHOLE_BQ). @@ -233,6 +211,10 @@ FILL_SLOP(StgClosure *p) switch (inf->type) { case BLACKHOLE: case CAF_BLACKHOLE: + goto no_slop; + // we already filled in the slop when we overwrote the thunk + // with BLACKHOLE, and also an evacuated BLACKHOLE is only the + // size of an IND. case THUNK_SELECTOR: sz = sizeofW(StgSelector) - sizeofW(StgThunkHeader); break; @@ -249,6 +231,8 @@ FILL_SLOP(StgClosure *p) for (i = 0; i < sz; i++) { ((StgThunk *)p)->payload[i] = 0; } +no_slop: + ; } #endif /* CMINUSMINUS */ @@ -277,12 +261,10 @@ FILL_SLOP(StgClosure *p) DEBUG_FILL_SLOP(p1); \ LDV_RECORD_DEAD_FILL_SLOP_DYNAMIC(p1); \ StgInd_indirectee(p1) = p2; \ - foreign "C" wb() []; \ + prim %write_barrier() []; \ bd = Bdescr(p1); \ if (bdescr_gen_no(bd) != 0 :: CInt) { \ - foreign "C" recordMutableCap(p1 "ptr", \ - MyCapability() "ptr", \ - bdescr_gen_no(bd)) [R1]; \ + recordMutableCap(p1, TO_W_(bdescr_gen_no(bd)), R1); \ SET_INFO(p1, stg_IND_OLDGEN_info); \ LDV_RECORD_CREATE(p1); \ TICK_UPD_OLD_IND(); \ @@ -294,72 +276,28 @@ FILL_SLOP(StgClosure *p) and_then; \ } #else -#define updateWithIndirection(ind_info, p1, p2, and_then) \ - { \ - bdescr *bd; \ - \ - /* cas(p1, 0, &stg_WHITEHOLE_info); */ \ - ASSERT( (P_)p1 != (P_)p2 && !closure_IND(p1) ); \ - DEBUG_FILL_SLOP(p1); \ - LDV_RECORD_DEAD_FILL_SLOP_DYNAMIC(p1); \ - ((StgInd *)p1)->indirectee = p2; \ - wb(); \ - bd = Bdescr((P_)p1); \ - if (bd->gen_no != 0) { \ - recordMutableGenLock(p1, &generations[bd->gen_no]); \ - SET_INFO(p1, &stg_IND_OLDGEN_info); \ - TICK_UPD_OLD_IND(); \ - and_then; \ - } else { \ - SET_INFO(p1, ind_info); \ - LDV_RECORD_CREATE(p1); \ - TICK_UPD_NEW_IND(); \ - and_then; \ - } \ - } -#endif - -/* The permanent indirection version isn't performance critical. We - * therefore use an inline C function instead of the C-- macro. - */ -#ifndef CMINUSMINUS -INLINE_HEADER void -updateWithPermIndirection(StgClosure *p1, - StgClosure *p2) -{ - bdescr *bd; - - ASSERT( p1 != p2 && !closure_IND(p1) ); - - /* - * @LDV profiling - * Destroy the old closure. - * Nb: LDV_* stuff cannot mix with ticky-ticky - */ - LDV_RECORD_DEAD_FILL_SLOP_DYNAMIC(p1); - - bd = Bdescr((P_)p1); - if (bd->gen_no != 0) { - recordMutableGenLock(p1, &generations[bd->gen_no]); - ((StgInd *)p1)->indirectee = p2; - SET_INFO(p1, &stg_IND_OLDGEN_PERM_info); - /* - * @LDV profiling - * We have just created a new closure. - */ - LDV_RECORD_CREATE(p1); - TICK_UPD_OLD_PERM_IND(); - } else { - ((StgInd *)p1)->indirectee = p2; - SET_INFO(p1, &stg_IND_PERM_info); - /* - * @LDV profiling - * We have just created a new closure. - */ - LDV_RECORD_CREATE(p1); - TICK_UPD_NEW_PERM_IND(p1); +#define updateWithIndirection(ind_info, p1, p2, and_then) \ + { \ + bdescr *bd; \ + \ + /* cas(p1, 0, &stg_WHITEHOLE_info); */ \ + ASSERT( (P_)p1 != (P_)p2 && !closure_IND(p1) ); \ + DEBUG_FILL_SLOP(p1); \ + LDV_RECORD_DEAD_FILL_SLOP_DYNAMIC(p1); \ + ((StgInd *)p1)->indirectee = p2; \ + write_barrier(); \ + bd = Bdescr((P_)p1); \ + if (bd->gen_no != 0) { \ + recordMutableGenLock(p1, &generations[bd->gen_no]); \ + SET_INFO(p1, &stg_IND_OLDGEN_info); \ + TICK_UPD_OLD_IND(); \ + and_then; \ + } else { \ + SET_INFO(p1, ind_info); \ + LDV_RECORD_CREATE(p1); \ + TICK_UPD_NEW_IND(); \ + and_then; \ + } \ } -} -#endif - +#endif /* CMINUSMINUS */ #endif /* UPDATES_H */