diff options
author | Simon Marlow <marlowsd@gmail.com> | 2011-08-24 11:13:40 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2011-08-25 11:12:33 +0100 |
commit | 064478933d867e43e0f29a143041edabebcddd38 (patch) | |
tree | 3ace1fb6bf9aec96d6f79503a1db7267bd78858e /compiler/cmm/SMRep.lhs | |
parent | a6315fc72eeb418c513c63c7f8ed674c26dd0092 (diff) | |
download | haskell-064478933d867e43e0f29a143041edabebcddd38.tar.gz |
Remove another use of mkConInfo
Diffstat (limited to 'compiler/cmm/SMRep.lhs')
-rw-r--r-- | compiler/cmm/SMRep.lhs | 53 |
1 files changed, 37 insertions, 16 deletions
diff --git a/compiler/cmm/SMRep.lhs b/compiler/cmm/SMRep.lhs index fd60544869..bc502a30a3 100644 --- a/compiler/cmm/SMRep.lhs +++ b/compiler/cmm/SMRep.lhs @@ -10,27 +10,33 @@ Other modules should access this info through ClosureInfo. \begin{code} module SMRep ( - -- Words and bytes + -- * Words and bytes StgWord, StgHalfWord, hALF_WORD_SIZE, hALF_WORD_SIZE_IN_BITS, WordOff, ByteOff, - -- Closure repesentation + -- * Closure repesentation SMRep(..), -- CmmInfo sees the rep; no one else does IsStatic, ClosureTypeInfo(..), ArgDescr(..), Liveness, ConstrDescription, + + -- ** Construction mkHeapRep, blackHoleRep, mkStackRep, mkRTSRep, - isStaticRep, isStaticNoCafCon, + -- ** Predicates + isStaticRep, isConRep, isThunkRep, isStaticNoCafCon, + + -- ** Size-related things heapClosureSize, fixedHdrSize, arrWordsHdrSize, arrPtrsHdrSize, profHdrSize, thunkHdrSize, nonHdrSize, - rtsClosureType, rET_SMALL, rET_BIG, + -- ** RTS closure types + rtsClosureType, rET_SMALL, rET_BIG, aRG_GEN, aRG_GEN_BIG, - -- Operations over [Word8] strings + -- * Operations over [Word8] strings that don't belong here pprWord8String, stringToWord8s ) where @@ -173,6 +179,31 @@ blackHoleRep :: SMRep blackHoleRep = HeapRep False 0 0 BlackHole ----------------------------------------------------------------------------- +-- Predicates + +isStaticRep :: SMRep -> IsStatic +isStaticRep (HeapRep is_static _ _ _) = is_static +isStaticRep (StackRep {}) = False +isStaticRep (RTSRep _ rep) = isStaticRep rep + +isConRep :: SMRep -> Bool +isConRep (HeapRep _ _ _ Constr{}) = True +isConRep _ = False + +isThunkRep :: SMRep -> Bool +isThunkRep (HeapRep _ _ _ Thunk{}) = True +isThunkRep (HeapRep _ _ _ ThunkSelector{}) = True +isThunkRep (HeapRep _ _ _ BlackHole{}) = True +isThunkRep _ = False + +isStaticNoCafCon :: SMRep -> Bool +-- This should line up exactly with CONSTR_NOCAF_STATIC above +-- See Note [Static NoCaf constructors] +isStaticNoCafCon (HeapRep True 0 _ Constr{}) = True +isStaticNoCafCon _ = False + + +----------------------------------------------------------------------------- -- Size-related things -- | Size of a closure header (StgHeader in includes/rts/storage/Closures.h) @@ -202,11 +233,6 @@ thunkHdrSize = fixedHdrSize + smp_hdr where smp_hdr = sIZEOF_StgSMPThunkHeader `quot` wORD_SIZE -isStaticRep :: SMRep -> IsStatic -isStaticRep (HeapRep is_static _ _ _) = is_static -isStaticRep (StackRep {}) = False -isStaticRep (RTSRep _ rep) = isStaticRep rep - nonHdrSize :: SMRep -> WordOff nonHdrSize (HeapRep _ p np _) = p + np nonHdrSize (StackRep bs) = length bs @@ -273,12 +299,6 @@ rtsClosureType (HeapRep False _ _ BlackHole{}) = BLACKHOLE rtsClosureType _ = panic "rtsClosureType" -isStaticNoCafCon :: SMRep -> Bool --- This should line up exactly with CONSTR_NOCAF_STATIC above --- See Note [Static NoCaf constructors] -isStaticNoCafCon (HeapRep True 0 _ Constr{}) = True -isStaticNoCafCon _ = False - -- We export these ones rET_SMALL, rET_BIG, aRG_GEN, aRG_GEN_BIG :: StgHalfWord rET_SMALL = RET_SMALL @@ -345,6 +365,7 @@ pprTypeInfo (ThunkSelector offset) pprTypeInfo Thunk = ptext (sLit "Thunk") pprTypeInfo BlackHole = ptext (sLit "BlackHole") +-- XXX Does not belong here!! stringToWord8s :: String -> [Word8] stringToWord8s s = map (fromIntegral . ord) s |