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