[project @ 2004-11-10 01:56:00 by wolfgang]
[ghc-hetmet.git] / ghc / compiler / ghci / ByteCodeItbls.lhs
index 4473ccf..c44e562 100644 (file)
@@ -13,11 +13,11 @@ module ByteCodeItbls ( ItblEnv, ItblPtr, mkITbls ) where
 
 import Name            ( Name, getName )
 import NameEnv
-import Type            ( typePrimRep )
+import SMRep           ( typeCgRep )
 import DataCon         ( DataCon, dataConRepArgTys )
 import TyCon           ( TyCon, tyConFamilySize, isDataTyCon, tyConDataCons )
 import Constants       ( mIN_SIZE_NonUpdHeapObject )
-import ClosureInfo     ( mkVirtHeapOffsets )
+import CgHeapery       ( mkVirtHeapOffsets )
 import FastString      ( FastString(..) )
 import Util             ( lengthIs, listLengthCmp )
 
@@ -66,8 +66,9 @@ mkITbl tc
         dcs = tyConDataCons tc
         n   = tyConFamilySize tc
 
-cONSTR :: Int
-cONSTR = 1  -- as defined in ghc/includes/ClosureTypes.h
+#include "../includes/ClosureTypes.h"
+cONSTR :: Int  -- Defined in ClosureTypes.h
+cONSTR = CONSTR 
 
 -- Assumes constructors are numbered from zero, not one
 make_constr_itbls :: [DataCon] -> IO ItblEnv
@@ -86,8 +87,10 @@ make_constr_itbls cons
 
         mk_itbl :: DataCon -> Int -> Ptr () -> IO (Name,ItblPtr)
         mk_itbl dcon conNo entry_addr
-           = let (tot_wds, ptr_wds, _) 
-                    = mkVirtHeapOffsets typePrimRep (dataConRepArgTys dcon)
+           = let rep_args = [ (typeCgRep arg,arg) 
+                           | arg <- dataConRepArgTys dcon ]
+                (tot_wds, ptr_wds, _) = mkVirtHeapOffsets rep_args
+
                  ptrs  = ptr_wds
                  nptrs = tot_wds - ptr_wds
                  nptrs_really