091a7de4dc19ee475407289ec19e3a63fc787638
[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 (module Constants) where
8
9 -- This magical #include brings in all the everybody-knows-these magic
10 -- constants unfortunately, we need to be *explicit* about which one
11 -- we want; if we just hope a -I... will get the right one, we could
12 -- be in trouble.
13
14 #include "HsVersions.h"
15 #include "../includes/ghcconfig.h"
16 #include "../includes/MachRegs.h"
17 #include "../includes/Constants.h"
18 #include "../includes/MachDeps.h"
19 #include "../includes/DerivedConstants.h"
20
21 -- import Util
22 \end{code}
23
24 All pretty arbitrary:
25
26 \begin{code}
27 mAX_TUPLE_SIZE = (62 :: Int)    -- Should really match the number
28                                 -- of decls in Data.Tuple
29 mAX_CONTEXT_REDUCTION_DEPTH = (20 :: Int)
30 \end{code}
31
32
33 \begin{code}
34 -- specialised fun/thunk/constr closure types
35 mAX_SPEC_THUNK_SIZE   = (MAX_SPEC_THUNK_SIZE :: Int)
36 mAX_SPEC_FUN_SIZE     = (MAX_SPEC_FUN_SIZE :: Int)
37 mAX_SPEC_CONSTR_SIZE  = (MAX_SPEC_CONSTR_SIZE :: Int)
38
39 -- pre-compiled thunk types
40 mAX_SPEC_SELECTEE_SIZE  = (MAX_SPEC_SELECTEE_SIZE :: Int)
41 mAX_SPEC_AP_SIZE        = (MAX_SPEC_AP_SIZE :: Int)
42
43 -- closure sizes: these do NOT include the header (see below for header sizes)
44 mIN_UPD_SIZE                    = (MIN_UPD_SIZE::Int)
45 mIN_SIZE_NonUpdHeapObject       = (MIN_NONUPD_SIZE::Int)
46 \end{code}
47
48 \begin{code}
49 mIN_INTLIKE, mAX_INTLIKE :: Int 
50 mIN_INTLIKE = MIN_INTLIKE
51 mAX_INTLIKE = MAX_INTLIKE
52
53 mIN_CHARLIKE, mAX_CHARLIKE :: Int
54 mIN_CHARLIKE = MIN_CHARLIKE
55 mAX_CHARLIKE = MAX_CHARLIKE
56 \end{code}
57
58 A section of code-generator-related MAGIC CONSTANTS.
59
60 \begin{code}
61 mAX_FAMILY_SIZE_FOR_VEC_RETURNS = (MAX_VECTORED_RTN::Int)  -- pretty arbitrary
62 -- If you change this, you may need to change runtimes/standard/Update.lhc
63 \end{code}
64
65 \begin{code}
66 mAX_Vanilla_REG = (MAX_VANILLA_REG :: Int)
67 mAX_Float_REG   = (MAX_FLOAT_REG :: Int)
68 mAX_Double_REG  = (MAX_DOUBLE_REG :: Int)
69 mAX_Long_REG    = (MAX_LONG_REG  :: Int)
70
71 mAX_Real_Vanilla_REG    = (MAX_REAL_VANILLA_REG :: Int)
72 mAX_Real_Float_REG      = (MAX_REAL_FLOAT_REG :: Int)
73 mAX_Real_Double_REG     = (MAX_REAL_DOUBLE_REG :: Int)
74 #ifdef MAX_REAL_LONG_REG
75 mAX_Real_Long_REG       = (MAX_REAL_LONG_REG :: Int)
76 #else
77 mAX_Real_Long_REG       = (0::Int)
78 #endif
79 \end{code}
80
81 Closure header sizes.
82
83 \begin{code}
84 sTD_HDR_SIZE       = (STD_HDR_SIZE       :: Int)
85 pROF_HDR_SIZE      = (PROF_HDR_SIZE      :: Int)
86 gRAN_HDR_SIZE      = (GRAN_HDR_SIZE      :: Int)
87 \end{code}
88
89 Info Table sizes.
90
91 \begin{code}
92 sTD_ITBL_SIZE   = (STD_ITBL_SIZE   :: Int)
93 rET_ITBL_SIZE   = (RET_ITBL_SIZE   :: Int)
94 pROF_ITBL_SIZE  = (PROF_ITBL_SIZE  :: Int)
95 gRAN_ITBL_SIZE  = (GRAN_ITBL_SIZE  :: Int)
96 tICKY_ITBL_SIZE = (TICKY_ITBL_SIZE :: Int)
97 \end{code}
98
99 Size of a double in StgWords.
100
101 \begin{code}
102 dOUBLE_SIZE     = SIZEOF_DOUBLE :: Int
103 wORD64_SIZE     = 8 :: Int
104 iNT64_SIZE      = wORD64_SIZE
105 \end{code}
106
107 This tells the native code generator the size of the spill
108 area is has available.
109
110 \begin{code}
111 rESERVED_C_STACK_BYTES = (RESERVED_C_STACK_BYTES :: Int)
112 \end{code}
113
114 The amount of (Haskell) stack to leave free for saving registers when
115 returning to the scheduler.
116
117 \begin{code}
118 rESERVED_STACK_WORDS = (RESERVED_STACK_WORDS :: Int)
119 \end{code}
120
121 Size of a word, in bytes
122
123 \begin{code}
124 wORD_SIZE = (SIZEOF_HSWORD :: Int)
125 wORD_SIZE_IN_BITS = wORD_SIZE * 8 :: Int
126 \end{code}
127
128 Size of a storage manager block (in bytes).
129
130 \begin{code}
131 bLOCK_SIZE = (BLOCK_SIZE :: Int)
132 bLOCK_SIZE_W = (bLOCK_SIZE `quot` wORD_SIZE :: Int)
133 \end{code}
134
135 Number of bits to shift a bitfield left by in an info table.
136
137 \begin{code}
138 bITMAP_BITS_SHIFT = (BITMAP_BITS_SHIFT :: Int)
139 \end{code}
140
141 Constants derived from headers in ghc/includes, generated by the program
142 ../includes/mkDerivedConstants.c.
143
144 \begin{code}
145 #include "../includes/GHCConstants.h"
146 \end{code}