2 These routines customise the error messages
3 for various bits of the RTS. They are linked
4 in instead of the defaults.
9 /* For GHC 4.08, we are relying on the fact that RtsFlags has
10 * compatibile layout with the current version, because we're
11 * #including the current version of RtsFlags.h below. 4.08 didn't
12 * ship with its own RtsFlags.h, unfortunately. For later GHC
13 * versions, we #include the correct RtsFlags.h.
15 #if __GLASGOW_HASKELL__ < 502
16 #include "../includes/Rts.h"
17 #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__ >= 505
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 PreTraceHook (long fd)
63 const char msg[]="\n";
64 write(fd,msg,sizeof(msg)-1);
68 PostTraceHook (long fd)
71 const char msg[]="\n";
72 write(fd,msg,sizeof(msg)-1);
77 OutOfHeapHook (unsigned long request_size, unsigned long heap_size)
80 fprintf(stderr, "GHC's heap exhausted;\nwhile trying to allocate %lu bytes in a %lu-byte heap;\nuse the `-H<size>' option to increase the total heap size.\n",
86 StackOverflowHook (unsigned long stack_size) /* in bytes */
88 fprintf(stderr, "GHC stack-space overflow: current size %ld bytes.\nUse the `-K<size>' option to increase it.\n", stack_size);
92 ghc_strlen( HsAddr a )
94 return (strlen((char *)a));
98 ghc_memcmp( HsAddr a1, HsAddr a2, HsInt len )
100 return (memcmp((char *)a1, a2, len));
104 ghc_memcmp_off( HsAddr a1, HsInt i, HsAddr a2, HsInt len )
106 return (memcmp((char *)a1 + i, a2, len));