2 import Data.Bits (shiftL)
4 -- This magical #include brings in all the everybody-knows-these magic
5 -- constants unfortunately, we need to be *explicit* about which one
6 -- we want; if we just hope a -I... will get the right one, we could
10 Pull in the autoconf defines (HAVE_FOO), but don't include
11 ghcconfig.h, because that will include ghcplatform.h which has the
12 wrong platform settings for the compiler (it has the platform
13 settings for the target plat instead).
15 #include "../includes/ghcautoconf.h"
17 #include "stg/MachRegs.h"
18 #include "rts/Constants.h"
20 #include "DerivedConstants.h"
24 -- All pretty arbitrary:
27 mAX_TUPLE_SIZE = 62 -- Should really match the number
28 -- of decls in Data.Tuple
30 mAX_CONTEXT_REDUCTION_DEPTH :: Int
31 mAX_CONTEXT_REDUCTION_DEPTH = 20
34 -- specialised fun/thunk/constr closure types
35 mAX_SPEC_THUNK_SIZE :: Int
36 mAX_SPEC_THUNK_SIZE = MAX_SPEC_THUNK_SIZE
38 mAX_SPEC_FUN_SIZE :: Int
39 mAX_SPEC_FUN_SIZE = MAX_SPEC_FUN_SIZE
41 mAX_SPEC_CONSTR_SIZE :: Int
42 mAX_SPEC_CONSTR_SIZE = MAX_SPEC_CONSTR_SIZE
44 -- pre-compiled thunk types
45 mAX_SPEC_SELECTEE_SIZE :: Int
46 mAX_SPEC_SELECTEE_SIZE = MAX_SPEC_SELECTEE_SIZE
48 mAX_SPEC_AP_SIZE :: Int
49 mAX_SPEC_AP_SIZE = MAX_SPEC_AP_SIZE
51 -- closure sizes: these do NOT include the header (see below for header sizes)
52 mIN_PAYLOAD_SIZE ::Int
53 mIN_PAYLOAD_SIZE = MIN_PAYLOAD_SIZE
55 mIN_INTLIKE, mAX_INTLIKE :: Int
56 mIN_INTLIKE = MIN_INTLIKE
57 mAX_INTLIKE = MAX_INTLIKE
59 mIN_CHARLIKE, mAX_CHARLIKE :: Int
60 mIN_CHARLIKE = MIN_CHARLIKE
61 mAX_CHARLIKE = MAX_CHARLIKE
63 -- A section of code-generator-related MAGIC CONSTANTS.
65 mAX_Vanilla_REG :: Int
66 mAX_Vanilla_REG = MAX_VANILLA_REG
69 mAX_Float_REG = MAX_FLOAT_REG
72 mAX_Double_REG = MAX_DOUBLE_REG
75 mAX_Long_REG = MAX_LONG_REG
77 mAX_Real_Vanilla_REG :: Int
78 mAX_Real_Vanilla_REG = MAX_REAL_VANILLA_REG
80 mAX_Real_Float_REG :: Int
81 mAX_Real_Float_REG = MAX_REAL_FLOAT_REG
83 mAX_Real_Double_REG :: Int
84 mAX_Real_Double_REG = MAX_REAL_DOUBLE_REG
86 mAX_Real_Long_REG :: Int
87 #ifdef MAX_REAL_LONG_REG
88 mAX_Real_Long_REG = MAX_REAL_LONG_REG
93 -- Closure header sizes.
96 sTD_HDR_SIZE = STD_HDR_SIZE
99 pROF_HDR_SIZE = PROF_HDR_SIZE
101 -- Size of a double in StgWords.
104 dOUBLE_SIZE = SIZEOF_DOUBLE
110 iNT64_SIZE = wORD64_SIZE
112 -- This tells the native code generator the size of the spill
113 -- area is has available.
115 rESERVED_C_STACK_BYTES :: Int
116 rESERVED_C_STACK_BYTES = RESERVED_C_STACK_BYTES
118 -- The amount of (Haskell) stack to leave free for saving registers when
119 -- returning to the scheduler.
121 rESERVED_STACK_WORDS :: Int
122 rESERVED_STACK_WORDS = RESERVED_STACK_WORDS
124 -- Continuations that need more than this amount of stack should do their
125 -- own stack check (see bug #1466).
127 aP_STACK_SPLIM :: Int
128 aP_STACK_SPLIM = AP_STACK_SPLIM
130 -- Size of a word, in bytes
133 wORD_SIZE = SIZEOF_HSWORD
135 wORD_SIZE_IN_BITS :: Int
136 wORD_SIZE_IN_BITS = wORD_SIZE * 8
138 -- Amount of pointer bits used for semi-tagging constructor closures
144 tAG_MASK = (1 `shiftL` tAG_BITS) - 1
147 mAX_PTR_TAG = tAG_MASK
149 -- Size of a C int, in bytes. May be smaller than wORD_SIZE.
152 cINT_SIZE = SIZEOF_INT
154 -- Size of a storage manager block (in bytes).
157 bLOCK_SIZE = BLOCK_SIZE
159 bLOCK_SIZE_W = bLOCK_SIZE `quot` wORD_SIZE
161 -- Number of bits to shift a bitfield left by in an info table.
163 bITMAP_BITS_SHIFT :: Int
164 bITMAP_BITS_SHIFT = BITMAP_BITS_SHIFT
166 -- Constants derived from headers in ghc/includes, generated by the program
167 -- ../includes/mkDerivedConstants.c.
169 #include "GHCConstants.h"