2 These routines customise the error messages
3 for various bits of the RTS. They are linked
4 in instead of the defaults.
7 /* For GHC 4.08, we are relying on the fact that RtsFlags has
8 * compatibile layout with the current version, because we're
9 * #including the current version of RtsFlags.h below. 4.08 didn't
10 * ship with its own RtsFlags.h, unfortunately. For later GHC
11 * versions, we #include the correct RtsFlags.h.
13 #if __GLASGOW_HASKELL__ < 502
14 #include "../includes/Rts.h"
15 #include "../includes/RtsFlags.h"
32 RtsFlags.GcFlags.heapSizeSuggestion = 6*1024*1024 / BLOCK_SIZE;
33 RtsFlags.GcFlags.maxStkSize = 8*1024*1024 / sizeof(W_);
34 #if __GLASGOW_HASKELL__ >= 411
35 /* GHC < 4.11 didn't have these */
36 RtsFlags.GcFlags.giveStats = COLLECT_GC_STATS;
37 RtsFlags.GcFlags.statsFile = stderr;
42 enableTimingStats( void ) /* called from the driver */
44 #if __GLASGOW_HASKELL__ >= 411
45 RtsFlags.GcFlags.giveStats = ONELINE_GC_STATS;
47 /* ignored when bootstrapping with an older GHC */
51 setHeapSize( HsInt size )
53 RtsFlags.GcFlags.heapSizeSuggestion = size / BLOCK_SIZE;
54 if (RtsFlags.GcFlags.maxHeapSize != 0 &&
55 RtsFlags.GcFlags.heapSizeSuggestion > RtsFlags.GcFlags.maxHeapSize) {
56 RtsFlags.GcFlags.maxHeapSize = RtsFlags.GcFlags.heapSizeSuggestion;
61 OutOfHeapHook (unsigned long request_size/* always zero these days */,
62 unsigned long heap_size)
65 fprintf(stderr, "GHC's heap exhausted: current limit is %lu bytes;\nUse the `-M<size>' option to increase the total heap size.\n",
70 StackOverflowHook (unsigned long stack_size) /* in bytes */
72 fprintf(stderr, "GHC stack-space overflow: current limit is %ld bytes.\nUse the `-K<size>' option to increase it.\n", stack_size);
76 ghc_strlen( HsAddr a )
78 return (strlen((char *)a));
82 ghc_memcmp( HsAddr a1, HsAddr a2, HsInt len )
84 return (memcmp((char *)a1, a2, len));
88 ghc_memcmp_off( HsAddr a1, HsInt i, HsAddr a2, HsInt len )
90 return (memcmp((char *)a1 + i, a2, len));