X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fghci%2FByteCodeLink.lhs;h=fd6654579cad10a1c65666a5178ebe3eebe1ca72;hb=2423c249f5ca7785d0ec89eb33e72662da7561c1;hp=875f1d63314c9d4e645432db550931f5759929a8;hpb=0065d5ab628975892cea1ec7303f968c3338cbe1;p=ghc-hetmet.git diff --git a/compiler/ghci/ByteCodeLink.lhs b/compiler/ghci/ByteCodeLink.lhs index 875f1d6..fd66545 100644 --- a/compiler/ghci/ByteCodeLink.lhs +++ b/compiler/ghci/ByteCodeLink.lhs @@ -1,10 +1,9 @@ % -% (c) The University of Glasgow 2000 +% (c) The University of Glasgow 2000-2006 % -\section[ByteCodeLink]{Bytecode assembler and linker} +ByteCodeLink: Bytecode assembler and linker \begin{code} - {-# OPTIONS -optc-DNON_POSIX_SOURCE #-} module ByteCodeLink ( @@ -15,23 +14,26 @@ module ByteCodeLink ( #include "HsVersions.h" -import ByteCodeItbls ( ItblEnv, ItblPtr ) -import ByteCodeAsm ( UnlinkedBCO(..), BCOPtr(..), sizeSS, ssElts ) -import ObjLink ( lookupSymbol ) +import ByteCodeItbls +import ByteCodeAsm +import ObjLink -import Name ( Name, nameModule, nameOccName, isExternalName ) +import Name import NameEnv -import OccName ( occNameFS ) -import PrimOp ( PrimOp, primOpOcc ) -import Module ( moduleFS ) -import FastString ( FastString(..), unpackFS, zEncodeFS ) +import OccName +import PrimOp +import Module +import PackageConfig +import FastString +import Panic + +#ifdef DEBUG import Outputable -import Panic ( GhcException(..) ) +#endif -- Standard libraries import GHC.Word ( Word(..) ) -import Data.Array.IArray ( listArray ) import Data.Array.Base import GHC.Arr ( STArray(..) ) @@ -153,10 +155,8 @@ mkPtrsArray ie ce n_ptrs ptrs = do newtype IOArray i e = IOArray (STArray RealWorld i e) -instance HasBounds IOArray where - bounds (IOArray marr) = bounds marr - instance MArray IOArray e IO where + getBounds (IOArray marr) = stToIO $ getBounds marr newArray lu init = stToIO $ do marr <- newArray lu init; return (IOArray marr) newArray_ lu = stToIO $ do @@ -256,12 +256,21 @@ linkFail who what -- HACKS!!! ToDo: cleaner nameToCLabel :: Name -> String{-suffix-} -> String nameToCLabel n suffix - = unpackFS (zEncodeFS (moduleFS (nameModule n))) - ++ '_': unpackFS (zEncodeFS (occNameFS (nameOccName n))) ++ '_':suffix + = if pkgid /= mainPackageId + then package_part ++ '_': qual_name + else qual_name + where + pkgid = modulePackageId mod + mod = nameModule n + package_part = unpackFS (zEncodeFS (packageIdFS (modulePackageId mod))) + module_part = unpackFS (zEncodeFS (moduleNameFS (moduleName mod))) + occ_part = unpackFS (zEncodeFS (occNameFS (nameOccName n))) + qual_name = module_part ++ '_':occ_part ++ '_':suffix + primopToCLabel :: PrimOp -> String{-suffix-} -> String primopToCLabel primop suffix - = let str = "GHCziPrimopWrappers_" ++ unpackFS (zEncodeFS (occNameFS (primOpOcc primop))) ++ '_':suffix + = let str = "base_GHCziPrimopWrappers_" ++ unpackFS (zEncodeFS (occNameFS (primOpOcc primop))) ++ '_':suffix in --trace ("primopToCLabel: " ++ str) str \end{code}