diff options
author | Simon Marlow <simonmarhaskell@gmail.com> | 2008-04-16 23:39:51 +0000 |
---|---|---|
committer | Simon Marlow <simonmarhaskell@gmail.com> | 2008-04-16 23:39:51 +0000 |
commit | 04cddd339c000df6d02c90ce59dbffa58d2fe166 (patch) | |
tree | 4ba138d182f71f2751daeb3cb77c0fc86cf1110f /includes | |
parent | 9de1ad504a0a12dabd42b206f06ca04fa0e7009a (diff) | |
download | haskell-04cddd339c000df6d02c90ce59dbffa58d2fe166.tar.gz |
Add a write barrier to the TSO link field (#1589)
Diffstat (limited to 'includes')
-rw-r--r-- | includes/Cmm.h | 3 | ||||
-rw-r--r-- | includes/Constants.h | 5 | ||||
-rw-r--r-- | includes/RtsExternal.h | 2 | ||||
-rw-r--r-- | includes/TSO.h | 23 | ||||
-rw-r--r-- | includes/mkDerivedConstants.c | 2 |
5 files changed, 28 insertions, 7 deletions
diff --git a/includes/Cmm.h b/includes/Cmm.h index 4cfb432811..7a68a517fe 100644 --- a/includes/Cmm.h +++ b/includes/Cmm.h @@ -544,9 +544,6 @@ #define END_TSO_QUEUE stg_END_TSO_QUEUE_closure #define END_INVARIANT_CHECK_QUEUE stg_END_INVARIANT_CHECK_QUEUE_closure -#define dirtyTSO(tso) \ - StgTSO_flags(tso) = StgTSO_flags(tso) | TSO_DIRTY::I32; - #define recordMutableCap(p, gen, regs) \ W_ __bd; \ W_ mut_list; \ diff --git a/includes/Constants.h b/includes/Constants.h index e0949cbd1f..66254f4114 100644 --- a/includes/Constants.h +++ b/includes/Constants.h @@ -260,6 +260,11 @@ #define TSO_INTERRUPTIBLE 8 #define TSO_STOPPED_ON_BREAKPOINT 16 +/* + * TSO_LINK_DIRTY is set when a TSO's link field is modified + */ +#define TSO_LINK_DIRTY 32 + /* ----------------------------------------------------------------------------- RET_DYN stack frames -------------------------------------------------------------------------- */ diff --git a/includes/RtsExternal.h b/includes/RtsExternal.h index b95276168a..c6fd74ac8d 100644 --- a/includes/RtsExternal.h +++ b/includes/RtsExternal.h @@ -126,6 +126,4 @@ extern void revertCAFs( void ); extern void dirty_MUT_VAR(StgRegTable *reg, StgClosure *p); extern void dirty_MVAR(StgRegTable *reg, StgClosure *p); -extern void dirty_TSO(StgClosure *tso); - #endif /* RTSEXTERNAL_H */ diff --git a/includes/TSO.h b/includes/TSO.h index 088097ea50..c6ec6697d4 100644 --- a/includes/TSO.h +++ b/includes/TSO.h @@ -124,7 +124,21 @@ typedef union { typedef struct StgTSO_ { StgHeader header; - struct StgTSO_* link; /* Links threads onto blocking queues */ + /* The link field, for linking threads together in lists (e.g. the + run queue on a Capability. + */ + struct StgTSO_* _link; + /* + NOTE!!! do not modify _link directly, it is subject to + a write barrier for generational GC. Instead use the + setTSOLink() function. Exceptions to this rule are: + + * setting the link field to END_TSO_QUEUE + * putting a TSO on the blackhole_queue + * setting the link field of the currently running TSO, as it + will already be dirty. + */ + struct StgTSO_* global_link; /* Links all threads together */ StgWord16 what_next; /* Values defined in Constants.h */ @@ -172,6 +186,13 @@ typedef struct StgTSO_ { } StgTSO; /* ----------------------------------------------------------------------------- + functions + -------------------------------------------------------------------------- */ + +extern void dirty_TSO (Capability *cap, StgTSO *tso); +extern void setTSOLink (Capability *cap, StgTSO *tso, StgTSO *target); + +/* ----------------------------------------------------------------------------- Invariants: An active thread has the following properties: diff --git a/includes/mkDerivedConstants.c b/includes/mkDerivedConstants.c index 56296ec4f1..51e52f0089 100644 --- a/includes/mkDerivedConstants.c +++ b/includes/mkDerivedConstants.c @@ -275,7 +275,7 @@ main(int argc, char *argv[]) closure_field(StgArrWords, words); closure_payload(StgArrWords, payload); - closure_field(StgTSO, link); + closure_field(StgTSO, _link); closure_field(StgTSO, global_link); closure_field(StgTSO, what_next); closure_field(StgTSO, why_blocked); |