X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fghci%2FByteCodeItbls.lhs;h=6caac2f7b4ccc3a1cb37e3f60b60c95748490afd;hb=d4ab79e5cbc5a85b9a589b3574e94a9f12bbf874;hp=7a42b8d00cccdf58a00f523ef806872d9277491a;hpb=a6e4c7f78c220055768c63ed6098f3ebde36dba7;p=ghc-hetmet.git diff --git a/ghc/compiler/ghci/ByteCodeItbls.lhs b/ghc/compiler/ghci/ByteCodeItbls.lhs index 7a42b8d..6caac2f 100644 --- a/ghc/compiler/ghci/ByteCodeItbls.lhs +++ b/ghc/compiler/ghci/ByteCodeItbls.lhs @@ -4,6 +4,9 @@ \section[ByteCodeItbls]{Generate infotables for interpreter-made bytecodes} \begin{code} + +{-# OPTIONS -optc-DNON_POSIX_SOURCE #-} + module ByteCodeItbls ( ItblEnv, ItblPtr, mkITbls ) where #include "HsVersions.h" @@ -16,6 +19,7 @@ import TyCon ( TyCon, tyConFamilySize, isDataTyCon, tyConDataCons ) import Constants ( mIN_SIZE_NonUpdHeapObject ) import ClosureInfo ( mkVirtHeapOffsets ) import FastString ( FastString(..) ) +import Util ( lengthIs, listLengthCmp ) import Foreign ( Storable(..), Word8, Word16, Word32, Word64, Ptr(..), malloc, castPtr, plusPtr, Addr ) @@ -52,7 +56,7 @@ mkITbl :: TyCon -> IO ItblEnv mkITbl tc | not (isDataTyCon tc) = return emptyFM - | n == length dcs -- paranoia; this is an assertion. + | dcs `lengthIs` n -- paranoia; this is an assertion. = make_constr_itbls dcs where dcs = tyConDataCons tc @@ -64,7 +68,7 @@ cONSTR = 1 -- as defined in ghc/includes/ClosureTypes.h -- Assumes constructors are numbered from zero, not one make_constr_itbls :: [DataCon] -> IO ItblEnv make_constr_itbls cons - | length cons <= 8 + | listLengthCmp cons 8 /= GT -- <= 8 elements in the list = do is <- mapM mk_vecret_itbl (zip cons [0..]) return (listToFM is) | otherwise