diff options
author | Phuong Trinh <lolotp@fb.com> | 2019-03-05 15:48:46 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-03-07 14:01:42 -0500 |
commit | 7a68254a7284db5bf8f1fa82aba4a6825d8f050a (patch) | |
tree | f5c7e7a51f305514376f4ff09b63465b93621e96 /ghc | |
parent | 25c3dd39f7d446f66b5c967be81f80cd7facb509 (diff) | |
download | haskell-7a68254a7284db5bf8f1fa82aba4a6825d8f050a.tar.gz |
Fix #16392: revertCAFs in external interpreter when necessary
We revert CAFs when loading/adding modules in ghci (presumably to refresh
execution states and to allow for object code to be unloaded from the runtime).
However, with `-fexternal-interpreter` enabled, we are only doing it in the
ghci process instead of the external interpreter process where the cafs are
allocated and computed. This makes sure that revertCAFs is done in the
appropriate process no matter if that flag is present or not.
Diffstat (limited to 'ghc')
-rw-r--r-- | ghc/GHCi/UI/Monad.hs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/ghc/GHCi/UI/Monad.hs b/ghc/GHCi/UI/Monad.hs index 51f13663ea..fb887275d7 100644 --- a/ghc/GHCi/UI/Monad.hs +++ b/ghc/GHCi/UI/Monad.hs @@ -456,14 +456,13 @@ printStats dflags ActionStats{actionAllocs = mallocs, actionElapsedTime = secs} revertCAFs :: GhciMonad m => m () revertCAFs = do - liftIO rts_revertCAFs + hsc_env <- GHC.getSession + liftIO $ iservCmd hsc_env RtsRevertCAFs s <- getGHCiState when (not (ghc_e s)) turnOffBuffering -- Have to turn off buffering again, because we just -- reverted stdout, stderr & stdin to their defaults. -foreign import ccall "revertCAFs" rts_revertCAFs :: IO () - -- Make it "safe", just in case ----------------------------------------------------------------------------- -- To flush buffers for the *interpreted* computation we need |