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

rts: Update some comments, minor refactoring

parent 3d002087
...@@ -109,7 +109,12 @@ typedef struct generation_ { ...@@ -109,7 +109,12 @@ typedef struct generation_ {
memcount n_compact_blocks_in_import; // no. of blocks used by compacts memcount n_compact_blocks_in_import; // no. of blocks used by compacts
// being imported // 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 StgTSO * threads; // threads in this gen
// linked via global_link // linked via global_link
......
...@@ -109,7 +109,7 @@ struct Capability_ { ...@@ -109,7 +109,7 @@ struct Capability_ {
int interrupt; int interrupt;
// Total words allocated by this cap since rts start // 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; W_ total_allocated;
#if defined(THREADED_RTS) #if defined(THREADED_RTS)
......
...@@ -1158,7 +1158,7 @@ dirty_MVAR(StgRegTable *reg, StgClosure *p) ...@@ -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, * - 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 * 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) ...@@ -1271,9 +1271,8 @@ W_ gcThreadLiveBlocks (uint32_t i, uint32_t g)
extern W_ extern W_
calcNeeded (bool force_major, memcount *blocks_needed) calcNeeded (bool force_major, memcount *blocks_needed)
{ {
W_ needed = 0, blocks; W_ needed = 0;
uint32_t g, N; uint32_t N;
generation *gen;
if (force_major) { if (force_major) {
N = RtsFlags.GcFlags.generations - 1; N = RtsFlags.GcFlags.generations - 1;
...@@ -1281,12 +1280,12 @@ calcNeeded (bool force_major, memcount *blocks_needed) ...@@ -1281,12 +1280,12 @@ calcNeeded (bool force_major, memcount *blocks_needed)
N = 0; N = 0;
} }
for (g = 0; g < RtsFlags.GcFlags.generations; g++) { for (uint32_t g = 0; g < RtsFlags.GcFlags.generations; g++) {
gen = &generations[g]; generation *gen = &generations[g];
blocks = gen->n_blocks // or: gen->n_words / BLOCK_SIZE_W (?) W_ blocks = gen->n_blocks // or: gen->n_words / BLOCK_SIZE_W (?)
+ gen->n_large_blocks + gen->n_large_blocks
+ gen->n_compact_blocks; + gen->n_compact_blocks;
// we need at least this much space // we need at least this much space
needed += blocks; needed += blocks;
......
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