Generalise Package Support
[ghc-hetmet.git] / compiler / codeGen / CgExpr.lhs
index 33d72f1..e36b2ae 100644 (file)
@@ -152,8 +152,8 @@ cgExpr (StgOpApp (StgPrimOp TagToEnumOp) [arg] res_ty)
     do { (_,amode) <- getArgAmode arg
        ; amode' <- assignTemp amode    -- We're going to use it twice,
                                        -- so save in a temp if non-trivial
-       ; hmods <- getHomeModules
-       ; stmtC (CmmAssign nodeReg (tagToClosure hmods tycon amode'))
+       ; this_pkg <- getThisPackage
+       ; stmtC (CmmAssign nodeReg (tagToClosure this_pkg tycon amode'))
        ; performReturn (emitAlgReturnCode tycon amode') }
    where
          -- If you're reading this code in the attempt to figure
@@ -185,9 +185,9 @@ cgExpr x@(StgOpApp op@(StgPrimOp primop) args res_ty)
   | ReturnsAlg tycon <- result_info, isEnumerationTyCon tycon
        -- c.f. cgExpr (...TagToEnumOp...)
        = do tag_reg <- newTemp wordRep
-            hmods <- getHomeModules
+            this_pkg <- getThisPackage
             cgPrimOp [tag_reg] primop args emptyVarSet
-            stmtC (CmmAssign nodeReg (tagToClosure hmods tycon (CmmReg tag_reg)))
+            stmtC (CmmAssign nodeReg (tagToClosure this_pkg tycon (CmmReg tag_reg)))
             performReturn (emitAlgReturnCode tycon (CmmReg tag_reg))
   where
        result_info = getPrimOpResultInfo primop
@@ -282,8 +282,8 @@ cgRhs name (StgRhsCon maybe_cc con args)
        ; returnFC (name, idinfo) }
 
 cgRhs name (StgRhsClosure cc bi fvs upd_flag srt args body)
-  = do hmods <- getHomeModules
-       mkRhsClosure hmods name cc bi srt fvs upd_flag args body
+  = do this_pkg <- getThisPackage
+       mkRhsClosure this_pkg name cc bi srt fvs upd_flag args body
 \end{code}
 
 mkRhsClosure looks for two special forms of the right-hand side:
@@ -306,7 +306,7 @@ form:
 
 
 \begin{code}
-mkRhsClosure   hmods bndr cc bi srt
+mkRhsClosure   this_pkg bndr cc bi srt
                [the_fv]                -- Just one free var
                upd_flag                -- Updatable thunk
                []                      -- A thunk
@@ -328,7 +328,7 @@ mkRhsClosure        hmods bndr cc bi srt
   where
     lf_info              = mkSelectorLFInfo bndr offset_into_int
                                 (isUpdatable upd_flag)
-    (_, params_w_offsets) = layOutDynConstr hmods con (addIdReps params)
+    (_, params_w_offsets) = layOutDynConstr this_pkg con (addIdReps params)
                        -- Just want the layout
     maybe_offset         = assocMaybe params_w_offsets selectee
     Just the_offset      = maybe_offset
@@ -352,7 +352,7 @@ We only generate an Ap thunk if all the free variables are pointers,
 for semi-obvious reasons.
 
 \begin{code}
-mkRhsClosure   hmods bndr cc bi srt
+mkRhsClosure   this_pkg bndr cc bi srt
                fvs
                upd_flag
                []                      -- No args; a thunk
@@ -377,7 +377,7 @@ mkRhsClosure        hmods bndr cc bi srt
 The default case
 ~~~~~~~~~~~~~~~~
 \begin{code}
-mkRhsClosure hmods bndr cc bi srt fvs upd_flag args body
+mkRhsClosure this_pkg bndr cc bi srt fvs upd_flag args body
   = cgRhsClosure bndr cc bi srt fvs upd_flag args body
 \end{code}