summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorSimon Marlow <simonmar@microsoft.com>2007-10-11 13:55:05 +0000
committerSimon Marlow <simonmar@microsoft.com>2007-10-11 13:55:05 +0000
commit1ed01a871030f05905a9595e4837dfffc087ef64 (patch)
tree32c1335b52d0ec28d6a99d4ccaeae6a36a73bddc /includes
parent53d57aa3aa498120eb1beba1b9c30e6a5e4e2d0a (diff)
downloadhaskell-1ed01a871030f05905a9595e4837dfffc087ef64.tar.gz
Add a proper write barrier for MVars
Previously MVars were always on the mutable list of the old generation, which meant every MVar was visited during every minor GC. With lots of MVars hanging around, this gets expensive. We addressed this problem for MUT_VARs (aka IORefs) a while ago, the solution is to use a traditional GC write-barrier when the object is modified. This patch does the same thing for MVars. TVars are still done the old way, they could probably benefit from the same treatment too.
Diffstat (limited to 'includes')
-rw-r--r--includes/ClosureTypes.h55
-rw-r--r--includes/RtsExternal.h3
-rw-r--r--includes/StgMiscClosures.h4
3 files changed, 33 insertions, 29 deletions
diff --git a/includes/ClosureTypes.h b/includes/ClosureTypes.h
index 3765801a3c..b7bebd6c6b 100644
--- a/includes/ClosureTypes.h
+++ b/includes/ClosureTypes.h
@@ -66,32 +66,33 @@
#define BLACKHOLE 42
#define SE_BLACKHOLE 43
#define SE_CAF_BLACKHOLE 44
-#define MVAR 45
-#define ARR_WORDS 46
-#define MUT_ARR_PTRS_CLEAN 47
-#define MUT_ARR_PTRS_DIRTY 48
-#define MUT_ARR_PTRS_FROZEN0 49
-#define MUT_ARR_PTRS_FROZEN 50
-#define MUT_VAR_CLEAN 51
-#define MUT_VAR_DIRTY 52
-#define WEAK 53
-#define STABLE_NAME 54
-#define TSO 55
-#define BLOCKED_FETCH 56
-#define FETCH_ME 57
-#define FETCH_ME_BQ 58
-#define RBH 59
-#define EVACUATED 60
-#define REMOTE_REF 61
-#define TVAR_WATCH_QUEUE 62
-#define INVARIANT_CHECK_QUEUE 63
-#define ATOMIC_INVARIANT 64
-#define TVAR 65
-#define TREC_CHUNK 66
-#define TREC_HEADER 67
-#define ATOMICALLY_FRAME 68
-#define CATCH_RETRY_FRAME 69
-#define CATCH_STM_FRAME 70
-#define N_CLOSURE_TYPES 71
+#define MVAR_CLEAN 45
+#define MVAR_DIRTY 46
+#define ARR_WORDS 47
+#define MUT_ARR_PTRS_CLEAN 48
+#define MUT_ARR_PTRS_DIRTY 49
+#define MUT_ARR_PTRS_FROZEN0 50
+#define MUT_ARR_PTRS_FROZEN 51
+#define MUT_VAR_CLEAN 52
+#define MUT_VAR_DIRTY 53
+#define WEAK 54
+#define STABLE_NAME 55
+#define TSO 56
+#define BLOCKED_FETCH 57
+#define FETCH_ME 58
+#define FETCH_ME_BQ 59
+#define RBH 60
+#define EVACUATED 61
+#define REMOTE_REF 62
+#define TVAR_WATCH_QUEUE 63
+#define INVARIANT_CHECK_QUEUE 64
+#define ATOMIC_INVARIANT 65
+#define TVAR 66
+#define TREC_CHUNK 67
+#define TREC_HEADER 68
+#define ATOMICALLY_FRAME 69
+#define CATCH_RETRY_FRAME 70
+#define CATCH_STM_FRAME 71
+#define N_CLOSURE_TYPES 72
#endif /* CLOSURETYPES_H */
diff --git a/includes/RtsExternal.h b/includes/RtsExternal.h
index 6c1f71e3d1..39a22fd3a8 100644
--- a/includes/RtsExternal.h
+++ b/includes/RtsExternal.h
@@ -124,5 +124,8 @@ extern void performMajorGC(void);
extern HsInt64 getAllocations( void );
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/StgMiscClosures.h b/includes/StgMiscClosures.h
index ea9e8059d0..a99ff72a22 100644
--- a/includes/StgMiscClosures.h
+++ b/includes/StgMiscClosures.h
@@ -99,8 +99,8 @@ RTS_INFO(stg_EVACUATED_info);
RTS_INFO(stg_WEAK_info);
RTS_INFO(stg_DEAD_WEAK_info);
RTS_INFO(stg_STABLE_NAME_info);
-RTS_INFO(stg_FULL_MVAR_info);
-RTS_INFO(stg_EMPTY_MVAR_info);
+RTS_INFO(stg_MVAR_CLEAN_info);
+RTS_INFO(stg_MVAR_DIRTY_info);
RTS_INFO(stg_TSO_info);
RTS_INFO(stg_ARR_WORDS_info);
RTS_INFO(stg_MUT_ARR_WORDS_info);