diff options
author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2018-03-30 14:58:57 +0300 |
---|---|---|
committer | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2018-03-30 14:58:57 +0300 |
commit | c00b6d200c5c0c37c2936f12f27c5ebc3716a76f (patch) | |
tree | 3c21eeb71ca91e614f62f90050032bcd89d592b8 | |
parent | 0017a7b618353bf984d701f6d8ee2810a425e5b3 (diff) | |
download | haskell-c00b6d200c5c0c37c2936f12f27c5ebc3716a76f.tar.gz |
Update a few comments regarding CAF lists
[skip ci]
-rw-r--r-- | includes/rts/storage/Closures.h | 4 | ||||
-rw-r--r-- | rts/sm/GC.c | 4 | ||||
-rw-r--r-- | rts/sm/Storage.c | 10 |
3 files changed, 10 insertions, 8 deletions
diff --git a/includes/rts/storage/Closures.h b/includes/rts/storage/Closures.h index af89507f97..e5b274d895 100644 --- a/includes/rts/storage/Closures.h +++ b/includes/rts/storage/Closures.h @@ -122,8 +122,10 @@ typedef struct { typedef struct { StgHeader header; StgClosure *indirectee; - StgClosure *static_link; + StgClosure *static_link; // See Note [CAF lists] const StgInfoTable *saved_info; + // `saved_info` also used for the link field for `debug_caf_list`, + // see `newCAF` and Note [CAF lists] } StgIndStatic; typedef struct StgBlockingQueue_ { diff --git a/rts/sm/GC.c b/rts/sm/GC.c index d7d3723cd9..9e6bd55075 100644 --- a/rts/sm/GC.c +++ b/rts/sm/GC.c @@ -1831,8 +1831,8 @@ resize_nursery (void) Sanity code for CAF garbage collection. With DEBUG turned on, we manage a CAF list in addition to the SRT - mechanism. After GC, we run down the CAF list and blackhole any - CAFs which have been garbage collected. This means we get an error + mechanism. After GC, we run down the CAF list and make any + CAFs which have been garbage collected GCD_CAF. This means we get an error whenever the program tries to enter a garbage collected CAF. Any garbage collected CAFs are taken off the CAF list at the same diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c index c4dbdc26ca..9174646899 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -303,10 +303,10 @@ freeStorage (bool free_heap) The entry code for every CAF does the following: - - calls newCaf, which builds a CAF_BLACKHOLE on the heap and atomically + - calls newCAF, which builds a CAF_BLACKHOLE on the heap and atomically updates the CAF with IND_STATIC pointing to the CAF_BLACKHOLE - - if newCaf returns zero, it re-enters the CAF (see Note [atomic + - if newCAF returns zero, it re-enters the CAF (see Note [atomic CAF entry]) - pushes an update frame pointing to the CAF_BLACKHOLE @@ -317,7 +317,7 @@ freeStorage (bool free_heap) too, and various other parts of the RTS that deal with update frames would also need special cases for static update frames. - newCaf() does the following: + newCAF() does the following: - atomically locks the CAF (see [atomic CAF entry]) @@ -335,7 +335,7 @@ freeStorage (bool free_heap) ------------------ Note [atomic CAF entry] - With THREADED_RTS, newCaf() is required to be atomic (see + With THREADED_RTS, newCAF() is required to be atomic (see #5558). This is because if two threads happened to enter the same CAF simultaneously, they would create two distinct CAF_BLACKHOLEs, and so the normal threadPaused() machinery for detecting duplicate @@ -355,7 +355,7 @@ freeStorage (bool free_heap) - we must be able to *revert* CAFs that have been evaluated, to their pre-evaluated form. - To do this, we use an additional CAF list. When newCaf() is + To do this, we use an additional CAF list. When newCAF() is called on a dynamically-loaded CAF, we add it to the CAF list instead of the old-generation mutable list, and save away its old info pointer (in caf->saved_info) for later reversion. |