summaryrefslogtreecommitdiff
path: root/compiler/cbits/cutils.c
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/cbits/cutils.c')
-rw-r--r--compiler/cbits/cutils.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/compiler/cbits/cutils.c b/compiler/cbits/cutils.c
new file mode 100644
index 0000000000..fb7e3f7335
--- /dev/null
+++ b/compiler/cbits/cutils.c
@@ -0,0 +1,24 @@
+/*
+These utility routines are used various
+places in the GHC library.
+*/
+
+#include <Rts.h>
+
+#include <HsFFI.h>
+
+void
+enableTimingStats( void ) /* called from the driver */
+{
+ RtsFlags.GcFlags.giveStats = ONELINE_GC_STATS;
+}
+
+void
+setHeapSize( HsInt size )
+{
+ RtsFlags.GcFlags.heapSizeSuggestion = size / BLOCK_SIZE;
+ if (RtsFlags.GcFlags.maxHeapSize != 0 &&
+ RtsFlags.GcFlags.heapSizeSuggestion > RtsFlags.GcFlags.maxHeapSize) {
+ RtsFlags.GcFlags.maxHeapSize = RtsFlags.GcFlags.heapSizeSuggestion;
+ }
+}