Allow non-operator infix pattern synonyms
[ghc.git] / compiler / parser / cutils.c
1 /*
2 These utility routines are used various
3 places in the GHC library.
4 */
5
6 #include "Rts.h"
7
8 #include "HsFFI.h"
9
10 #include <string.h>
11
12 #ifdef HAVE_UNISTD_H
13 #include <unistd.h>
14 #endif
15
16 /*
17 Calling 'strlen' and 'memcpy' directly gives problems with GCC's inliner,
18 and causes gcc to require too many registers on x84
19 */
20
21 HsInt
22 ghc_strlen( HsPtr a )
23 {
24 return (strlen((char *)a));
25 }
26
27 HsInt
28 ghc_memcmp( HsPtr a1, HsPtr a2, HsInt len )
29 {
30 return (memcmp((char *)a1, a2, len));
31 }
32
33 void
34 enableTimingStats( void ) /* called from the driver */
35 {
36 RtsFlags.GcFlags.giveStats = ONELINE_GC_STATS;
37 }
38
39 void
40 setHeapSize( HsInt size )
41 {
42 RtsFlags.GcFlags.heapSizeSuggestion = size / BLOCK_SIZE;
43 if (RtsFlags.GcFlags.maxHeapSize != 0 &&
44 RtsFlags.GcFlags.heapSizeSuggestion > RtsFlags.GcFlags.maxHeapSize) {
45 RtsFlags.GcFlags.maxHeapSize = RtsFlags.GcFlags.heapSizeSuggestion;
46 }
47 }