summaryrefslogtreecommitdiff
path: root/ghc/hschooks.c
diff options
context:
space:
mode:
authorAustin Seipp <austin@well-typed.com>2014-02-20 06:41:02 -0600
committerAustin Seipp <austin@well-typed.com>2014-02-20 07:15:58 -0600
commitc72e8898447b2a8e55f2d16594b5944c2ae13e24 (patch)
tree3407929fd25aaad0fea8ba8ec9034ada21575629 /ghc/hschooks.c
parent5a576754d745171422d13cd1dba69dd874714cf1 (diff)
downloadhaskell-c72e8898447b2a8e55f2d16594b5944c2ae13e24.tar.gz
Fix #8754 again.
This time, we carefully initialize the GC stats only if they're not already initialized - this way the user can override them (e.g. `+RTS -t --machine-readable`). Signed-off-by: Austin Seipp <austin@well-typed.com>
Diffstat (limited to 'ghc/hschooks.c')
-rw-r--r--ghc/hschooks.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/ghc/hschooks.c b/ghc/hschooks.c
index 4e6e66d3e2..4c588d0ef7 100644
--- a/ghc/hschooks.c
+++ b/ghc/hschooks.c
@@ -16,6 +16,18 @@ in instead of the defaults.
#endif
void
+initGCStatistics(void)
+{
+ /* Workaround for #8754: if the GC stats aren't enabled because the
+ compiler couldn't use -Bsymbolic to link the default hooks, then
+ initialize them sensibly. See Note [-Bsymbolic and hooks] in
+ Main.hs. */
+ if (RtsFlags.GcFlags.giveStats == NO_GC_STATS) {
+ RtsFlags.GcFlags.giveStats = COLLECT_GC_STATS;
+ }
+}
+
+void
defaultsHook (void)
{
#if __GLASGOW_HASKELL__ >= 707
@@ -28,7 +40,8 @@ defaultsHook (void)
#endif
RtsFlags.GcFlags.maxStkSize = 512*1024*1024 / sizeof(W_);
- RtsFlags.GcFlags.giveStats = COLLECT_GC_STATS;
+
+ initGCStatistics();
// See #3408: the default idle GC time of 0.3s is too short on
// Windows where we receive console events once per second or so.