From c2ce3c04a00b4b8b21c113ea02a80546d3e6cf71 Mon Sep 17 00:00:00 2001 From: simonm Date: Tue, 19 Jan 1999 15:07:56 +0000 Subject: [PATCH] [project @ 1999-01-19 15:07:53 by simonm] - Add -F 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. --- ghc/rts/GC.c | 6 +++--- ghc/rts/RtsFlags.c | 11 ++++++++++- ghc/rts/RtsFlags.h | 4 +++- ghc/rts/Storage.c | 6 +++--- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/ghc/rts/GC.c b/ghc/rts/GC.c index d057c19..1b3dc0d 100644 --- a/ghc/rts/GC.c +++ b/ghc/rts/GC.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $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 * @@ -386,8 +386,8 @@ void GarbageCollect(void (*get_roots)(void)) */ if (major_gc) { oldest_gen->max_blocks = - stg_max(oldest_gen->steps[0].to_blocks * 2, - RtsFlags.GcFlags.minAllocAreaSize * 4); + stg_max(oldest_gen->steps[0].to_blocks * RtsFlags.GcFlags.oldGenFactor, + RtsFlags.GcFlags.minOldGenSize); if (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) < diff --git a/ghc/rts/RtsFlags.c b/ghc/rts/RtsFlags.c index 19c522e..2d378b5 100644 --- a/ghc/rts/RtsFlags.c +++ b/ghc/rts/RtsFlags.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $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. * @@ -62,8 +62,10 @@ void initRtsFlagsDefaults(void) RtsFlags.GcFlags.initialStkSize = 1024 / sizeof(W_); RtsFlags.GcFlags.minAllocAreaSize = (256 * 1024) / BLOCK_SIZE; + RtsFlags.GcFlags.minOldGenSize = (1024 * 1024) / BLOCK_SIZE; RtsFlags.GcFlags.maxHeapSize = (64 * 1024 * 1024) / BLOCK_SIZE; RtsFlags.GcFlags.pcFreeHeap = 3; /* 3% */ + RtsFlags.GcFlags.oldGenFactor = 2; RtsFlags.GcFlags.generations = 2; RtsFlags.GcFlags.forceGC = rtsFalse; @@ -429,6 +431,13 @@ error = rtsTrue; RtsFlags.GcFlags.ringBell = rtsTrue; break; + case 'F': + RtsFlags.GcFlags.oldGenFactor = atof(rts_argv[arg]+2); + + if (RtsFlags.GcFlags.oldGenFactor < 0) + bad_option( rts_argv[arg] ); + break; + #ifdef DEBUG case 'D': /* hack warning: interpret the flags as a binary number */ diff --git a/ghc/rts/RtsFlags.h b/ghc/rts/RtsFlags.h index 7d2982b..ce6ba6d 100644 --- a/ghc/rts/RtsFlags.h +++ b/ghc/rts/RtsFlags.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $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. * @@ -21,6 +21,8 @@ struct GC_FLAGS { nat maxHeapSize; /* in *blocks* */ nat minAllocAreaSize; /* in *blocks* */ + nat minOldGenSize; /* in *blocks* */ + double oldGenFactor; double pcFreeHeap; nat generations; diff --git a/ghc/rts/Storage.c b/ghc/rts/Storage.c index 3d7a0b7..0403f44 100644 --- a/ghc/rts/Storage.c +++ b/ghc/rts/Storage.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $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 * @@ -70,7 +70,7 @@ initStorage (void) generations[g].n_steps = 1; generations[g].steps = 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->no = 0; step->gen = &generations[g]; @@ -86,7 +86,7 @@ initStorage (void) generations[g].n_steps = 2; generations[g].steps = stgMallocBytes (2 * sizeof(struct _step), "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++) { -- 1.7.10.4