[commit: ghc] master: rts: Update some comments, minor refactoring (4168ee3)
git at git.haskell.org
git at git.haskell.org
Wed Jun 27 07:37:11 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/4168ee3a503f716076ae1c182952c44289fdc5a0/ghc
>---------------------------------------------------------------
commit 4168ee3a503f716076ae1c182952c44289fdc5a0
Author: Ömer Sinan Ağacan <omeragacan at gmail.com>
Date: Wed Jun 27 10:31:29 2018 +0300
rts: Update some comments, minor refactoring
>---------------------------------------------------------------
4168ee3a503f716076ae1c182952c44289fdc5a0
includes/rts/storage/GC.h | 7 ++++++-
rts/Capability.h | 2 +-
rts/sm/Storage.c | 17 ++++++++---------
3 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/includes/rts/storage/GC.h b/includes/rts/storage/GC.h
index d4182dd..1571975 100644
--- a/includes/rts/storage/GC.h
+++ b/includes/rts/storage/GC.h
@@ -109,7 +109,12 @@ typedef struct generation_ {
memcount n_compact_blocks_in_import; // no. of blocks used by compacts
// being imported
- memcount max_blocks; // max blocks
+ // Max blocks to allocate in this generation before collecting it. Collect
+ // this generation when
+ //
+ // n_blocks + n_large_blocks + n_compact_blocks > max_blocks
+ //
+ memcount max_blocks;
StgTSO * threads; // threads in this gen
// linked via global_link
diff --git a/rts/Capability.h b/rts/Capability.h
index e4df0b8..250ec22 100644
--- a/rts/Capability.h
+++ b/rts/Capability.h
@@ -109,7 +109,7 @@ struct Capability_ {
int interrupt;
// Total words allocated by this cap since rts start
- // See [Note allocation accounting] in Storage.c
+ // See Note [allocation accounting] in Storage.c
W_ total_allocated;
#if defined(THREADED_RTS)
diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c
index cea7635..dcc5b3a 100644
--- a/rts/sm/Storage.c
+++ b/rts/sm/Storage.c
@@ -1158,7 +1158,7 @@ dirty_MVAR(StgRegTable *reg, StgClosure *p)
* -------------------------------------------------------------------------- */
/* -----------------------------------------------------------------------------
- * [Note allocation accounting]
+ * Note [allocation accounting]
*
* - When cap->r.rCurrentNusery moves to a new block in the nursery,
* we add the size of the used portion of the previous block to
@@ -1271,9 +1271,8 @@ W_ gcThreadLiveBlocks (uint32_t i, uint32_t g)
extern W_
calcNeeded (bool force_major, memcount *blocks_needed)
{
- W_ needed = 0, blocks;
- uint32_t g, N;
- generation *gen;
+ W_ needed = 0;
+ uint32_t N;
if (force_major) {
N = RtsFlags.GcFlags.generations - 1;
@@ -1281,12 +1280,12 @@ calcNeeded (bool force_major, memcount *blocks_needed)
N = 0;
}
- for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
- gen = &generations[g];
+ for (uint32_t g = 0; g < RtsFlags.GcFlags.generations; g++) {
+ generation *gen = &generations[g];
- blocks = gen->n_blocks // or: gen->n_words / BLOCK_SIZE_W (?)
- + gen->n_large_blocks
- + gen->n_compact_blocks;
+ W_ blocks = gen->n_blocks // or: gen->n_words / BLOCK_SIZE_W (?)
+ + gen->n_large_blocks
+ + gen->n_compact_blocks;
// we need at least this much space
needed += blocks;
More information about the ghc-commits
mailing list