diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2017-02-01 23:39:52 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-02-02 00:18:58 -0500 |
commit | eedb3df0c1c28a7abc43705d614239c1c6199a1f (patch) | |
tree | 32045d426c9ecd4b07d74871d65d3e605842672d /compiler/main/GHC.hs | |
parent | b16239a95b730dd2d6fc0dbb18c8430669f2c187 (diff) | |
download | haskell-eedb3df0c1c28a7abc43705d614239c1c6199a1f.tar.gz |
Add support for StaticPointers in GHCi
Here we add support to GHCi for StaticPointers. This process begins by
adding remote GHCi messages for adding entries to the static pointer
table. We then collect binders needing SPT entries after linking and
send the interpreter a message adding entries with the appropriate
fingerprints.
Test Plan: `make test TEST=StaticPtr`
Reviewers: facundominguez, mboes, simonpj, simonmar, goldfire, austin,
hvr, erikd
Reviewed By: simonpj, simonmar
Subscribers: RyanGlScott, simonpj, thomie
Differential Revision: https://phabricator.haskell.org/D2504
GHC Trac Issues: #12356
Diffstat (limited to 'compiler/main/GHC.hs')
-rw-r--r-- | compiler/main/GHC.hs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs index 25c1484770..bc406d5c59 100644 --- a/compiler/main/GHC.hs +++ b/compiler/main/GHC.hs @@ -323,7 +323,7 @@ import Annotations import Module import Panic import Platform -import Bag ( unitBag ) +import Bag ( listToBag, unitBag ) import ErrUtils import MonadUtils import Util @@ -615,7 +615,8 @@ getProgramDynFlags = getSessionDynFlags setInteractiveDynFlags :: GhcMonad m => DynFlags -> m () setInteractiveDynFlags dflags = do dflags' <- checkNewDynFlags dflags - modifySession $ \h -> h{ hsc_IC = (hsc_IC h) { ic_dflags = dflags' }} + dflags'' <- checkNewInteractiveDynFlags dflags' + modifySession $ \h -> h{ hsc_IC = (hsc_IC h) { ic_dflags = dflags'' }} -- | Get the 'DynFlags' used to evaluate interactive expressions. getInteractiveDynFlags :: GhcMonad m => m DynFlags @@ -637,6 +638,18 @@ checkNewDynFlags dflags = do liftIO $ handleFlagWarnings dflags warnings return dflags' +checkNewInteractiveDynFlags :: MonadIO m => DynFlags -> m DynFlags +checkNewInteractiveDynFlags dflags0 = do + dflags1 <- + if xopt LangExt.StaticPointers dflags0 + then do liftIO $ printOrThrowWarnings dflags0 $ listToBag + [mkPlainWarnMsg dflags0 interactiveSrcSpan + $ text "StaticPointers is not supported in GHCi interactive expressions."] + return $ xopt_unset dflags0 LangExt.StaticPointers + else return dflags0 + return dflags1 + + -- %************************************************************************ -- %* * -- Setting, getting, and modifying the targets |