summaryrefslogtreecommitdiff
path: root/ghc/hschooks.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2009-09-11 14:07:02 +0000
committerSimon Marlow <marlowsd@gmail.com>2009-09-11 14:07:02 +0000
commit02ad6e66c67e486c84678f2fc8cc73396b755722 (patch)
tree373e7c629c61b8aaccdf535f5f90a6f2502e0409 /ghc/hschooks.c
parent4e1b5ce4d026c1b8344b45d03f8702dbf011db50 (diff)
downloadhaskell-02ad6e66c67e486c84678f2fc8cc73396b755722.tar.gz
move hschooks.c to ghc/, and enable it
Diffstat (limited to 'ghc/hschooks.c')
-rw-r--r--ghc/hschooks.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/ghc/hschooks.c b/ghc/hschooks.c
new file mode 100644
index 0000000000..2224b0210e
--- /dev/null
+++ b/ghc/hschooks.c
@@ -0,0 +1,38 @@
+/*
+These routines customise the error messages
+for various bits of the RTS. They are linked
+in instead of the defaults.
+*/
+
+#include "Rts.h"
+#if __GLASGOW_HASKELL__ <611
+#include "RtsFlags.h"
+#endif
+
+#include "HsFFI.h"
+
+#include <string.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+void
+defaultsHook (void)
+{
+ RtsFlags.GcFlags.heapSizeSuggestion = 6*1024*1024 / BLOCK_SIZE;
+ RtsFlags.GcFlags.maxStkSize = 512*1024*1024 / sizeof(W_);
+ RtsFlags.GcFlags.giveStats = COLLECT_GC_STATS;
+ RtsFlags.GcFlags.statsFile = stderr;
+
+ // 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.
+ RtsFlags.GcFlags.idleGCDelayTime = 5*1000;
+}
+
+void
+StackOverflowHook (unsigned long stack_size) /* in bytes */
+{
+ fprintf(stderr, "GHC stack-space overflow: current limit is %ld bytes.\nUse the `-K<size>' option to increase it.\n", stack_size);
+}
+