diff options
author | Simon Marlow <simonmar@microsoft.com> | 2007-10-31 12:51:36 +0000 |
---|---|---|
committer | Simon Marlow <simonmar@microsoft.com> | 2007-10-31 12:51:36 +0000 |
commit | d5bd3e829c47c03157cf41cad581d2df44dfd81b (patch) | |
tree | 98fb99c2713190f77d1999345888b2dcdabe5bf2 /rts/RtsFlags.c | |
parent | 9e5fe6be620eaf03a86f1321bef603ca43699a3c (diff) | |
download | haskell-d5bd3e829c47c03157cf41cad581d2df44dfd81b.tar.gz |
Refactoring of the GC in preparation for parallel GC
This patch localises the state of the GC into a gc_thread structure,
and reorganises the inner loop of the GC to scavenge one block at a
time from global work lists in each "step". The gc_thread structure
has a "workspace" for each step, in which it collects evacuated
objects until it has a full block to push out to the step's global
list. Details of the algorithm will be on the wiki in due course.
At the moment, THREADED_RTS does not compile, but the single-threaded
GC works (and is 10-20% slower than before).
Diffstat (limited to 'rts/RtsFlags.c')
-rw-r--r-- | rts/RtsFlags.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index f8c8403328..69064ea743 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -212,6 +212,7 @@ void initRtsFlagsDefaults(void) RtsFlags.ParFlags.nNodes = 1; RtsFlags.ParFlags.migrate = rtsTrue; RtsFlags.ParFlags.wakeupMigrate = rtsFalse; + RtsFlags.ParFlags.gcThreads = 1; #endif #ifdef PAR @@ -445,6 +446,7 @@ usage_text[] = { #endif /* DEBUG */ #if defined(THREADED_RTS) && !defined(NOSMP) " -N<n> Use <n> OS threads (default: 1)", +" -g<n> Use <n> OS threads for GC (default: 1)", " -qm Don't automatically migrate threads between CPUs", " -qw Migrate a thread to the current CPU when it is woken up", #endif @@ -1117,6 +1119,18 @@ error = rtsTrue; errorBelch("bad value for -N"); error = rtsTrue; } + } + ) break; + + case 'g': + THREADED_BUILD_ONLY( + if (rts_argv[arg][2] != '\0') { + RtsFlags.ParFlags.gcThreads + = strtol(rts_argv[arg]+2, (char **) NULL, 10); + if (RtsFlags.ParFlags.nNodes <= 0) { + errorBelch("bad value for -g"); + error = rtsTrue; + } #if defined(PROFILING) if (RtsFlags.ParFlags.nNodes > 1) { errorBelch("bad option %s: only -N1 is supported with profiling", rts_argv[arg]); |