diff options
author | Edward Z. Yang <ezyang@cs.stanford.edu> | 2015-10-10 12:01:14 -0700 |
---|---|---|
committer | Edward Z. Yang <ezyang@cs.stanford.edu> | 2016-10-08 00:20:34 -0700 |
commit | 00b530d5402aaa37e4085ecdcae0ae54454736c1 (patch) | |
tree | 2d2963db4abdbcba9c12aea13a26e29e718e4778 /ghc | |
parent | 887485a45ae55e81b26b6412b6f9dcf6a497f044 (diff) | |
download | haskell-00b530d5402aaa37e4085ecdcae0ae54454736c1.tar.gz |
The Backpack patch.
Summary:
This patch implements Backpack for GHC. It's a big patch but I've tried quite
hard to keep things, by-in-large, self-contained.
The user facing specification for Backpack can be found at:
https://github.com/ezyang/ghc-proposals/blob/backpack/proposals/0000-backpack.rst
A guide to the implementation can be found at:
https://github.com/ezyang/ghc-proposals/blob/backpack-impl/proposals/0000-backpack-impl.rst
Has a submodule update for Cabal, as well as a submodule update
for filepath to handle more strict checking of cabal-version.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: simonpj, austin, simonmar, bgamari, goldfire
Subscribers: thomie, mpickering
Differential Revision: https://phabricator.haskell.org/D1482
Diffstat (limited to 'ghc')
-rw-r--r-- | ghc/Main.hs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/ghc/Main.hs b/ghc/Main.hs index aa5f83fc64..9fda91979c 100644 --- a/ghc/Main.hs +++ b/ghc/Main.hs @@ -24,6 +24,7 @@ import LoadIface ( showIface ) import HscMain ( newHscEnv ) import DriverPipeline ( oneShot, compileFile ) import DriverMkDepend ( doMkDependHS ) +import DriverBkp ( doBackpack ) #ifdef GHCI import GHCi.UI ( interactiveUI, ghciWelcomeMsg, defaultGhciSettings ) #endif @@ -42,7 +43,7 @@ import Module ( ModuleName ) import Config import Constants import HscTypes -import Packages ( pprPackages, pprPackagesSimple, pprModuleMap ) +import Packages ( pprPackages, pprPackagesSimple ) import DriverPhases import BasicTypes ( failed ) import StaticFlags @@ -164,6 +165,7 @@ main' postLoadMode dflags0 args flagWarnings = do DoInteractive -> (CompManager, HscInterpreted, LinkInMemory) DoEval _ -> (CompManager, HscInterpreted, LinkInMemory) DoMake -> (CompManager, dflt_target, LinkBinary) + DoBackpack _ -> (CompManager, dflt_target, LinkBinary) DoMkDependHS -> (MkDepend, dflt_target, LinkBinary) DoAbiHash -> (OneShot, dflt_target, LinkBinary) _ -> (OneShot, dflt_target, LinkBinary) @@ -240,10 +242,6 @@ main' postLoadMode dflags0 args flagWarnings = do liftIO $ hPutStrLn stderr ("Hsc static flags: " ++ unwords staticFlags) - when (dopt Opt_D_dump_mod_map dflags6) . liftIO $ - printInfoForUser (dflags6 { pprCols = 200 }) - (pkgQual dflags6) (pprModuleMap dflags6) - liftIO $ initUniqSupply (initialUnique dflags6) (uniqueIncrement dflags6) ---------------- Final sanity checking ----------- liftIO $ checkOptions postLoadMode dflags6 srcs objs @@ -262,6 +260,7 @@ main' postLoadMode dflags0 args flagWarnings = do DoAbiHash -> abiHash (map fst srcs) ShowPackages -> liftIO $ showPackages dflags6 DoFrontend f -> doFrontend f srcs + DoBackpack b -> doBackpack b liftIO $ dumpFinalStats dflags6 @@ -463,6 +462,7 @@ data PostLoadMode | StopBefore Phase -- ghc -E | -C | -S -- StopBefore StopLn is the default | DoMake -- ghc --make + | DoBackpack String -- ghc --backpack foo.bkp | DoInteractive -- ghc --interactive | DoEval [String] -- ghc -e foo -e bar => DoEval ["bar", "foo"] | DoAbiHash -- ghc --abi-hash @@ -489,6 +489,9 @@ doEvalMode str = mkPostLoadMode (DoEval [str]) doFrontendMode :: String -> Mode doFrontendMode str = mkPostLoadMode (DoFrontend (mkModuleName str)) +doBackpackMode :: String -> Mode +doBackpackMode str = mkPostLoadMode (DoBackpack str) + mkPostLoadMode :: PostLoadMode -> Mode mkPostLoadMode = Right . Right @@ -618,6 +621,7 @@ mode_flags = , defFlag "C" (PassFlag (setMode (stopBeforeMode HCc))) , defFlag "S" (PassFlag (setMode (stopBeforeMode (As False)))) , defFlag "-make" (PassFlag (setMode doMakeMode)) + , defFlag "-backpack" (SepArg (\s -> setMode (doBackpackMode s) "-backpack")) , defFlag "-interactive" (PassFlag (setMode doInteractiveMode)) , defFlag "-abi-hash" (PassFlag (setMode doAbiHashMode)) , defFlag "e" (SepArg (\s -> setMode (doEvalMode s) "-e")) |