Commit a1e3066e authored by Simon Marlow's avatar Simon Marlow
Browse files

THREADED_RTS: use cas() when claiming thunks

I guess I forgot to do this the first time around; the upshot is that
there could be some uncaught duplication of work on a multiprocessor
(but unlikely).
parent d5b20065
...@@ -178,6 +178,8 @@ threadPaused(Capability *cap, StgTSO *tso) ...@@ -178,6 +178,8 @@ threadPaused(Capability *cap, StgTSO *tso)
{ {
StgClosure *frame; StgClosure *frame;
StgRetInfoTable *info; StgRetInfoTable *info;
const StgInfoTable *bh_info;
const StgInfoTable *cur_bh_info USED_IF_THREADS;
StgClosure *bh; StgClosure *bh;
StgPtr stack_end; StgPtr stack_end;
nat words_to_squeeze = 0; nat words_to_squeeze = 0;
...@@ -212,8 +214,13 @@ threadPaused(Capability *cap, StgTSO *tso) ...@@ -212,8 +214,13 @@ threadPaused(Capability *cap, StgTSO *tso)
SET_INFO(frame, (StgInfoTable *)&stg_marked_upd_frame_info); SET_INFO(frame, (StgInfoTable *)&stg_marked_upd_frame_info);
bh = ((StgUpdateFrame *)frame)->updatee; bh = ((StgUpdateFrame *)frame)->updatee;
bh_info = bh->;
if (closure_IND(bh) || bh-> == &stg_BLACKHOLE_info) { #ifdef THREADED_RTS
if (closure_flags[INFO_PTR_TO_STRUCT(bh_info)->type] & _IND
|| bh_info == &stg_BLACKHOLE_info) {
debugTrace(DEBUG_squeeze, debugTrace(DEBUG_squeeze,
"suspending duplicate work: %ld words of stack", "suspending duplicate work: %ld words of stack",
(long)((StgPtr)frame - tso->sp)); (long)((StgPtr)frame - tso->sp));
...@@ -246,7 +253,20 @@ threadPaused(Capability *cap, StgTSO *tso) ...@@ -246,7 +253,20 @@ threadPaused(Capability *cap, StgTSO *tso)
// We pretend that bh is now dead. // We pretend that bh is now dead.
LDV_recordDead_FILL_SLOP_DYNAMIC((StgClosure *)bh); LDV_recordDead_FILL_SLOP_DYNAMIC((StgClosure *)bh);
#endif #endif
cur_bh_info = (const StgInfoTable *)
if (cur_bh_info != bh_info) {
bh_info = cur_bh_info;
goto retry;
SET_INFO(bh,&stg_BLACKHOLE_info); SET_INFO(bh,&stg_BLACKHOLE_info);
// We pretend that bh has just been created. // We pretend that bh has just been created.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment