Commit 080c9600 authored by Simon Marlow's avatar Simon Marlow
Browse files

takeMVar/putMVar were missing some write barriers when modifying a TSO

This relates to the recent introduction of clean/dirty TSOs, and the
consqeuent write barriers required.  We were missing some write
barriers in the takeMVar/putMVar family of primops, when performing
the take/put directly on another TSO.

Fixes #705, and probably some test failures.
parent cd0bb88b
......@@ -1496,6 +1496,7 @@ takeMVarzh_fast
/* actually perform the putMVar for the thread that we just woke up */
tso = StgMVar_head(mvar);
PerformPut(tso,StgMVar_value(mvar));
foreign "C" dirtyTSO(tso "ptr") [];
#if defined(GRAN) || defined(PAR)
/* ToDo: check 2nd arg (mvar) is right */
......@@ -1569,6 +1570,7 @@ tryTakeMVarzh_fast
/* actually perform the putMVar for the thread that we just woke up */
tso = StgMVar_head(mvar);
PerformPut(tso,StgMVar_value(mvar));
foreign "C" dirtyTSO(tso "ptr") [];
#if defined(GRAN) || defined(PAR)
/* ToDo: check 2nd arg (mvar) is right */
......@@ -1638,6 +1640,7 @@ putMVarzh_fast
/* actually perform the takeMVar */
tso = StgMVar_head(mvar);
PerformTake(tso, R2);
foreign "C" dirtyTSO(tso "ptr") [];
#if defined(GRAN) || defined(PAR)
/* ToDo: check 2nd arg (mvar) is right */
......@@ -1703,6 +1706,7 @@ tryPutMVarzh_fast
/* actually perform the takeMVar */
tso = StgMVar_head(mvar);
PerformTake(tso, R2);
foreign "C" dirtyTSO(tso "ptr") [];
#if defined(GRAN) || defined(PAR)
/* ToDo: check 2nd arg (mvar) is right */
......
......@@ -287,12 +287,6 @@ emptyThreadQueues(Capability *cap)
;
}
STATIC_INLINE void
dirtyTSO (StgTSO *tso)
{
tso->flags |= TSO_DIRTY;
}
#ifdef DEBUG
void sched_belch(char *s, ...)
GNU_ATTRIBUTE(format (printf, 1, 2));
......@@ -300,5 +294,11 @@ void sched_belch(char *s, ...)
#endif /* !IN_STG_CODE */
STATIC_INLINE void
dirtyTSO (StgTSO *tso)
{
tso->flags |= TSO_DIRTY;
}
#endif /* SCHEDULE_H */
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