From 9c3c263178566288705e0ae9b88ccc27a5707896 Mon Sep 17 00:00:00 2001 From: sewardj Date: Fri, 27 Oct 2000 14:22:34 +0000 Subject: [PATCH] [project @ 2000-10-27 14:22:34 by sewardj] Final mods to make it compile with 4.08.1. You don't get an interpreter like that, tho. --- ghc/compiler/ghci/CmLink.lhs | 23 ++++++++++++++++++++--- ghc/compiler/ghci/CompManager.lhs | 6 ------ ghc/compiler/stgSyn/StgInterp.lhs | 11 ++++++++--- ghc/compiler/utils/Digraph.lhs | 10 +++++++++- ghc/compiler/utils/Util.lhs | 10 +++++----- 5 files changed, 42 insertions(+), 18 deletions(-) diff --git a/ghc/compiler/ghci/CmLink.lhs b/ghc/compiler/ghci/CmLink.lhs index 70a5f42..3ec42dd 100644 --- a/ghc/compiler/ghci/CmLink.lhs +++ b/ghc/compiler/ghci/CmLink.lhs @@ -13,14 +13,14 @@ module CmLink ( Linkable(..), Unlinked(..), where import StgInterp ( linkIModules, ClosureEnv, ItblEnv ) - +import Linker ( loadObj, resolveObjs ) import CmStaticInfo ( PackageConfigInfo ) import Module ( ModuleName, PackageName ) import InterpSyn ( UnlinkedIBind, HValue, binder ) import Module ( Module ) import Outputable ( SDoc ) import FiniteMap ( emptyFM ) -import Digraph ( SCC(..) ) +import Digraph ( SCC(..), flattenSCC ) import Outputable import Panic ( panic ) @@ -89,8 +89,23 @@ link :: PackageConfigInfo -> PersistentLinkerState -> IO LinkResult +#ifndef GHCI_NOTYET +--link = panic "CmLink.link: not implemented" +link pci groups pls1 + = do putStrLn "Hello from the Linker!" + putStrLn (showSDoc (vcat (map ppLinkableSCC groups))) + putStrLn "Bye-bye from the Linker!" + return (LinkOK pls1) + +ppLinkableSCC :: SCC Linkable -> SDoc +ppLinkableSCC = ppr . flattenSCC + +#else + + link pci [] pls = return (LinkOK pls) -link pci (group:groups) pls = do +link pci (groupSCC:groups) pls = do + let group = flattenSCC groupSCC -- the group is either all objects or all interpretable, for now if all isObject group then do mapM loadObj [ file | DotO file <- group ] @@ -106,6 +121,8 @@ link pci (group:groups) pls = do itbl_env=new_itbl_env}) else return (LinkErrs pls (ptext SLIT("linker: group must contain all objects or all interpreted modules"))) +#endif + modname_of_linkable (LM nm _) = nm modname_of_linkable (LP _) = panic "modname_of_linkable: package" diff --git a/ghc/compiler/ghci/CompManager.lhs b/ghc/compiler/ghci/CompManager.lhs index f3bedc6..d68a7a0 100644 --- a/ghc/compiler/ghci/CompManager.lhs +++ b/ghc/compiler/ghci/CompManager.lhs @@ -285,12 +285,6 @@ simple_transitive_closure graph set else simple_transitive_closure graph set2 -flattenSCCs :: [SCC a] -> [a] -flattenSCCs = concatMap flatten - -flatten (AcyclicSCC v) = [v] -flatten (CyclicSCC vs) = vs - -- For each module in mods_to_group, extract the relevant linkable -- out of UI, and arrange these linkables in SCCs as defined by modGraph. -- All this is so that we can pass SCCified Linkable groups to the diff --git a/ghc/compiler/stgSyn/StgInterp.lhs b/ghc/compiler/stgSyn/StgInterp.lhs index 8e98946..3f7ad4b 100644 --- a/ghc/compiler/stgSyn/StgInterp.lhs +++ b/ghc/compiler/stgSyn/StgInterp.lhs @@ -31,9 +31,14 @@ module StgInterp ( #if __GLASGOW_HASKELL__ <= 408 -import Panic ( panic ) -type ItblEnv = () -type ClosureEnv = () +import Panic ( panic ) +import RdrName ( RdrName ) +import PrelAddr ( Addr ) +import FiniteMap ( FiniteMap ) +import InterpSyn ( HValue ) + +type ItblEnv = FiniteMap RdrName Addr +type ClosureEnv = FiniteMap RdrName HValue linkIModules = panic "StgInterp.linkIModules: this hsc was not built with an interpreter" stgToInterpSyn = panic "StgInterp.linkIModules: this hsc was not built with an interpreter" diff --git a/ghc/compiler/utils/Digraph.lhs b/ghc/compiler/utils/Digraph.lhs index f09d465..df34dde 100644 --- a/ghc/compiler/utils/Digraph.lhs +++ b/ghc/compiler/utils/Digraph.lhs @@ -2,7 +2,7 @@ module Digraph( -- At present the only one with a "nice" external interface - stronglyConnComp, stronglyConnCompR, SCC(..), + stronglyConnComp, stronglyConnCompR, SCC(..), flattenSCC, flattenSCCs, Graph, Vertex, graphFromEdges, buildG, transposeG, reverseE, outdegree, indegree, @@ -56,6 +56,14 @@ import List data SCC vertex = AcyclicSCC vertex | CyclicSCC [vertex] +flattenSCCs :: [SCC a] -> [a] +flattenSCCs = concatMap flattenSCC + +flattenSCC (AcyclicSCC v) = [v] +flattenSCC (CyclicSCC vs) = vs +\end{code} + +\begin{code} stronglyConnComp :: Ord key => [(node, key, [key])] -- The graph; its ok for the diff --git a/ghc/compiler/utils/Util.lhs b/ghc/compiler/utils/Util.lhs index 54066f6..471089d 100644 --- a/ghc/compiler/utils/Util.lhs +++ b/ghc/compiler/utils/Util.lhs @@ -53,7 +53,7 @@ module Util ( #endif , global - , myProcessID + , myGetProcessID #if __GLASGOW_HASKELL__ <= 408 , catchJust @@ -724,10 +724,10 @@ throwTo = raiseInThread #endif #ifdef mingw32_TARGET_OS -foreign import "_getpid" myProcessID :: IO Int +foreign import "_getpid" myGetProcessID :: IO Int #else -myProcessID :: IO Int -myProcessID = do hPutStrLn stderr "Warning:myProcessID" - return 12345 +myGetProcessID :: IO Int +myGetProcessID = do hPutStrLn stderr "Warning:faking process ID in myGetProcessID" + return 12345 #endif \end{code} -- 1.7.10.4