Commit c2ce3c04 authored by simonm's avatar simonm
Browse files

[project @ 1999-01-19 15:07:53 by simonm]

- Add -F<factor> flag which governs the threshold size of the oldest
  generation.

- Add RtsFlags.GcFlags.minOldGenSize (no flag yet) so that we don't
  have to guess the initial size of the oldest generation.
parent 7f35c865
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* $Id: GC.c,v 1.12 1999/01/18 16:05:15 simonm Exp $ * $Id: GC.c,v 1.13 1999/01/19 15:07:53 simonm Exp $
* *
* Two-space garbage collector * Two-space garbage collector
* *
...@@ -386,8 +386,8 @@ void GarbageCollect(void (*get_roots)(void)) ...@@ -386,8 +386,8 @@ void GarbageCollect(void (*get_roots)(void))
*/ */
if (major_gc) { if (major_gc) {
oldest_gen->max_blocks = oldest_gen->max_blocks =
stg_max(oldest_gen->steps[0].to_blocks * 2, stg_max(oldest_gen->steps[0].to_blocks * RtsFlags.GcFlags.oldGenFactor,
RtsFlags.GcFlags.minAllocAreaSize * 4); RtsFlags.GcFlags.minOldGenSize);
if (oldest_gen->max_blocks > RtsFlags.GcFlags.maxHeapSize / 2) { if (oldest_gen->max_blocks > RtsFlags.GcFlags.maxHeapSize / 2) {
oldest_gen->max_blocks = RtsFlags.GcFlags.maxHeapSize / 2; oldest_gen->max_blocks = RtsFlags.GcFlags.maxHeapSize / 2;
if (((int)oldest_gen->max_blocks - (int)oldest_gen->steps[0].to_blocks) < if (((int)oldest_gen->max_blocks - (int)oldest_gen->steps[0].to_blocks) <
......
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* $Id: RtsFlags.c,v 1.3 1999/01/13 17:25:42 simonm Exp $ * $Id: RtsFlags.c,v 1.4 1999/01/19 15:07:55 simonm Exp $
* *
* Functions for parsing the argument list. * Functions for parsing the argument list.
* *
...@@ -62,8 +62,10 @@ void initRtsFlagsDefaults(void) ...@@ -62,8 +62,10 @@ void initRtsFlagsDefaults(void)
RtsFlags.GcFlags.initialStkSize = 1024 / sizeof(W_); RtsFlags.GcFlags.initialStkSize = 1024 / sizeof(W_);
RtsFlags.GcFlags.minAllocAreaSize = (256 * 1024) / BLOCK_SIZE; RtsFlags.GcFlags.minAllocAreaSize = (256 * 1024) / BLOCK_SIZE;
RtsFlags.GcFlags.minOldGenSize = (1024 * 1024) / BLOCK_SIZE;
RtsFlags.GcFlags.maxHeapSize = (64 * 1024 * 1024) / BLOCK_SIZE; RtsFlags.GcFlags.maxHeapSize = (64 * 1024 * 1024) / BLOCK_SIZE;
RtsFlags.GcFlags.pcFreeHeap = 3; /* 3% */ RtsFlags.GcFlags.pcFreeHeap = 3; /* 3% */
RtsFlags.GcFlags.oldGenFactor = 2;
RtsFlags.GcFlags.generations = 2; RtsFlags.GcFlags.generations = 2;
RtsFlags.GcFlags.forceGC = rtsFalse; RtsFlags.GcFlags.forceGC = rtsFalse;
...@@ -429,6 +431,13 @@ error = rtsTrue; ...@@ -429,6 +431,13 @@ error = rtsTrue;
RtsFlags.GcFlags.ringBell = rtsTrue; RtsFlags.GcFlags.ringBell = rtsTrue;
break; break;
case 'F':
RtsFlags.GcFlags.oldGenFactor = atof(rts_argv[arg]+2);
if (RtsFlags.GcFlags.oldGenFactor < 0)
bad_option( rts_argv[arg] );
break;
#ifdef DEBUG #ifdef DEBUG
case 'D': case 'D':
/* hack warning: interpret the flags as a binary number */ /* hack warning: interpret the flags as a binary number */
......
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* $Id: RtsFlags.h,v 1.3 1999/01/13 17:25:43 simonm Exp $ * $Id: RtsFlags.h,v 1.4 1999/01/19 15:07:55 simonm Exp $
* *
* Datatypes that holds the command-line flag settings. * Datatypes that holds the command-line flag settings.
* *
...@@ -21,6 +21,8 @@ struct GC_FLAGS { ...@@ -21,6 +21,8 @@ struct GC_FLAGS {
nat maxHeapSize; /* in *blocks* */ nat maxHeapSize; /* in *blocks* */
nat minAllocAreaSize; /* in *blocks* */ nat minAllocAreaSize; /* in *blocks* */
nat minOldGenSize; /* in *blocks* */
double oldGenFactor;
double pcFreeHeap; double pcFreeHeap;
nat generations; nat generations;
......
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* $Id: Storage.c,v 1.3 1999/01/13 17:25:47 simonm Exp $ * $Id: Storage.c,v 1.4 1999/01/19 15:07:56 simonm Exp $
* *
* Storage manager front end * Storage manager front end
* *
...@@ -70,7 +70,7 @@ initStorage (void) ...@@ -70,7 +70,7 @@ initStorage (void)
generations[g].n_steps = 1; generations[g].n_steps = 1;
generations[g].steps = generations[g].steps =
stgMallocBytes(1 * sizeof(struct _step), "initStorage: last step"); stgMallocBytes(1 * sizeof(struct _step), "initStorage: last step");
generations[g].max_blocks = RtsFlags.GcFlags.minAllocAreaSize * 4; generations[g].max_blocks = RtsFlags.GcFlags.minOldGenSize;
step = &generations[g].steps[0]; step = &generations[g].steps[0];
step->no = 0; step->no = 0;
step->gen = &generations[g]; step->gen = &generations[g];
...@@ -86,7 +86,7 @@ initStorage (void) ...@@ -86,7 +86,7 @@ initStorage (void)
generations[g].n_steps = 2; generations[g].n_steps = 2;
generations[g].steps = stgMallocBytes (2 * sizeof(struct _step), generations[g].steps = stgMallocBytes (2 * sizeof(struct _step),
"initStorage: steps"); "initStorage: steps");
generations[g].max_blocks = RtsFlags.GcFlags.minAllocAreaSize * 4; generations[g].max_blocks = RtsFlags.GcFlags.minOldGenSize;
} }
for (g = 0; g < RtsFlags.GcFlags.generations-1; g++) { for (g = 0; g < RtsFlags.GcFlags.generations-1; g++) {
......
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