X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FThreadPaused.c;h=5b64f76ff29aeb8766b26c74e32a6c3f71c5d8f5;hb=41fea58220e763fcd55830a11a37ff44f21e4358;hp=f7017042f60fa2148b8e65e064aee236a5e2377d;hpb=ab0e778ccfde61aed4c22679b24d175fc6cc9bf3;p=ghc-hetmet.git diff --git a/rts/ThreadPaused.c b/rts/ThreadPaused.c index f701704..5b64f76 100644 --- a/rts/ThreadPaused.c +++ b/rts/ThreadPaused.c @@ -8,6 +8,7 @@ #include "Rts.h" #include "Storage.h" +#include "LdvProfile.h" #include "Updates.h" #include "RaiseAsync.h" #include "Trace.h" @@ -177,6 +178,8 @@ threadPaused(Capability *cap, StgTSO *tso) { StgClosure *frame; StgRetInfoTable *info; + const StgInfoTable *bh_info; + const StgInfoTable *cur_bh_info USED_IF_THREADS; StgClosure *bh; StgPtr stack_end; nat words_to_squeeze = 0; @@ -211,8 +214,13 @@ threadPaused(Capability *cap, StgTSO *tso) SET_INFO(frame, (StgInfoTable *)&stg_marked_upd_frame_info); bh = ((StgUpdateFrame *)frame)->updatee; + bh_info = bh->header.info; - if (closure_IND(bh) || bh->header.info == &stg_BLACKHOLE_info) { +#ifdef THREADED_RTS + retry: +#endif + if (closure_flags[INFO_PTR_TO_STRUCT(bh_info)->type] & _IND + || bh_info == &stg_BLACKHOLE_info) { debugTrace(DEBUG_squeeze, "suspending duplicate work: %ld words of stack", (long)((StgPtr)frame - tso->sp)); @@ -245,7 +253,20 @@ threadPaused(Capability *cap, StgTSO *tso) // We pretend that bh is now dead. LDV_recordDead_FILL_SLOP_DYNAMIC((StgClosure *)bh); #endif + +#ifdef THREADED_RTS + cur_bh_info = (const StgInfoTable *) + cas((StgVolatilePtr)&bh->header.info, + (StgWord)bh_info, + (StgWord)&stg_BLACKHOLE_info); + + if (cur_bh_info != bh_info) { + bh_info = cur_bh_info; + goto retry; + } +#else SET_INFO(bh,&stg_BLACKHOLE_info); +#endif // We pretend that bh has just been created. LDV_RECORD_CREATE(bh);