[project @ 2001-02-27 17:14:44 by simonmar]
[ghc-hetmet.git] / ghc / compiler / ghci / ByteCodeLink.lhs
index 39e36fb..1619758 100644 (file)
@@ -37,7 +37,7 @@ import MArray         ( castSTUArray,
                          newIntArray, writeIntArray,
                          newAddrArray, writeAddrArray )
 import Foreign         ( Word16, Ptr(..) )
-import Addr            ( Word, Addr )
+import Addr            ( Word, Addr, nullAddr )
 
 import PrelBase                ( Int(..) )
 import PrelGHC         ( BCO#, newBCO#, unsafeCoerce#, 
@@ -110,11 +110,13 @@ instance Outputable UnlinkedBCO where
 type ClosureEnv = FiniteMap Name HValue
 data HValue     = HValue  -- dummy type, actually a pointer to some Real Code.
 
--- remove all entries for a given set of modules from the environment
+-- remove all entries for a given set of modules from the environment;
+-- note that this removes all local names too (ie. temporary bindings from
+-- the command line).
 filterNameMap :: [ModuleName] -> FiniteMap Name a -> FiniteMap Name a
 filterNameMap mods env 
-   = filterFM (\n _ -> moduleName (nameModule n) `notElem` mods) env
-
+   = filterFM (\n _ -> isGlobalName n && 
+                       moduleName (nameModule n) `elem` mods) env
 \end{code}
 
 %************************************************************************
@@ -298,6 +300,7 @@ mkBits findLabel st proto_insns
                                   CharRep   -> stg_ctoi_ret_R1n_info
                                   FloatRep  -> stg_ctoi_ret_F1_info
                                   DoubleRep -> stg_ctoi_ret_D1_info
+                                  VoidRep   -> stg_ctoi_ret_V_info
                                   _ -> pprPanic "mkBits.ctoi_itbl" (ppr pk)
 
        itoc_itbl st pk
@@ -308,11 +311,14 @@ mkBits findLabel st proto_insns
                                   IntRep    -> stg_gc_unbx_r1_info
                                   FloatRep  -> stg_gc_f1_info
                                   DoubleRep -> stg_gc_d1_info
+                                  VoidRep   -> nullAddr  
+                                  -- Interpreter.c spots this special case
                      
 foreign label "stg_ctoi_ret_R1p_info" stg_ctoi_ret_R1p_info :: Addr
 foreign label "stg_ctoi_ret_R1n_info" stg_ctoi_ret_R1n_info :: Addr
 foreign label "stg_ctoi_ret_F1_info"  stg_ctoi_ret_F1_info :: Addr
 foreign label "stg_ctoi_ret_D1_info"  stg_ctoi_ret_D1_info :: Addr
+foreign label "stg_ctoi_ret_V_info"   stg_ctoi_ret_V_info :: Addr
 
 foreign label "stg_gc_unbx_r1_info" stg_gc_unbx_r1_info :: Addr
 foreign label "stg_gc_f1_info"      stg_gc_f1_info :: Addr