{-# LANGUAGE RecordWildCards, DeriveGeneric, GeneralizedNewtypeDeriving,
BangPatterns, CPP #-}
module GHCi.ResolvedBCO
( ResolvedBCO(..)
, ResolvedBCOPtr(..)
, isLittleEndian
) where
import SizedSeq
import GHCi.RemoteTypes
import GHCi.BreakArray
import Data.Array.Unboxed
import Data.Binary
import GHC.Generics
import GHCi.BinaryArray
#include "MachDeps.h"
isLittleEndian :: Bool
#if defined(WORDS_BIGENDIAN)
isLittleEndian = True
#else
isLittleEndian = False
#endif
data ResolvedBCO
= ResolvedBCO {
resolvedBCOIsLE :: Bool,
resolvedBCOArity :: {-# UNPACK #-} !Int,
resolvedBCOInstrs :: UArray Int Word16,
resolvedBCOBitmap :: UArray Int Word64,
resolvedBCOLits :: UArray Int Word64,
resolvedBCOPtrs :: (SizedSeq ResolvedBCOPtr)
}
deriving (Generic, Show)
instance Binary ResolvedBCO where
put ResolvedBCO{..} = do
put resolvedBCOIsLE
put resolvedBCOArity
putArray resolvedBCOInstrs
putArray resolvedBCOBitmap
putArray resolvedBCOLits
put resolvedBCOPtrs
get = ResolvedBCO
<$> get <*> get <*> getArray <*> getArray <*> getArray <*> get
data ResolvedBCOPtr
= ResolvedBCORef {-# UNPACK #-} !Int
| ResolvedBCOPtr {-# UNPACK #-} !(RemoteRef HValue)
| ResolvedBCOStaticPtr {-# UNPACK #-} !(RemotePtr ())
| ResolvedBCOPtrBCO ResolvedBCO
| ResolvedBCOPtrBreakArray {-# UNPACK #-} !(RemoteRef BreakArray)
deriving (Generic, Show)
instance Binary ResolvedBCOPtr