Fix warnings in main/Constants
[ghc-hetmet.git] / compiler / main / Constants.lhs
1 %
2 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
3 %
4 \section[Constants]{Info about this compilation}
5
6 \begin{code}
7 module Constants (module Constants) where
8
9 import Data.Bits (shiftL)
10
11 -- This magical #include brings in all the everybody-knows-these magic
12 -- constants unfortunately, we need to be *explicit* about which one
13 -- we want; if we just hope a -I... will get the right one, we could
14 -- be in trouble.
15
16 -- XXX This define is a bit of a hack, and should be done more nicely
17 #define FAST_STRING_NOT_NEEDED 1
18 #include "HsVersions.h"
19 #include "../includes/MachRegs.h"
20 #include "../includes/Constants.h"
21 #include "../includes/MachDeps.h"
22 #include "../includes/DerivedConstants.h"
23
24 -- import Util
25 \end{code}
26
27 All pretty arbitrary:
28
29 \begin{code}
30 mAX_TUPLE_SIZE :: Int
31 mAX_TUPLE_SIZE = 62 -- Should really match the number
32                     -- of decls in Data.Tuple
33
34 mAX_CONTEXT_REDUCTION_DEPTH :: Int
35 mAX_CONTEXT_REDUCTION_DEPTH = 20
36 \end{code}
37
38
39 \begin{code}
40 -- specialised fun/thunk/constr closure types
41 mAX_SPEC_THUNK_SIZE :: Int
42 mAX_SPEC_THUNK_SIZE = MAX_SPEC_THUNK_SIZE
43
44 mAX_SPEC_FUN_SIZE :: Int
45 mAX_SPEC_FUN_SIZE = MAX_SPEC_FUN_SIZE
46
47 mAX_SPEC_CONSTR_SIZE :: Int
48 mAX_SPEC_CONSTR_SIZE = MAX_SPEC_CONSTR_SIZE
49
50 -- pre-compiled thunk types
51 mAX_SPEC_SELECTEE_SIZE :: Int
52 mAX_SPEC_SELECTEE_SIZE = MAX_SPEC_SELECTEE_SIZE
53
54 mAX_SPEC_AP_SIZE :: Int
55 mAX_SPEC_AP_SIZE = MAX_SPEC_AP_SIZE
56
57 -- closure sizes: these do NOT include the header (see below for header sizes)
58 mIN_PAYLOAD_SIZE ::Int
59 mIN_PAYLOAD_SIZE = MIN_PAYLOAD_SIZE
60 \end{code}
61
62 \begin{code}
63 mIN_INTLIKE, mAX_INTLIKE :: Int 
64 mIN_INTLIKE = MIN_INTLIKE
65 mAX_INTLIKE = MAX_INTLIKE
66
67 mIN_CHARLIKE, mAX_CHARLIKE :: Int
68 mIN_CHARLIKE = MIN_CHARLIKE
69 mAX_CHARLIKE = MAX_CHARLIKE
70 \end{code}
71
72 A section of code-generator-related MAGIC CONSTANTS.
73
74 \begin{code}
75 mAX_Vanilla_REG :: Int
76 mAX_Vanilla_REG = MAX_VANILLA_REG
77
78 mAX_Float_REG :: Int
79 mAX_Float_REG = MAX_FLOAT_REG
80
81 mAX_Double_REG :: Int
82 mAX_Double_REG = MAX_DOUBLE_REG
83
84 mAX_Long_REG :: Int
85 mAX_Long_REG = MAX_LONG_REG
86
87 mAX_Real_Vanilla_REG :: Int
88 mAX_Real_Vanilla_REG = MAX_REAL_VANILLA_REG
89
90 mAX_Real_Float_REG :: Int
91 mAX_Real_Float_REG = MAX_REAL_FLOAT_REG
92
93 mAX_Real_Double_REG :: Int
94 mAX_Real_Double_REG     = MAX_REAL_DOUBLE_REG
95
96 mAX_Real_Long_REG :: Int
97 #ifdef MAX_REAL_LONG_REG
98 mAX_Real_Long_REG = MAX_REAL_LONG_REG
99 #else
100 mAX_Real_Long_REG = 0
101 #endif
102 \end{code}
103
104 Closure header sizes.
105
106 \begin{code}
107 sTD_HDR_SIZE :: Int
108 sTD_HDR_SIZE = STD_HDR_SIZE
109
110 pROF_HDR_SIZE :: Int
111 pROF_HDR_SIZE = PROF_HDR_SIZE
112
113 gRAN_HDR_SIZE :: Int
114 gRAN_HDR_SIZE = GRAN_HDR_SIZE
115 \end{code}
116
117 Size of a double in StgWords.
118
119 \begin{code}
120 dOUBLE_SIZE :: Int
121 dOUBLE_SIZE = SIZEOF_DOUBLE
122
123 wORD64_SIZE :: Int
124 wORD64_SIZE = 8
125
126 iNT64_SIZE :: Int
127 iNT64_SIZE = wORD64_SIZE
128 \end{code}
129
130 This tells the native code generator the size of the spill
131 area is has available.
132
133 \begin{code}
134 rESERVED_C_STACK_BYTES :: Int
135 rESERVED_C_STACK_BYTES = RESERVED_C_STACK_BYTES
136 \end{code}
137
138 The amount of (Haskell) stack to leave free for saving registers when
139 returning to the scheduler.
140
141 \begin{code}
142 rESERVED_STACK_WORDS :: Int
143 rESERVED_STACK_WORDS = RESERVED_STACK_WORDS
144 \end{code}
145
146 Continuations that need more than this amount of stack should do their
147 own stack check (see bug #1466).
148
149 \begin{code}
150 aP_STACK_SPLIM :: Int
151 aP_STACK_SPLIM = AP_STACK_SPLIM
152 \end{code}
153
154 Size of a word, in bytes
155
156 \begin{code}
157 wORD_SIZE :: Int
158 wORD_SIZE = SIZEOF_HSWORD
159
160 wORD_SIZE_IN_BITS :: Int
161 wORD_SIZE_IN_BITS = wORD_SIZE * 8
162 \end{code}
163
164 Amount of pointer bits used for semi-tagging constructor closures
165
166 \begin{code}
167 tAG_BITS :: Int
168 tAG_BITS = TAG_BITS
169
170 tAG_MASK :: Int
171 tAG_MASK = (1 `shiftL` tAG_BITS) - 1
172
173 mAX_PTR_TAG :: Int
174 mAX_PTR_TAG = tAG_MASK
175 \end{code}
176
177 Size of a C int, in bytes. May be smaller than wORD_SIZE.
178
179 \begin{code}
180 cINT_SIZE :: Int
181 cINT_SIZE = SIZEOF_INT
182 \end{code}
183
184 Size of a storage manager block (in bytes).
185
186 \begin{code}
187 bLOCK_SIZE :: Int
188 bLOCK_SIZE = BLOCK_SIZE
189 bLOCK_SIZE_W :: Int
190 bLOCK_SIZE_W = bLOCK_SIZE `quot` wORD_SIZE
191 \end{code}
192
193 Number of bits to shift a bitfield left by in an info table.
194
195 \begin{code}
196 bITMAP_BITS_SHIFT :: Int
197 bITMAP_BITS_SHIFT = BITMAP_BITS_SHIFT
198 \end{code}
199
200 Constants derived from headers in ghc/includes, generated by the program
201 ../includes/mkDerivedConstants.c.
202
203 \begin{code}
204 #include "../includes/GHCConstants.h"
205 \end{code}