diff options
author | David Eichmann <EichmannD@gmail.com> | 2020-11-09 19:23:16 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-11-10 10:28:46 -0500 |
commit | 2e63a0fb1bdaecc7916a3cc35dcfd2b2ef37c328 (patch) | |
tree | 7f50294c605f29d2f18775e5066cfdf2c147c9c8 | |
parent | fa344d33dba71f31f55269c5fc733daa3830073a (diff) | |
download | haskell-2e63a0fb1bdaecc7916a3cc35dcfd2b2ef37c328.tar.gz |
Add code comments for StgInfoTable and StgStack structs
-rw-r--r-- | includes/rts/storage/Closures.h | 5 | ||||
-rw-r--r-- | includes/rts/storage/TSO.h | 16 |
2 files changed, 19 insertions, 2 deletions
diff --git a/includes/rts/storage/Closures.h b/includes/rts/storage/Closures.h index 981e162ec1..0fff039cc6 100644 --- a/includes/rts/storage/Closures.h +++ b/includes/rts/storage/Closures.h @@ -63,6 +63,11 @@ typedef struct { -------------------------------------------------------------------------- */ typedef struct { + // If TABLES_NEXT_TO_CODE is defined, then `info` is offset by + // `sizeof(StgInfoTable)` and so points to the `code` field of the + // StgInfoTable! You may want to use `get_itbl` to get the pointer to the + // start of the info table. See + // https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/rts/storage/heap-objects#tables_next_to_code. const StgInfoTable* info; #if defined(PROFILING) StgProfHeader prof; diff --git a/includes/rts/storage/TSO.h b/includes/rts/storage/TSO.h index 33eebffc7c..61215d9f38 100644 --- a/includes/rts/storage/TSO.h +++ b/includes/rts/storage/TSO.h @@ -242,10 +242,22 @@ typedef struct StgTSO_ { typedef struct StgStack_ { StgHeader header; - StgWord32 stack_size; // stack size in *words* + + /* Size of the `stack` field in *words*. This is not affected by how much of + * the stack space is used, nor if more stack space is linked to by an + * UNDERFLOW_FRAME. + */ + StgWord32 stack_size; + StgWord8 dirty; // non-zero => dirty StgWord8 marking; // non-zero => someone is currently marking the stack - StgPtr sp; // current stack pointer + + /* Pointer to the "top" of the stack i.e. the most recently written address. + * The stack is filled downwards, so the "top" of the stack starts with `sp + * = stack + stack_size` and is decremented as the stack fills with data. + * See comment on "Invariants" below. + */ + StgPtr sp; StgWord stack[]; } StgStack; |