summaryrefslogtreecommitdiff
path: root/includes/Cmm.h
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2009-12-17 22:42:28 +0000
committerSimon Marlow <marlowsd@gmail.com>2009-12-17 22:42:28 +0000
commit0417404f5d1230c9d291ea9f73e2831121c8ec99 (patch)
tree609f1be77f63606772e71ad84c7a92b205baaa9e /includes/Cmm.h
parentfb783aeaa5bc1cc60e6bb551c1cd01a097b84fad (diff)
downloadhaskell-0417404f5d1230c9d291ea9f73e2831121c8ec99.tar.gz
Fix #650: use a card table to mark dirty sections of mutable arrays
The card table is an array of bytes, placed directly following the actual array data. This means that array reading is unaffected, but array writing needs to read the array size from the header in order to find the card table. We use a bytemap rather than a bitmap, because updating the card table must be multi-thread safe. Each byte refers to 128 entries of the array, but this is tunable by changing the constant MUT_ARR_PTRS_CARD_BITS in includes/Constants.h.
Diffstat (limited to 'includes/Cmm.h')
-rw-r--r--includes/Cmm.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/includes/Cmm.h b/includes/Cmm.h
index 69b5acc5fc..ff91146745 100644
--- a/includes/Cmm.h
+++ b/includes/Cmm.h
@@ -463,6 +463,9 @@
#define StgFunInfoExtra_bitmap(i) StgFunInfoExtraFwd_bitmap(i)
#endif
+#define mutArrPtrsCardWords(n) \
+ ROUNDUP_BYTES_TO_WDS(((n) + (1 << MUT_ARR_PTRS_CARD_BITS) - 1) >> MUT_ARR_PTRS_CARD_BITS)
+
/* -----------------------------------------------------------------------------
Voluntary Yields/Blocks