[commit: ghc] wip/nonmoving-gc: rts: Introduce flag to enable the nonmoving old generation (e2889e8)
git at git.haskell.org
git at git.haskell.org
Wed Feb 6 14:10:04 UTC 2019
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/nonmoving-gc
Link : http://ghc.haskell.org/trac/ghc/changeset/e2889e8aad4a40645f07a052d0892528a53df4c7/ghc
>---------------------------------------------------------------
commit e2889e8aad4a40645f07a052d0892528a53df4c7
Author: Ben Gamari <ben at well-typed.com>
Date: Tue Feb 5 00:10:43 2019 -0500
rts: Introduce flag to enable the nonmoving old generation
This flag will enable the use of a non-moving oldest generation.
>---------------------------------------------------------------
e2889e8aad4a40645f07a052d0892528a53df4c7
docs/users_guide/runtime_control.rst | 16 ++++++++++++++++
includes/rts/Flags.h | 2 ++
rts/RtsFlags.c | 16 ++++++++++++++++
3 files changed, 34 insertions(+)
diff --git a/docs/users_guide/runtime_control.rst b/docs/users_guide/runtime_control.rst
index a5c2f14..467473a 100644
--- a/docs/users_guide/runtime_control.rst
+++ b/docs/users_guide/runtime_control.rst
@@ -289,6 +289,22 @@ collection. Hopefully, you won't need any of these in normal operation,
but there are several things that can be tweaked for maximum
performance.
+.. rts-flag:: -xn
+
+ :default: off
+ :since: 8.8.1
+
+ .. index::
+ single: concurrent mark and sweep
+
+ Enable the concurrent mark-and-sweep garbage collector for old generation
+ collectors. Typically GHC uses a stop-the-world copying garbage collector
+ for all generations. This can cause long pauses in execution during major
+ garbage collections. :rts-flag:`-xn` enables the use of a concurrent
+ mark-and-sweep garbage collector for oldest generation collections.
+
+ TODO
+
.. rts-flag:: -A ⟨size⟩
:default: 1MB
diff --git a/includes/rts/Flags.h b/includes/rts/Flags.h
index 63450d5..0558abd 100644
--- a/includes/rts/Flags.h
+++ b/includes/rts/Flags.h
@@ -52,6 +52,7 @@ typedef struct _GC_FLAGS {
double oldGenFactor;
double pcFreeHeap;
+ bool useNonmoving;
uint32_t generations;
bool squeezeUpdFrames;
@@ -95,6 +96,7 @@ typedef struct _DEBUG_FLAGS {
bool weak; /* 'w' */
bool gccafs; /* 'G' */
bool gc; /* 'g' */
+ bool nonmoving_gc; /* 'n' */
bool block_alloc; /* 'b' */
bool sanity; /* 'S' warning: might be expensive! */
bool stable; /* 't' */
diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c
index ff9635a..51c9ca6 100644
--- a/rts/RtsFlags.c
+++ b/rts/RtsFlags.c
@@ -153,6 +153,7 @@ void initRtsFlagsDefaults(void)
RtsFlags.GcFlags.heapSizeSuggestionAuto = false;
RtsFlags.GcFlags.pcFreeHeap = 3; /* 3% */
RtsFlags.GcFlags.oldGenFactor = 2;
+ RtsFlags.GcFlags.useNonmoving = false;
RtsFlags.GcFlags.generations = 2;
RtsFlags.GcFlags.squeezeUpdFrames = true;
RtsFlags.GcFlags.compact = false;
@@ -176,6 +177,7 @@ void initRtsFlagsDefaults(void)
RtsFlags.DebugFlags.weak = false;
RtsFlags.DebugFlags.gccafs = false;
RtsFlags.DebugFlags.gc = false;
+ RtsFlags.DebugFlags.nonmoving_gc = false;
RtsFlags.DebugFlags.block_alloc = false;
RtsFlags.DebugFlags.sanity = false;
RtsFlags.DebugFlags.stable = false;
@@ -294,6 +296,7 @@ usage_text[] = {
" -xb<addr> Sets the address from which a suitable start for the heap memory",
" will be searched from. This is useful if the default address",
" clashes with some third-party library.",
+" -xn Use the non-moving collector for the old generation.",
" -m<n> Minimum % of heap which must be available (default 3%)",
" -G<n> Number of generations (default: 2)",
" -c<n> Use in-place compaction instead of copying in the oldest generation",
@@ -399,6 +402,7 @@ usage_text[] = {
" -Dw DEBUG: weak",
" -DG DEBUG: gccafs",
" -Dg DEBUG: gc",
+" -Dn DEBUG: non-moving gc",
" -Db DEBUG: block",
" -DS DEBUG: sanity",
" -Dt DEBUG: stable",
@@ -1517,6 +1521,12 @@ error = true;
break;
#endif
+ case 'n':
+ OPTION_SAFE;
+ RtsFlags.GcFlags.useNonmoving = true;
+ unchecked_arg_start++;
+ break;
+
case 'c': /* Debugging tool: show current cost centre on
an exception */
OPTION_SAFE;
@@ -1690,6 +1700,9 @@ static void normaliseRtsOpts (void)
if (RtsFlags.MiscFlags.generate_dump_file) {
RtsFlags.MiscFlags.install_seh_handlers = true;
}
+
+ if (RtsFlags.GcFlags.useNonmoving && RtsFlags.GcFlags.generations == 1)
+ barf("The non-moving collector doesn't support -G1");
}
static void errorUsage (void)
@@ -1841,6 +1854,9 @@ static void read_debug_flags(const char* arg)
case 'g':
RtsFlags.DebugFlags.gc = true;
break;
+ case 'n':
+ RtsFlags.DebugFlags.nonmoving_gc = true;
+ break;
case 'b':
RtsFlags.DebugFlags.block_alloc = true;
break;
More information about the ghc-commits
mailing list