Add several new record features
[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 -- 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/MachRegs.h"
16 #include "../includes/Constants.h"
17 #include "../includes/MachDeps.h"
18 #include "../includes/DerivedConstants.h"
19
20 -- import Util
21 \end{code}
22
23 All pretty arbitrary:
24
25 \begin{code}
26 mAX_TUPLE_SIZE = (62 :: Int)    -- Should really match the number
27                                 -- of decls in Data.Tuple
28 mAX_CONTEXT_REDUCTION_DEPTH = (20 :: Int)
29 \end{code}
30
31
32 \begin{code}
33 -- specialised fun/thunk/constr closure types
34 mAX_SPEC_THUNK_SIZE   = (MAX_SPEC_THUNK_SIZE :: Int)
35 mAX_SPEC_FUN_SIZE     = (MAX_SPEC_FUN_SIZE :: Int)
36 mAX_SPEC_CONSTR_SIZE  = (MAX_SPEC_CONSTR_SIZE :: Int)
37
38 -- pre-compiled thunk types
39 mAX_SPEC_SELECTEE_SIZE  = (MAX_SPEC_SELECTEE_SIZE :: Int)
40 mAX_SPEC_AP_SIZE        = (MAX_SPEC_AP_SIZE :: Int)
41
42 -- closure sizes: these do NOT include the header (see below for header sizes)
43 mIN_PAYLOAD_SIZE        = (MIN_PAYLOAD_SIZE::Int)
44 \end{code}
45
46 \begin{code}
47 mIN_INTLIKE, mAX_INTLIKE :: Int 
48 mIN_INTLIKE = MIN_INTLIKE
49 mAX_INTLIKE = MAX_INTLIKE
50
51 mIN_CHARLIKE, mAX_CHARLIKE :: Int
52 mIN_CHARLIKE = MIN_CHARLIKE
53 mAX_CHARLIKE = MAX_CHARLIKE
54 \end{code}
55
56 A section of code-generator-related MAGIC CONSTANTS.
57
58 \begin{code}
59 mAX_Vanilla_REG = (MAX_VANILLA_REG :: Int)
60 mAX_Float_REG   = (MAX_FLOAT_REG :: Int)
61 mAX_Double_REG  = (MAX_DOUBLE_REG :: Int)
62 mAX_Long_REG    = (MAX_LONG_REG  :: Int)
63
64 mAX_Real_Vanilla_REG    = (MAX_REAL_VANILLA_REG :: Int)
65 mAX_Real_Float_REG      = (MAX_REAL_FLOAT_REG :: Int)
66 mAX_Real_Double_REG     = (MAX_REAL_DOUBLE_REG :: Int)
67 #ifdef MAX_REAL_LONG_REG
68 mAX_Real_Long_REG       = (MAX_REAL_LONG_REG :: Int)
69 #else
70 mAX_Real_Long_REG       = (0::Int)
71 #endif
72 \end{code}
73
74 Closure header sizes.
75
76 \begin{code}
77 sTD_HDR_SIZE       = (STD_HDR_SIZE       :: Int)
78 pROF_HDR_SIZE      = (PROF_HDR_SIZE      :: Int)
79 gRAN_HDR_SIZE      = (GRAN_HDR_SIZE      :: Int)
80 \end{code}
81
82 Size of a double in StgWords.
83
84 \begin{code}
85 dOUBLE_SIZE     = SIZEOF_DOUBLE :: Int
86 wORD64_SIZE     = 8 :: Int
87 iNT64_SIZE      = wORD64_SIZE
88 \end{code}
89
90 This tells the native code generator the size of the spill
91 area is has available.
92
93 \begin{code}
94 rESERVED_C_STACK_BYTES = (RESERVED_C_STACK_BYTES :: Int)
95 \end{code}
96
97 The amount of (Haskell) stack to leave free for saving registers when
98 returning to the scheduler.
99
100 \begin{code}
101 rESERVED_STACK_WORDS = (RESERVED_STACK_WORDS :: Int)
102 \end{code}
103
104 Size of a word, in bytes
105
106 \begin{code}
107 wORD_SIZE = (SIZEOF_HSWORD :: Int)
108 wORD_SIZE_IN_BITS = wORD_SIZE * 8 :: Int
109 \end{code}
110
111 Size of a C int, in bytes. May be smaller than wORD_SIZE.
112
113 \begin{code}
114 cINT_SIZE = (SIZEOF_INT :: Int)
115 \end{code}
116
117 Size of a storage manager block (in bytes).
118
119 \begin{code}
120 bLOCK_SIZE = (BLOCK_SIZE :: Int)
121 bLOCK_SIZE_W = (bLOCK_SIZE `quot` wORD_SIZE :: Int)
122 \end{code}
123
124 Number of bits to shift a bitfield left by in an info table.
125
126 \begin{code}
127 bITMAP_BITS_SHIFT = (BITMAP_BITS_SHIFT :: Int)
128 \end{code}
129
130 Constants derived from headers in ghc/includes, generated by the program
131 ../includes/mkDerivedConstants.c.
132
133 \begin{code}
134 #include "../includes/GHCConstants.h"
135 \end{code}