2 These routines customise the error messages
3 for various bits of the RTS. They are linked
4 in instead of the defaults.
9 #if __GLASGOW_HASKELL__ >= 400
10 #include "../rts/Rts.h"
15 #if __GLASGOW_HASKELL__ >= 505
16 #include "../rts/Rts.h"
17 #include "../includes/RtsFlags.h"
23 #if __GLASGOW_HASKELL__ >= 502
27 #if __GLASGOW_HASKELL__ >= 408
35 #if __GLASGOW_HASKELL__ >= 504
37 char *ghc_rts_opts = "-H8m -K8m";
44 #if __GLASGOW_HASKELL__ >= 408
45 RtsFlags.GcFlags.heapSizeSuggestion = 6*1024*1024 / BLOCK_SIZE;
46 RtsFlags.GcFlags.maxStkSize = 8*1024*1024 / sizeof(W_);
48 #if __GLASGOW_HASKELL__ >= 411
49 RtsFlags.GcFlags.giveStats = COLLECT_GC_STATS;
50 RtsFlags.GcFlags.statsFile = stderr;
56 enableTimingStats( void ) /* called from the driver */
58 #if __GLASGOW_HASKELL__ >= 505
59 RtsFlags.GcFlags.giveStats = ONELINE_GC_STATS;
61 /* ignored when bootstrapping with an older GHC */
65 setHeapSize( HsInt size )
67 #if __GLASGOW_HASKELL__ >= 408
68 RtsFlags.GcFlags.heapSizeSuggestion = size / BLOCK_SIZE;
69 if (RtsFlags.GcFlags.maxHeapSize != 0 &&
70 RtsFlags.GcFlags.heapSizeSuggestion > RtsFlags.GcFlags.maxHeapSize) {
71 RtsFlags.GcFlags.maxHeapSize = RtsFlags.GcFlags.heapSizeSuggestion;
77 PreTraceHook (long fd)
79 const char msg[]="\n";
80 write(fd,msg,sizeof(msg)-1);
84 PostTraceHook (long fd)
87 const char msg[]="\n";
88 write(fd,msg,sizeof(msg)-1);
93 OutOfHeapHook (unsigned long request_size, unsigned long heap_size)
96 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",
102 StackOverflowHook (unsigned long stack_size) /* in bytes */
104 fprintf(stderr, "GHC stack-space overflow: current size %ld bytes.\nUse the `-K<size>' option to increase it.\n", stack_size);
108 ghc_strlen( HsAddr a )
110 return (strlen((char *)a));
114 ghc_memcmp( HsAddr a1, HsAddr a2, HsInt len )
116 return (memcmp((char *)a1, a2, len));
120 ghc_memcmp_off( HsAddr a1, HsInt i, HsAddr a2, HsInt len )
122 return (memcmp((char *)a1 + i, a2, len));