Commit c00b6d20 authored by Ömer Sinan Ağacan's avatar Ömer Sinan Ağacan

Update a few comments regarding CAF lists

[skip ci]
parent 0017a7b6
...@@ -122,8 +122,10 @@ typedef struct { ...@@ -122,8 +122,10 @@ typedef struct {
typedef struct { typedef struct {
StgHeader header; StgHeader header;
StgClosure *indirectee; StgClosure *indirectee;
StgClosure *static_link; StgClosure *static_link; // See Note [CAF lists]
const StgInfoTable *saved_info; const StgInfoTable *saved_info;
// `saved_info` also used for the link field for `debug_caf_list`,
// see `newCAF` and Note [CAF lists]
} StgIndStatic; } StgIndStatic;
typedef struct StgBlockingQueue_ { typedef struct StgBlockingQueue_ {
......
...@@ -1831,8 +1831,8 @@ resize_nursery (void) ...@@ -1831,8 +1831,8 @@ resize_nursery (void)
Sanity code for CAF garbage collection. Sanity code for CAF garbage collection.
With DEBUG turned on, we manage a CAF list in addition to the SRT 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 mechanism. After GC, we run down the CAF list and make any
CAFs which have been garbage collected. This means we get an error CAFs which have been garbage collected GCD_CAF. This means we get an error
whenever the program tries to enter a garbage collected CAF. whenever the program tries to enter a garbage collected CAF.
Any garbage collected CAFs are taken off the CAF list at the same Any garbage collected CAFs are taken off the CAF list at the same
......
...@@ -303,10 +303,10 @@ freeStorage (bool free_heap) ...@@ -303,10 +303,10 @@ freeStorage (bool free_heap)
The entry code for every CAF does the following: 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 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]) CAF entry])
- pushes an update frame pointing to the CAF_BLACKHOLE - pushes an update frame pointing to the CAF_BLACKHOLE
...@@ -317,7 +317,7 @@ freeStorage (bool free_heap) ...@@ -317,7 +317,7 @@ freeStorage (bool free_heap)
too, and various other parts of the RTS that deal with update too, and various other parts of the RTS that deal with update
frames would also need special cases for static update frames. 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]) - atomically locks the CAF (see [atomic CAF entry])
...@@ -335,7 +335,7 @@ freeStorage (bool free_heap) ...@@ -335,7 +335,7 @@ freeStorage (bool free_heap)
------------------ ------------------
Note [atomic CAF entry] 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 #5558). This is because if two threads happened to enter the same
CAF simultaneously, they would create two distinct CAF_BLACKHOLEs, CAF simultaneously, they would create two distinct CAF_BLACKHOLEs,
and so the normal threadPaused() machinery for detecting duplicate and so the normal threadPaused() machinery for detecting duplicate
...@@ -355,7 +355,7 @@ freeStorage (bool free_heap) ...@@ -355,7 +355,7 @@ freeStorage (bool free_heap)
- we must be able to *revert* CAFs that have been evaluated, to - we must be able to *revert* CAFs that have been evaluated, to
their pre-evaluated form. 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 called on a dynamically-loaded CAF, we add it to the CAF list
instead of the old-generation mutable list, and save away its instead of the old-generation mutable list, and save away its
old info pointer (in caf->saved_info) for later reversion. old info pointer (in caf->saved_info) for later reversion.
......
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