module GHC.Platform.Constants where
import Prelude
import Data.Char
data PlatformConstants = PlatformConstants {
pc_CONTROL_GROUP_CONST_291 :: !Int,
pc_STD_HDR_SIZE :: !Int,
pc_PROF_HDR_SIZE :: !Int,
pc_BLOCK_SIZE :: !Int,
pc_BLOCKS_PER_MBLOCK :: !Int,
pc_TICKY_BIN_COUNT :: !Int,
pc_OFFSET_StgRegTable_rR1 :: !Int,
pc_OFFSET_StgRegTable_rR2 :: !Int,
pc_OFFSET_StgRegTable_rR3 :: !Int,
pc_OFFSET_StgRegTable_rR4 :: !Int,
pc_OFFSET_StgRegTable_rR5 :: !Int,
pc_OFFSET_StgRegTable_rR6 :: !Int,
pc_OFFSET_StgRegTable_rR7 :: !Int,
pc_OFFSET_StgRegTable_rR8 :: !Int,
pc_OFFSET_StgRegTable_rR9 :: !Int,
pc_OFFSET_StgRegTable_rR10 :: !Int,
pc_OFFSET_StgRegTable_rF1 :: !Int,
pc_OFFSET_StgRegTable_rF2 :: !Int,
pc_OFFSET_StgRegTable_rF3 :: !Int,
pc_OFFSET_StgRegTable_rF4 :: !Int,
pc_OFFSET_StgRegTable_rF5 :: !Int,
pc_OFFSET_StgRegTable_rF6 :: !Int,
pc_OFFSET_StgRegTable_rD1 :: !Int,
pc_OFFSET_StgRegTable_rD2 :: !Int,
pc_OFFSET_StgRegTable_rD3 :: !Int,
pc_OFFSET_StgRegTable_rD4 :: !Int,
pc_OFFSET_StgRegTable_rD5 :: !Int,
pc_OFFSET_StgRegTable_rD6 :: !Int,
pc_OFFSET_StgRegTable_rXMM1 :: !Int,
pc_OFFSET_StgRegTable_rXMM2 :: !Int,
pc_OFFSET_StgRegTable_rXMM3 :: !Int,
pc_OFFSET_StgRegTable_rXMM4 :: !Int,
pc_OFFSET_StgRegTable_rXMM5 :: !Int,
pc_OFFSET_StgRegTable_rXMM6 :: !Int,
pc_OFFSET_StgRegTable_rYMM1 :: !Int,
pc_OFFSET_StgRegTable_rYMM2 :: !Int,
pc_OFFSET_StgRegTable_rYMM3 :: !Int,
pc_OFFSET_StgRegTable_rYMM4 :: !Int,
pc_OFFSET_StgRegTable_rYMM5 :: !Int,
pc_OFFSET_StgRegTable_rYMM6 :: !Int,
pc_OFFSET_StgRegTable_rZMM1 :: !Int,
pc_OFFSET_StgRegTable_rZMM2 :: !Int,
pc_OFFSET_StgRegTable_rZMM3 :: !Int,
pc_OFFSET_StgRegTable_rZMM4 :: !Int,
pc_OFFSET_StgRegTable_rZMM5 :: !Int,
pc_OFFSET_StgRegTable_rZMM6 :: !Int,
pc_OFFSET_StgRegTable_rL1 :: !Int,
pc_OFFSET_StgRegTable_rSp :: !Int,
pc_OFFSET_StgRegTable_rSpLim :: !Int,
pc_OFFSET_StgRegTable_rHp :: !Int,
pc_OFFSET_StgRegTable_rHpLim :: !Int,
pc_OFFSET_StgRegTable_rCCCS :: !Int,
pc_OFFSET_StgRegTable_rCurrentTSO :: !Int,
pc_OFFSET_StgRegTable_rCurrentNursery :: !Int,
pc_OFFSET_StgRegTable_rHpAlloc :: !Int,
pc_OFFSET_stgEagerBlackholeInfo :: !Int,
pc_OFFSET_stgGCEnter1 :: !Int,
pc_OFFSET_stgGCFun :: !Int,
pc_OFFSET_Capability_r :: !Int,
pc_OFFSET_bdescr_start :: !Int,
pc_OFFSET_bdescr_free :: !Int,
pc_OFFSET_bdescr_blocks :: !Int,
pc_OFFSET_bdescr_flags :: !Int,
pc_SIZEOF_CostCentreStack :: !Int,
pc_OFFSET_CostCentreStack_mem_alloc :: !Int,
pc_REP_CostCentreStack_mem_alloc :: !Int,
pc_OFFSET_CostCentreStack_scc_count :: !Int,
pc_REP_CostCentreStack_scc_count :: !Int,
pc_OFFSET_StgHeader_ccs :: !Int,
pc_OFFSET_StgHeader_ldvw :: !Int,
pc_SIZEOF_StgSMPThunkHeader :: !Int,
pc_OFFSET_StgEntCounter_allocs :: !Int,
pc_REP_StgEntCounter_allocs :: !Int,
pc_OFFSET_StgEntCounter_allocd :: !Int,
pc_REP_StgEntCounter_allocd :: !Int,
pc_OFFSET_StgEntCounter_registeredp :: !Int,
pc_OFFSET_StgEntCounter_link :: !Int,
pc_OFFSET_StgEntCounter_entry_count :: !Int,
pc_SIZEOF_StgUpdateFrame_NoHdr :: !Int,
pc_SIZEOF_StgMutArrPtrs_NoHdr :: !Int,
pc_OFFSET_StgMutArrPtrs_ptrs :: !Int,
pc_OFFSET_StgMutArrPtrs_size :: !Int,
pc_SIZEOF_StgSmallMutArrPtrs_NoHdr :: !Int,
pc_OFFSET_StgSmallMutArrPtrs_ptrs :: !Int,
pc_SIZEOF_StgArrBytes_NoHdr :: !Int,
pc_OFFSET_StgArrBytes_bytes :: !Int,
pc_OFFSET_StgTSO_alloc_limit :: !Int,
pc_OFFSET_StgTSO_cccs :: !Int,
pc_OFFSET_StgTSO_stackobj :: !Int,
pc_OFFSET_StgStack_sp :: !Int,
pc_OFFSET_StgStack_stack :: !Int,
pc_OFFSET_StgUpdateFrame_updatee :: !Int,
pc_OFFSET_StgFunInfoExtraFwd_arity :: !Int,
pc_REP_StgFunInfoExtraFwd_arity :: !Int,
pc_SIZEOF_StgFunInfoExtraRev :: !Int,
pc_OFFSET_StgFunInfoExtraRev_arity :: !Int,
pc_REP_StgFunInfoExtraRev_arity :: !Int,
pc_MAX_SPEC_SELECTEE_SIZE :: !Int,
pc_MAX_SPEC_AP_SIZE :: !Int,
pc_MIN_PAYLOAD_SIZE :: !Int,
pc_MIN_INTLIKE :: !Int,
pc_MAX_INTLIKE :: !Int,
pc_MIN_CHARLIKE :: !Int,
pc_MAX_CHARLIKE :: !Int,
pc_MUT_ARR_PTRS_CARD_BITS :: !Int,
pc_MAX_Vanilla_REG :: !Int,
pc_MAX_Float_REG :: !Int,
pc_MAX_Double_REG :: !Int,
pc_MAX_Long_REG :: !Int,
pc_MAX_XMM_REG :: !Int,
pc_MAX_Real_Vanilla_REG :: !Int,
pc_MAX_Real_Float_REG :: !Int,
pc_MAX_Real_Double_REG :: !Int,
pc_MAX_Real_XMM_REG :: !Int,
pc_MAX_Real_Long_REG :: !Int,
pc_RESERVED_C_STACK_BYTES :: !Int,
pc_RESERVED_STACK_WORDS :: !Int,
pc_AP_STACK_SPLIM :: !Int,
pc_WORD_SIZE :: !Int,
pc_CINT_SIZE :: !Int,
pc_CLONG_SIZE :: !Int,
pc_CLONG_LONG_SIZE :: !Int,
pc_BITMAP_BITS_SHIFT :: !Int,
pc_TAG_BITS :: !Int,
pc_LDV_SHIFT :: !Int,
pc_ILDV_CREATE_MASK :: !Integer,
pc_ILDV_STATE_CREATE :: !Integer,
pc_ILDV_STATE_USE :: !Integer
} deriving (Show,Read,Eq)
parseConstantsHeader :: FilePath -> IO PlatformConstants
parseConstantsHeader fp = do
s <- readFile fp
let def = "#define HS_CONSTANTS \""
find [] xs = xs
find _ [] = error $ "Couldn't find " ++ def ++ " in " ++ fp
find (d:ds) (x:xs)
| d == x = find ds xs
| otherwise = find def xs
readVal' :: Bool -> Integer -> String -> [Integer]
readVal' n c (x:xs) = case x of
'"' -> [if n then negate c else c]
'-' -> readVal' True c xs
',' -> (if n then negate c else c) : readVal' False 0 xs
_ -> readVal' n (c*10 + fromIntegral (ord x ord '0')) xs
readVal' n c [] = [if n then negate c else c]
readVal = readVal' False 0
return $! case readVal (find def s) of
[v0,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14,v15
,v16,v17,v18,v19,v20,v21,v22,v23,v24,v25,v26,v27,v28,v29,v30,v31
,v32,v33,v34,v35,v36,v37,v38,v39,v40,v41,v42,v43,v44,v45,v46,v47
,v48,v49,v50,v51,v52,v53,v54,v55,v56,v57,v58,v59,v60,v61,v62,v63
,v64,v65,v66,v67,v68,v69,v70,v71,v72,v73,v74,v75,v76,v77,v78,v79
,v80,v81,v82,v83,v84,v85,v86,v87,v88,v89,v90,v91,v92,v93,v94,v95
,v96,v97,v98,v99,v100,v101,v102,v103,v104,v105,v106,v107,v108,v109,v110,v111
,v112,v113,v114,v115,v116,v117,v118,v119,v120,v121,v122,v123,v124,v125,v126,v127
] -> PlatformConstants
{ pc_CONTROL_GROUP_CONST_291 = fromIntegral v0
, pc_STD_HDR_SIZE = fromIntegral v1
, pc_PROF_HDR_SIZE = fromIntegral v2
, pc_BLOCK_SIZE = fromIntegral v3
, pc_BLOCKS_PER_MBLOCK = fromIntegral v4
, pc_TICKY_BIN_COUNT = fromIntegral v5
, pc_OFFSET_StgRegTable_rR1 = fromIntegral v6
, pc_OFFSET_StgRegTable_rR2 = fromIntegral v7
, pc_OFFSET_StgRegTable_rR3 = fromIntegral v8
, pc_OFFSET_StgRegTable_rR4 = fromIntegral v9
, pc_OFFSET_StgRegTable_rR5 = fromIntegral v10
, pc_OFFSET_StgRegTable_rR6 = fromIntegral v11
, pc_OFFSET_StgRegTable_rR7 = fromIntegral v12
, pc_OFFSET_StgRegTable_rR8 = fromIntegral v13
, pc_OFFSET_StgRegTable_rR9 = fromIntegral v14
, pc_OFFSET_StgRegTable_rR10 = fromIntegral v15
, pc_OFFSET_StgRegTable_rF1 = fromIntegral v16
, pc_OFFSET_StgRegTable_rF2 = fromIntegral v17
, pc_OFFSET_StgRegTable_rF3 = fromIntegral v18
, pc_OFFSET_StgRegTable_rF4 = fromIntegral v19
, pc_OFFSET_StgRegTable_rF5 = fromIntegral v20
, pc_OFFSET_StgRegTable_rF6 = fromIntegral v21
, pc_OFFSET_StgRegTable_rD1 = fromIntegral v22
, pc_OFFSET_StgRegTable_rD2 = fromIntegral v23
, pc_OFFSET_StgRegTable_rD3 = fromIntegral v24
, pc_OFFSET_StgRegTable_rD4 = fromIntegral v25
, pc_OFFSET_StgRegTable_rD5 = fromIntegral v26
, pc_OFFSET_StgRegTable_rD6 = fromIntegral v27
, pc_OFFSET_StgRegTable_rXMM1 = fromIntegral v28
, pc_OFFSET_StgRegTable_rXMM2 = fromIntegral v29
, pc_OFFSET_StgRegTable_rXMM3 = fromIntegral v30
, pc_OFFSET_StgRegTable_rXMM4 = fromIntegral v31
, pc_OFFSET_StgRegTable_rXMM5 = fromIntegral v32
, pc_OFFSET_StgRegTable_rXMM6 = fromIntegral v33
, pc_OFFSET_StgRegTable_rYMM1 = fromIntegral v34
, pc_OFFSET_StgRegTable_rYMM2 = fromIntegral v35
, pc_OFFSET_StgRegTable_rYMM3 = fromIntegral v36
, pc_OFFSET_StgRegTable_rYMM4 = fromIntegral v37
, pc_OFFSET_StgRegTable_rYMM5 = fromIntegral v38
, pc_OFFSET_StgRegTable_rYMM6 = fromIntegral v39
, pc_OFFSET_StgRegTable_rZMM1 = fromIntegral v40
, pc_OFFSET_StgRegTable_rZMM2 = fromIntegral v41
, pc_OFFSET_StgRegTable_rZMM3 = fromIntegral v42
, pc_OFFSET_StgRegTable_rZMM4 = fromIntegral v43
, pc_OFFSET_StgRegTable_rZMM5 = fromIntegral v44
, pc_OFFSET_StgRegTable_rZMM6 = fromIntegral v45
, pc_OFFSET_StgRegTable_rL1 = fromIntegral v46
, pc_OFFSET_StgRegTable_rSp = fromIntegral v47
, pc_OFFSET_StgRegTable_rSpLim = fromIntegral v48
, pc_OFFSET_StgRegTable_rHp = fromIntegral v49
, pc_OFFSET_StgRegTable_rHpLim = fromIntegral v50
, pc_OFFSET_StgRegTable_rCCCS = fromIntegral v51
, pc_OFFSET_StgRegTable_rCurrentTSO = fromIntegral v52
, pc_OFFSET_StgRegTable_rCurrentNursery = fromIntegral v53
, pc_OFFSET_StgRegTable_rHpAlloc = fromIntegral v54
, pc_OFFSET_stgEagerBlackholeInfo = fromIntegral v55
, pc_OFFSET_stgGCEnter1 = fromIntegral v56
, pc_OFFSET_stgGCFun = fromIntegral v57
, pc_OFFSET_Capability_r = fromIntegral v58
, pc_OFFSET_bdescr_start = fromIntegral v59
, pc_OFFSET_bdescr_free = fromIntegral v60
, pc_OFFSET_bdescr_blocks = fromIntegral v61
, pc_OFFSET_bdescr_flags = fromIntegral v62
, pc_SIZEOF_CostCentreStack = fromIntegral v63
, pc_OFFSET_CostCentreStack_mem_alloc = fromIntegral v64
, pc_REP_CostCentreStack_mem_alloc = fromIntegral v65
, pc_OFFSET_CostCentreStack_scc_count = fromIntegral v66
, pc_REP_CostCentreStack_scc_count = fromIntegral v67
, pc_OFFSET_StgHeader_ccs = fromIntegral v68
, pc_OFFSET_StgHeader_ldvw = fromIntegral v69
, pc_SIZEOF_StgSMPThunkHeader = fromIntegral v70
, pc_OFFSET_StgEntCounter_allocs = fromIntegral v71
, pc_REP_StgEntCounter_allocs = fromIntegral v72
, pc_OFFSET_StgEntCounter_allocd = fromIntegral v73
, pc_REP_StgEntCounter_allocd = fromIntegral v74
, pc_OFFSET_StgEntCounter_registeredp = fromIntegral v75
, pc_OFFSET_StgEntCounter_link = fromIntegral v76
, pc_OFFSET_StgEntCounter_entry_count = fromIntegral v77
, pc_SIZEOF_StgUpdateFrame_NoHdr = fromIntegral v78
, pc_SIZEOF_StgMutArrPtrs_NoHdr = fromIntegral v79
, pc_OFFSET_StgMutArrPtrs_ptrs = fromIntegral v80
, pc_OFFSET_StgMutArrPtrs_size = fromIntegral v81
, pc_SIZEOF_StgSmallMutArrPtrs_NoHdr = fromIntegral v82
, pc_OFFSET_StgSmallMutArrPtrs_ptrs = fromIntegral v83
, pc_SIZEOF_StgArrBytes_NoHdr = fromIntegral v84
, pc_OFFSET_StgArrBytes_bytes = fromIntegral v85
, pc_OFFSET_StgTSO_alloc_limit = fromIntegral v86
, pc_OFFSET_StgTSO_cccs = fromIntegral v87
, pc_OFFSET_StgTSO_stackobj = fromIntegral v88
, pc_OFFSET_StgStack_sp = fromIntegral v89
, pc_OFFSET_StgStack_stack = fromIntegral v90
, pc_OFFSET_StgUpdateFrame_updatee = fromIntegral v91
, pc_OFFSET_StgFunInfoExtraFwd_arity = fromIntegral v92
, pc_REP_StgFunInfoExtraFwd_arity = fromIntegral v93
, pc_SIZEOF_StgFunInfoExtraRev = fromIntegral v94
, pc_OFFSET_StgFunInfoExtraRev_arity = fromIntegral v95
, pc_REP_StgFunInfoExtraRev_arity = fromIntegral v96
, pc_MAX_SPEC_SELECTEE_SIZE = fromIntegral v97
, pc_MAX_SPEC_AP_SIZE = fromIntegral v98
, pc_MIN_PAYLOAD_SIZE = fromIntegral v99
, pc_MIN_INTLIKE = fromIntegral v100
, pc_MAX_INTLIKE = fromIntegral v101
, pc_MIN_CHARLIKE = fromIntegral v102
, pc_MAX_CHARLIKE = fromIntegral v103
, pc_MUT_ARR_PTRS_CARD_BITS = fromIntegral v104
, pc_MAX_Vanilla_REG = fromIntegral v105
, pc_MAX_Float_REG = fromIntegral v106
, pc_MAX_Double_REG = fromIntegral v107
, pc_MAX_Long_REG = fromIntegral v108
, pc_MAX_XMM_REG = fromIntegral v109
, pc_MAX_Real_Vanilla_REG = fromIntegral v110
, pc_MAX_Real_Float_REG = fromIntegral v111
, pc_MAX_Real_Double_REG = fromIntegral v112
, pc_MAX_Real_XMM_REG = fromIntegral v113
, pc_MAX_Real_Long_REG = fromIntegral v114
, pc_RESERVED_C_STACK_BYTES = fromIntegral v115
, pc_RESERVED_STACK_WORDS = fromIntegral v116
, pc_AP_STACK_SPLIM = fromIntegral v117
, pc_WORD_SIZE = fromIntegral v118
, pc_CINT_SIZE = fromIntegral v119
, pc_CLONG_SIZE = fromIntegral v120
, pc_CLONG_LONG_SIZE = fromIntegral v121
, pc_BITMAP_BITS_SHIFT = fromIntegral v122
, pc_TAG_BITS = fromIntegral v123
, pc_LDV_SHIFT = fromIntegral v124
, pc_ILDV_CREATE_MASK = v125
, pc_ILDV_STATE_CREATE = v126
, pc_ILDV_STATE_USE = v127
}
_ -> error "Invalid platform constants"