[project @ 2005-04-23 09:56:06 by panne]
[ghc-hetmet.git] / ghc / compiler / ghci / ByteCodeItbls.lhs
index 4473ccf..3598247 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 False {- TODO: WILD GUESS!!! -} rep_args
+
                  ptrs  = ptr_wds
                  nptrs = tot_wds - ptr_wds
                  nptrs_really
@@ -220,6 +223,7 @@ vecret_entry 5 = stg_interp_constr6_entry
 vecret_entry 6 = stg_interp_constr7_entry
 vecret_entry 7 = stg_interp_constr8_entry
 
+#ifndef __HADDOCK__
 -- entry point for direct returns for created constr itbls
 foreign label "stg_interp_constr_entry" stg_interp_constr_entry :: Ptr ()
 -- and the 8 vectored ones
@@ -231,7 +235,7 @@ foreign label "stg_interp_constr5_entry" stg_interp_constr5_entry :: Ptr ()
 foreign label "stg_interp_constr6_entry" stg_interp_constr6_entry :: Ptr ()
 foreign label "stg_interp_constr7_entry" stg_interp_constr7_entry :: Ptr ()
 foreign label "stg_interp_constr8_entry" stg_interp_constr8_entry :: Ptr ()
-
+#endif