Generalise Package Support
[ghc-hetmet.git] / compiler / codeGen / CgCon.lhs
index 0d8d731..115439a 100644 (file)
@@ -70,10 +70,10 @@ cgTopRhsCon :: Id           -- Name of thing bound to this RHS
            -> FCode (Id, CgIdInfo)
 cgTopRhsCon id con args
   = do { 
            -> FCode (Id, CgIdInfo)
 cgTopRhsCon id con args
   = do { 
-       ; hmods <- getHomeModules
+       ; this_pkg <- getThisPackage
 #if mingw32_TARGET_OS
         -- Windows DLLs have a problem with static cross-DLL refs.
 #if mingw32_TARGET_OS
         -- Windows DLLs have a problem with static cross-DLL refs.
-        ; ASSERT( not (isDllConApp hmods con args) ) return ()
+        ; ASSERT( not (isDllConApp this_pkg con args) ) return ()
 #endif
        ; ASSERT( args `lengthIs` dataConRepArity con ) return ()
 
 #endif
        ; ASSERT( args `lengthIs` dataConRepArity con ) return ()
 
@@ -83,9 +83,9 @@ cgTopRhsCon id con args
        ; let
            name          = idName id
            lf_info       = mkConLFInfo con
        ; let
            name          = idName id
            lf_info       = mkConLFInfo con
-           closure_label = mkClosureLabel hmods name
+           closure_label = mkClosureLabel this_pkg name
            caffy         = any stgArgHasCafRefs args
            caffy         = any stgArgHasCafRefs args
-           (closure_info, amodes_w_offsets) = layOutStaticConstr hmods con amodes
+           (closure_info, amodes_w_offsets) = layOutStaticConstr this_pkg con amodes
            closure_rep = mkStaticClosureFields
                             closure_info
                             dontCareCCS                -- Because it's static data
            closure_rep = mkStaticClosureFields
                             closure_info
                             dontCareCCS                -- Because it's static data
@@ -142,9 +142,9 @@ at all.
 
 \begin{code}
 buildDynCon binder cc con []
 
 \begin{code}
 buildDynCon binder cc con []
-  = do hmods <- getHomeModules
+  = do this_pkg <- getThisPackage
        returnFC (stableIdInfo binder
        returnFC (stableIdInfo binder
-                          (mkLblExpr (mkClosureLabel hmods (dataConName con)))
+                          (mkLblExpr (mkClosureLabel this_pkg (dataConName con)))
                           (mkConLFInfo con))
 \end{code}
 
                           (mkConLFInfo con))
 \end{code}
 
@@ -198,9 +198,9 @@ Now the general case.
 \begin{code}
 buildDynCon binder ccs con args
   = do { 
 \begin{code}
 buildDynCon binder ccs con args
   = do { 
-       ; hmods <- getHomeModules
+       ; this_pkg <- getThisPackage
        ; let
        ; let
-           (closure_info, amodes_w_offsets) = layOutDynConstr hmods con args
+           (closure_info, amodes_w_offsets) = layOutDynConstr this_pkg con args
 
        ; hp_off <- allocDynClosure closure_info use_cc blame_cc amodes_w_offsets
        ; returnFC (heapIdInfo binder hp_off lf_info) }
 
        ; hp_off <- allocDynClosure closure_info use_cc blame_cc amodes_w_offsets
        ; returnFC (heapIdInfo binder hp_off lf_info) }
@@ -230,10 +230,10 @@ found a $con$.
 \begin{code}
 bindConArgs :: DataCon -> [Id] -> Code
 bindConArgs con args
 \begin{code}
 bindConArgs :: DataCon -> [Id] -> Code
 bindConArgs con args
-  = do hmods <- getHomeModules
+  = do this_pkg <- getThisPackage
        let
          bind_arg (arg, offset) = bindNewToNode arg offset (mkLFArgument arg)
        let
          bind_arg (arg, offset) = bindNewToNode arg offset (mkLFArgument arg)
-         (_, args_w_offsets)    = layOutDynConstr hmods con (addIdReps args)
+         (_, args_w_offsets)    = layOutDynConstr this_pkg con (addIdReps args)
        --
        ASSERT(not (isUnboxedTupleCon con)) return ()
        mapCs bind_arg args_w_offsets
        --
        ASSERT(not (isUnboxedTupleCon con)) return ()
        mapCs bind_arg args_w_offsets
@@ -416,7 +416,7 @@ static closure, for a constructor.
 cgDataCon :: DataCon -> Code
 cgDataCon data_con
   = do {     -- Don't need any dynamic closure code for zero-arity constructors
 cgDataCon :: DataCon -> Code
 cgDataCon data_con
   = do {     -- Don't need any dynamic closure code for zero-arity constructors
-         hmods <- getHomeModules
+         this_pkg <- getThisPackage
 
        ; let
            -- To allow the debuggers, interpreters, etc to cope with
 
        ; let
            -- To allow the debuggers, interpreters, etc to cope with
@@ -424,10 +424,10 @@ cgDataCon data_con
            -- time), we take care that info-table contains the
            -- information we need.
            (static_cl_info, _) = 
            -- time), we take care that info-table contains the
            -- information we need.
            (static_cl_info, _) = 
-               layOutStaticConstr hmods data_con arg_reps
+               layOutStaticConstr this_pkg data_con arg_reps
 
            (dyn_cl_info, arg_things) = 
 
            (dyn_cl_info, arg_things) = 
-               layOutDynConstr    hmods data_con arg_reps
+               layOutDynConstr    this_pkg data_con arg_reps
 
            emit_info cl_info ticky_code
                = do { code_blks <- getCgStmts the_code
 
            emit_info cl_info ticky_code
                = do { code_blks <- getCgStmts the_code