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 "../rts/RtsFlags.h"
21 #if __GLASGOW_HASKELL__ >= 408
22 RtsFlags.GcFlags.heapSizeSuggestion = 6*1024*1024 / BLOCK_SIZE;
23 RtsFlags.GcFlags.maxStkSize = 8*1024*1024 / sizeof(W_);
25 #if __GLASGOW_HASKELL__ >= 411
26 RtsFlags.GcFlags.giveStats = COLLECT_GC_STATS;
27 RtsFlags.GcFlags.statsFile = stderr;
32 enableTimingStats( void ) /* called from the driver */
34 #if __GLASGOW_HASKELL__ >= 411
35 RtsFlags.GcFlags.giveStats = ONELINE_GC_STATS;
37 /* ignored when bootstrapping with an older GHC */
41 setHeapSize( HsInt size )
43 #if __GLASGOW_HASKELL__ >= 408
44 RtsFlags.GcFlags.heapSizeSuggestion = size / BLOCK_SIZE;
45 if (RtsFlags.GcFlags.heapSizeSuggestion >
46 RtsFlags.GcFlags.maxHeapSize) {
47 RtsFlags.GcFlags.maxHeapSize = RtsFlags.GcFlags.heapSizeSuggestion;
52 #if __GLASGOW_HASKELL__ >= 303
55 ErrorHdrHook (long fd)
62 PatErrorHdrHook (long fd)
64 const char msg[]="\n*** Pattern-matching error within GHC!\n\nThis is a compiler bug; please report it to glasgow-haskell-bugs@haskell.org.\n\nFail:";
65 write(fd,msg,sizeof(msg)-1);
69 PreTraceHook (long fd)
71 const char msg[]="\n";
72 write(fd,msg,sizeof(msg)-1);
76 PostTraceHook (long fd)
79 const char msg[]="\n";
80 write(fd,msg,sizeof(msg)-1);
84 #else /* pre-3.03 GHC with old IO system */
87 ErrorHdrHook (FILE *where)
89 fprintf(where, "\n"); /* no "Fail: " */
93 PatErrorHdrHook (FILE *where)
95 fprintf(where, "\n*** Pattern-matching error within GHC!\n\nThis is a compiler bug; please report it to glasgow-haskell-bugs@haskell.org.\n\nFail: ");
99 PreTraceHook (FILE *where)
101 fprintf(where, "\n"); /* not "Trace On" */
105 PostTraceHook (FILE *where)
107 fprintf(where, "\n"); /* not "Trace Off" */
112 #if __GLASGOW_HASKELL__ >= 400
114 OutOfHeapHook (unsigned long request_size, unsigned long heap_size)
117 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",
123 StackOverflowHook (unsigned long stack_size) /* in bytes */
125 fprintf(stderr, "GHC stack-space overflow: current size %ld bytes.\nUse the `-K<size>' option to increase it.\n", stack_size);
128 #else /* GHC < 4.00 */
131 OutOfHeapHook (W_ request_size, W_ heap_size) /* both in bytes */
133 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",
139 StackOverflowHook (I_ stack_size) /* in bytes */
141 fprintf(stderr, "GHC stack-space overflow: current size %ld bytes.\nUse the `-K<size>' option to increase it.\n", stack_size);