641b9f769b04c79e232caf065fd5152d9048e107
[ghc-hetmet.git] / ghc / 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 (
8         mAX_CONTEXT_REDUCTION_DEPTH,
9         mAX_TUPLE_SIZE,
10
11         mAX_SPEC_THUNK_SIZE,
12         mAX_SPEC_FUN_SIZE,
13         mAX_SPEC_CONSTR_SIZE,
14         mAX_SPEC_SELECTEE_SIZE,
15         mAX_SPEC_AP_SIZE,
16
17         mIN_UPD_SIZE,
18         mIN_SIZE_NonUpdHeapObject,
19
20         sTD_HDR_SIZE,
21         pROF_HDR_SIZE,
22         gRAN_HDR_SIZE,
23         tICKY_HDR_SIZE,
24         aRR_WORDS_HDR_SIZE,
25         aRR_PTRS_HDR_SIZE,
26         rESERVED_C_STACK_BYTES,
27
28         sTD_ITBL_SIZE,
29         pROF_ITBL_SIZE,
30         gRAN_ITBL_SIZE,
31         tICKY_ITBL_SIZE,
32
33         mAX_FAMILY_SIZE_FOR_VEC_RETURNS,
34
35         uF_SIZE,
36         sCC_UF_SIZE,
37         gRAN_UF_SIZE,  -- HWL
38         uF_RET,
39         uF_SU,
40         uF_UPDATEE,
41         uF_CCS,
42
43         sEQ_FRAME_SIZE,
44         sCC_SEQ_FRAME_SIZE,
45         gRAN_SEQ_FRAME_SIZE, -- HWL
46
47         mAX_Vanilla_REG,
48         mAX_Float_REG,
49         mAX_Double_REG,
50         mAX_Long_REG,
51
52         mAX_Real_Vanilla_REG,
53         mAX_Real_Float_REG,
54         mAX_Real_Double_REG,
55         mAX_Real_Long_REG,
56
57         oTHER_TAG,
58
59         mAX_INTLIKE, mIN_INTLIKE,
60
61         spRelToInt,
62
63         dOUBLE_SIZE,
64         iNT64_SIZE,
65         wORD64_SIZE,
66         
67         bLOCK_SIZE,
68
69         interfaceFileFormatVersion
70
71     ) where
72
73 -- This magical #include brings in all the everybody-knows-these magic
74 -- constants unfortunately, we need to be *explicit* about which one
75 -- we want; if we just hope a -I... will get the right one, we could
76 -- be in trouble.
77
78 #include "HsVersions.h"
79 #include "../includes/config.h"
80 #include "../includes/MachRegs.h"
81 #include "../includes/Constants.h"
82
83 -- import Util
84 \end{code}
85
86 All pretty arbitrary:
87
88 \begin{code}
89 mAX_TUPLE_SIZE = (37 :: Int)
90 mAX_CONTEXT_REDUCTION_DEPTH = (20 :: Int)
91 \end{code}
92
93
94 \begin{code}
95 -- specialised fun/thunk/constr closure types
96 mAX_SPEC_THUNK_SIZE   = (MAX_SPEC_THUNK_SIZE :: Int)
97 mAX_SPEC_FUN_SIZE     = (MAX_SPEC_FUN_SIZE :: Int)
98 mAX_SPEC_CONSTR_SIZE  = (MAX_SPEC_CONSTR_SIZE :: Int)
99
100 -- pre-compiled thunk types
101 mAX_SPEC_SELECTEE_SIZE  = (MAX_SPEC_SELECTEE_SIZE :: Int)
102 mAX_SPEC_AP_SIZE        = (MAX_SPEC_AP_SIZE :: Int)
103
104 -- closure sizes: these do NOT include the header (see below for header sizes)
105 mIN_UPD_SIZE                    = (MIN_UPD_SIZE::Int)
106 mIN_SIZE_NonUpdHeapObject       = (MIN_NONUPD_SIZE::Int)
107 \end{code}
108
109 Constants for semi-tagging; the tags associated with the data
110 constructors will start at 0 and go up.
111
112 \begin{code}
113 oTHER_TAG = (INFO_OTHER_TAG :: Integer) -- (-1) unevaluated, probably
114 \end{code}
115
116 \begin{code}
117 mIN_INTLIKE, mAX_INTLIKE :: Integer     -- Only used to compare with (MachInt Integer)
118 mIN_INTLIKE = MIN_INTLIKE
119 mAX_INTLIKE = MAX_INTLIKE
120 \end{code}
121
122 A little function that abstracts the stack direction.  Note that most
123 of the code generator is dependent on the stack direction anyway, so
124 changing this on its own spells certain doom.  ToDo: remove?
125
126 \begin{code}
127 -- THIS IS DIRECTION SENSITIVE!
128
129 -- stack grows down, positive virtual offsets correspond to negative
130 -- additions to the stack pointer.
131
132 spRelToInt :: Int{-VirtualSpOffset-} -> Int{-VirtualSpOffset-} -> Int
133 spRelToInt sp off = sp - off
134 \end{code}
135
136 A section of code-generator-related MAGIC CONSTANTS.
137
138 \begin{code}
139 mAX_FAMILY_SIZE_FOR_VEC_RETURNS = (MAX_VECTORED_RTN::Int)  -- pretty arbitrary
140 -- If you change this, you may need to change runtimes/standard/Update.lhc
141
142 -- The update frame sizes
143 uF_SIZE = (NOSCC_UF_SIZE::Int)
144
145 -- Same again, with profiling
146 sCC_UF_SIZE = (SCC_UF_SIZE::Int)
147
148 -- Same again, with gransim
149 gRAN_UF_SIZE = (GRAN_UF_SIZE::Int)
150
151 -- Offsets in an update frame.  They don't change with profiling!
152 uF_RET         = (UF_RET::Int)
153 uF_SU          = (UF_SU::Int)
154 uF_UPDATEE     = (UF_UPDATEE::Int)
155 uF_CCS         = (UF_CCS::Int)
156 \end{code}
157
158 Seq frame sizes.
159
160 \begin{code}
161 sEQ_FRAME_SIZE = (NOSCC_SEQ_FRAME_SIZE::Int)
162 sCC_SEQ_FRAME_SIZE = (SCC_SEQ_FRAME_SIZE::Int)
163 gRAN_SEQ_FRAME_SIZE = (GRAN_SEQ_FRAME_SIZE::Int)
164 \end{code}
165
166 \begin{code}
167 mAX_Vanilla_REG = (MAX_VANILLA_REG :: Int)
168 mAX_Float_REG   = (MAX_FLOAT_REG :: Int)
169 mAX_Double_REG  = (MAX_DOUBLE_REG :: Int)
170 mAX_Long_REG    = (MAX_LONG_REG  :: Int)
171
172 mAX_Real_Vanilla_REG    = (MAX_REAL_VANILLA_REG :: Int)
173 mAX_Real_Float_REG      = (MAX_REAL_FLOAT_REG :: Int)
174 mAX_Real_Double_REG     = (MAX_REAL_DOUBLE_REG :: Int)
175 #ifdef MAX_REAL_LONG_REG
176 mAX_Real_Long_REG       = (MAX_REAL_LONG_REG :: Int)
177 #else
178 mAX_Real_Long_REG       = (0::Int)
179 #endif
180 \end{code}
181
182 Closure header sizes.
183
184 \begin{code}
185 sTD_HDR_SIZE       = (STD_HDR_SIZE       :: Int)
186 pROF_HDR_SIZE      = (PROF_HDR_SIZE      :: Int)
187 gRAN_HDR_SIZE      = (GRAN_HDR_SIZE      :: Int)
188 tICKY_HDR_SIZE     = (TICKY_HDR_SIZE     :: Int)
189 aRR_WORDS_HDR_SIZE = (ARR_WORDS_HDR_SIZE :: Int)
190 aRR_PTRS_HDR_SIZE  = (ARR_PTRS_HDR_SIZE  :: Int)
191 \end{code}
192
193 Info Table sizes.
194
195 \begin{code}
196 sTD_ITBL_SIZE   = (STD_ITBL_SIZE   :: Int)
197 pROF_ITBL_SIZE  = (PROF_ITBL_SIZE  :: Int)
198 gRAN_ITBL_SIZE  = (GRAN_ITBL_SIZE  :: Int)
199 tICKY_ITBL_SIZE = (TICKY_ITBL_SIZE :: Int)
200 \end{code}
201
202 Size of a double in StgWords.
203
204 \begin{code}
205 dOUBLE_SIZE    = (DOUBLE_SIZE   :: Int)
206 wORD64_SIZE    = (WORD64_SIZE   :: Int)
207 iNT64_SIZE     = (INT64_SIZE   :: Int)
208 \end{code}
209
210 The version of the interface file format we're
211 using:
212
213 \begin{code}
214 interfaceFileFormatVersion :: Int
215 interfaceFileFormatVersion = HscIfaceFileVersion
216 \end{code}
217
218 This tells the native code generator the size of the spill
219 area is has available.
220
221 \begin{code}
222 rESERVED_C_STACK_BYTES = (RESERVED_C_STACK_BYTES :: Int)
223 \end{code}
224
225 Size of a storage manager block (in bytes).
226
227 \begin{code}
228 bLOCK_SIZE = (BLOCK_SIZE :: Int)
229 \end{code}