X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=includes%2FHaskellConstants.hs;h=51cdcaf0d1f033115febeacdf52220c6b25a0ae0;hp=666728ccd8073842a99d9357b9d4e68e81e8efe3;hb=e5c3b478b3cd1707cf122833822f44b2ac09b8e9;hpb=a1d8f7e9ead3ea284abf878ed3015a84eb5d67fb diff --git a/includes/HaskellConstants.hs b/includes/HaskellConstants.hs index 666728c..51cdcaf 100644 --- a/includes/HaskellConstants.hs +++ b/includes/HaskellConstants.hs @@ -1,5 +1,7 @@ import Data.Bits (shiftL) +import Data.Word +import Data.Int -- This magical #include brings in all the everybody-knows-these magic -- constants unfortunately, we need to be *explicit* about which one @@ -60,6 +62,9 @@ mIN_CHARLIKE, mAX_CHARLIKE :: Int mIN_CHARLIKE = MIN_CHARLIKE mAX_CHARLIKE = MAX_CHARLIKE +mUT_ARR_PTRS_CARD_BITS :: Int +mUT_ARR_PTRS_CARD_BITS = MUT_ARR_PTRS_CARD_BITS + -- A section of code-generator-related MAGIC CONSTANTS. mAX_Vanilla_REG :: Int @@ -135,6 +140,26 @@ wORD_SIZE = SIZEOF_HSWORD wORD_SIZE_IN_BITS :: Int wORD_SIZE_IN_BITS = wORD_SIZE * 8 +-- Define a fixed-range integral type equivalent to the target Int/Word + +#if SIZEOF_HSWORD == 4 +type TargetInt = Int32 +type TargetWord = Word32 +#elif SIZEOF_HSWORD == 8 +type TargetInt = Int64 +type TargetWord = Word64 +#else +#error unknown SIZEOF_HSWORD +#endif + +tARGET_MIN_INT, tARGET_MAX_INT, tARGET_MAX_WORD :: Integer +tARGET_MIN_INT = fromIntegral (minBound :: TargetInt) +tARGET_MAX_INT = fromIntegral (maxBound :: TargetInt) +tARGET_MAX_WORD = fromIntegral (maxBound :: TargetWord) + +tARGET_MAX_CHAR :: Int +tARGET_MAX_CHAR = 0x10ffff + -- Amount of pointer bits used for semi-tagging constructor closures tAG_BITS :: Int @@ -158,6 +183,11 @@ bLOCK_SIZE = BLOCK_SIZE bLOCK_SIZE_W :: Int bLOCK_SIZE_W = bLOCK_SIZE `quot` wORD_SIZE +-- blocks that fit in an MBlock, leaving space for the block descriptors + +bLOCKS_PER_MBLOCK :: Int +bLOCKS_PER_MBLOCK = BLOCKS_PER_MBLOCK + -- Number of bits to shift a bitfield left by in an info table. bITMAP_BITS_SHIFT :: Int