%
-% (c) The GRASP/AQUA Project, Glasgow University, 1992-1995
+% (c) The GRASP/AQUA Project, Glasgow University, 1992-1996
%
\section[HeapOffs]{Abstract C: heap offsets}
#include "HsVersions.h"
module HeapOffs (
-#ifndef DPH
HeapOffset,
-#else
- HeapOffset(..), -- DPH needs to do a little peaking inside this thing.
-#endif {- Data Parallel Haskell -}
zeroOff, intOff, fixedHdrSize, totHdrSize, varHdrSize,
maxOff, addOff, subOff,
intOffsetIntoGoods,
+#if 0
#if ! OMIT_NATIVE_CODEGEN
- hpRelToInt,
+ hpRelToInt,
+#endif
#endif
VirtualHeapOffset(..), HpRelOffset(..),
VirtualSpAOffset(..), VirtualSpBOffset(..),
SpARelOffset(..), SpBRelOffset(..)
- ) where
+ ) where
+
+import Ubiq{-uitous-}
-import ClosureInfo -- esp. about SMReps
-import SMRep
+import ClosureInfo ( isSpecRep )
+import Maybes ( catMaybes )
+import SMRep
+import Unpretty -- ********** NOTE **********
+import Util ( panic )
#if ! OMIT_NATIVE_CODEGEN
-import MachDesc
+--import MachDesc ( Target )
#endif
-import Maybes ( catMaybes, Maybe(..) )
-import Outputable
-import Unpretty -- ********** NOTE **********
-import Util
\end{code}
%************************************************************************
* Node, the ptr to the closure, pts at its info-ptr field
-}
data HeapOffset
- = MkHeapOffset
+ = MkHeapOffset
FAST_INT -- this many words...
deriving () -- but: see `eqOff` below
-#if defined(__GLASGOW_HASKELL__)
data SMRep__Int = SMRI_ SMRep Int#
#define SMRI(a,b) (SMRI_ a b)
-#else
-type SMRep__Int = (SMRep, Int)
-#define SMRI(a,b) (a, b)
-#endif
type VirtualHeapOffset = HeapOffset
type VirtualSpAOffset = Int
fixedHdrSize = MkHeapOffset ILIT(0) ILIT(1) [] []
-totHdrSize sm_rep
+totHdrSize sm_rep
= if isSpecRep sm_rep -- Tot hdr size for a spec rep is just FixedHdrSize
then MkHeapOffset ILIT(0) ILIT(1) [] []
else MkHeapOffset ILIT(0) ILIT(0) [] [SMRI(sm_rep, ILIT(1))]
else
MaxHeapOffset off1 off2
where
- -- Normalise, by realising that each tot-hdr is really a
+ -- Normalise, by realising that each tot-hdr is really a
-- var-hdr plus a fixed-hdr
n_tothdr1 = total_of tothdr_offs1
real_fixed1 = fixhdr_offs1 _ADD_ n_tothdr1
add_HdrSizes as@(off1@(SMRI(rep1,n1)) : offs1) bs@(off2@(SMRI(rep2,n2)) : offs2)
= if rep1 `ltSMRepHdr` rep2 then
off1 : (add_HdrSizes offs1 bs)
- else
+ else
if rep2 `ltSMRepHdr` rep1 then
off2 : (add_HdrSizes as offs2)
else
\end{code}
\begin{code}
-pprHeapOffsetPieces :: PprStyle
+pprHeapOffsetPieces :: PprStyle
-> FAST_INT -- Words
-> FAST_INT -- Fixed hdrs
-> [SMRep__Int] -- Var hdrs
pp_hdr pp_str (SMRI(rep, n))
= if n _EQ_ ILIT(1) then
uppBeside (uppStr (show rep)) pp_str
- else
+ else
uppBesides [uppInt IBOX(n), uppChar '*', uppStr (show rep), pp_str]
\end{code}
\end{code}
\begin{code}
+#if 0
#if ! OMIT_NATIVE_CODEGEN
hpRelToInt :: Target -> HeapOffset -> Int
vhs_size r = (varHeaderSize target r) :: Int
#endif
+#endif {-0-}
\end{code}