2 These routines customise the error messages
3 for various bits of the RTS. They are linked
4 in instead of the defaults.
7 #if __GLASGOW_HASKELL__ >= 400
13 #if __GLASGOW_HASKELL__ >= 408
14 #include "../includes/RtsFlags.h"
25 #if __GLASGOW_HASKELL__ >= 408
26 RtsFlags.GcFlags.heapSizeSuggestion = 6*1024*1024 / BLOCK_SIZE;
27 RtsFlags.GcFlags.maxStkSize = 8*1024*1024 / sizeof(W_);
29 #if __GLASGOW_HASKELL__ >= 411
30 RtsFlags.GcFlags.giveStats = COLLECT_GC_STATS;
31 RtsFlags.GcFlags.statsFile = stderr;
36 enableTimingStats( void ) /* called from the driver */
38 #if __GLASGOW_HASKELL__ >= 411
39 RtsFlags.GcFlags.giveStats = ONELINE_GC_STATS;
41 /* ignored when bootstrapping with an older GHC */
45 setHeapSize( HsInt size )
47 #if __GLASGOW_HASKELL__ >= 408
48 RtsFlags.GcFlags.heapSizeSuggestion = size / BLOCK_SIZE;
49 if (RtsFlags.GcFlags.maxHeapSize != 0 &&
50 RtsFlags.GcFlags.heapSizeSuggestion > RtsFlags.GcFlags.maxHeapSize) {
51 RtsFlags.GcFlags.maxHeapSize = RtsFlags.GcFlags.heapSizeSuggestion;
57 PreTraceHook (long fd)
59 const char msg[]="\n";
60 write(fd,msg,sizeof(msg)-1);
64 PostTraceHook (long fd)
67 const char msg[]="\n";
68 write(fd,msg,sizeof(msg)-1);
72 #if __GLASGOW_HASKELL__ >= 400
74 OutOfHeapHook (unsigned long request_size, unsigned long heap_size)
77 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",
83 StackOverflowHook (unsigned long stack_size) /* in bytes */
85 fprintf(stderr, "GHC stack-space overflow: current size %ld bytes.\nUse the `-K<size>' option to increase it.\n", stack_size);
88 #else /* GHC < 4.00 */
91 OutOfHeapHook (W_ request_size, W_ heap_size) /* both in bytes */
93 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",
99 StackOverflowHook (I_ stack_size) /* in bytes */
101 fprintf(stderr, "GHC stack-space overflow: current size %ld bytes.\nUse the `-K<size>' option to increase it.\n", stack_size);
107 ghc_strlen( HsAddr a )
109 return (strlen((char *)a));
113 ghc_memcmp( HsAddr a1, HsAddr a2, HsInt len )
115 return (memcmp((char *)a1, a2, len));
119 ghc_memcmp_off( HsAddr a1, HsInt i, HsAddr a2, HsInt len )
121 return (memcmp((char *)a1 + i, a2, len));