diff options
| author | Sylvain Henry <sylvain@haskus.fr> | 2021-03-15 18:19:16 +0100 |
|---|---|---|
| committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-03-23 13:01:15 -0400 |
| commit | 05c5c0549bee022be84344cef46f0eded5564c3b (patch) | |
| tree | 1c50af925a1993c602b78c96155126b65c477af7 /compiler/GHC/Runtime/Debugger.hs | |
| parent | 7a6577513633b943202fc82ab7aa162e1d293c0a (diff) | |
| download | haskell-05c5c0549bee022be84344cef46f0eded5564c3b.tar.gz | |
Move loader state into Interp
The loader state was stored into HscEnv. As we need to have two
interpreters and one loader state per interpreter in #14335, it's
natural to make the loader state a field of the Interp type.
As a side effect, many functions now only require a Interp parameter
instead of HscEnv. Sadly we can't fully free GHC.Linker.Loader of HscEnv
yet because the loader is initialised lazily from the HscEnv the first
time it is used. This is left as future work.
HscEnv may not contain an Interp value (i.e. hsc_interp :: Maybe Interp).
So a side effect of the previous side effect is that callers of the
modified functions now have to provide an Interp. It is satisfying as it
pushes upstream the handling of the case where HscEnv doesn't contain an
Interpreter. It is better than raising a panic (less partial functions,
"parse, don't validate", etc.).
Diffstat (limited to 'compiler/GHC/Runtime/Debugger.hs')
| -rw-r--r-- | compiler/GHC/Runtime/Debugger.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/GHC/Runtime/Debugger.hs b/compiler/GHC/Runtime/Debugger.hs index 5051a97f52..387d52b6de 100644 --- a/compiler/GHC/Runtime/Debugger.hs +++ b/compiler/GHC/Runtime/Debugger.hs @@ -135,8 +135,8 @@ bindSuspensions t = do let ids = [ mkVanillaGlobal name ty | (name,ty) <- zip names tys] new_ic = extendInteractiveContextWithIds ictxt ids - dl = hsc_loader hsc_env - liftIO $ extendLoadedEnv dl (zip names fhvs) + interp = hscInterp hsc_env + liftIO $ extendLoadedEnv interp (zip names fhvs) setSession hsc_env {hsc_IC = new_ic } return t' where @@ -197,12 +197,12 @@ showTerm term = do let expr = "Prelude.return (Prelude.show " ++ showPpr dflags bname ++ ") :: Prelude.IO Prelude.String" - dl = hsc_loader hsc_env - txt_ <- withExtendedLoadedEnv dl + interp = hscInterp hsc_env + txt_ <- withExtendedLoadedEnv interp [(bname, fhv)] (GHC.compileExprRemote expr) let myprec = 10 -- application precedence. TODO Infix constructors - txt <- liftIO $ evalString hsc_env txt_ + txt <- liftIO $ evalString interp txt_ if not (null txt) then return $ Just $ cparen (prec >= myprec && needsParens txt) (text txt) |
