[commit: ghc] master: Remote GHCi, -fexternal-interpreter (4905b83)
git at git.haskell.org
git at git.haskell.org
Thu Dec 17 09:39:54 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/4905b83a2d448c65ccced385343d4e8124548a3b/ghc
>---------------------------------------------------------------
commit 4905b83a2d448c65ccced385343d4e8124548a3b
Author: Simon Marlow <marlowsd at gmail.com>
Date: Wed Nov 18 16:42:24 2015 +0000
Remote GHCi, -fexternal-interpreter
Summary:
(Apologies for the size of this patch, I couldn't make a smaller one
that was validate-clean and also made sense independently)
(Some of this code is derived from GHCJS.)
This commit adds support for running interpreted code (for GHCi and
TemplateHaskell) in a separate process. The functionality is
experimental, so for now it is off by default and enabled by the flag
-fexternal-interpreter.
Reaosns we want this:
* compiling Template Haskell code with -prof does not require
building the code without -prof first
* when GHC itself is profiled, it can interpret unprofiled code, and
the same applies to dynamic linking. We would no longer need to
force -dynamic-too with TemplateHaskell, and we can load ordinary
objects into a dynamically-linked GHCi (and vice versa).
* An unprofiled GHCi can load and run profiled code, which means it
can use the stack-trace functionality provided by profiling without
taking the performance hit on the compiler that profiling would
entail.
Amongst other things; see
https://ghc.haskell.org/trac/ghc/wiki/RemoteGHCi for more details.
Notes on the implementation are in Note [Remote GHCi] in the new
module compiler/ghci/GHCi.hs. It probably needs more documenting,
feel free to suggest things I could elaborate on.
Things that are not currently implemented for -fexternal-interpreter:
* The GHCi debugger
* :set prog, :set args in GHCi
* `recover` in Template Haskell
* Redirecting stdin/stdout for the external process
These are all doable, I just wanted to get to a working validate-clean
patch first.
I also haven't done any benchmarking yet. I expect there to be slight hit
to link times for byte code and some penalty due to having to
serialize/deserialize TH syntax, but I don't expect it to be a serious
problem. There's also lots of low-hanging fruit in the byte code
generator/linker that we could exploit to speed things up.
Test Plan:
* validate
* I've run parts of the test suite with
EXTRA_HC_OPTS=-fexternal-interpreter, notably tests/ghci and tests/th.
There are a few failures due to the things not currently implemented
(see above).
Reviewers: simonpj, goldfire, ezyang, austin, alanz, hvr, niteria, bgamari, gibiansky, luite
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1562
>---------------------------------------------------------------
4905b83a2d448c65ccced385343d4e8124548a3b
.gitignore | 1 +
aclocal.m4 | 2 +-
compiler/basicTypes/BasicTypes.hs | 5 -
compiler/basicTypes/Literal.hs | 14 +-
compiler/coreSyn/MkCore.hs | 7 +-
compiler/deSugar/Coverage.hs | 4 +-
compiler/ghc.cabal.in | 7 +-
compiler/ghc.mk | 47 +-
compiler/ghci/ByteCodeAsm.hs | 93 +---
compiler/ghci/ByteCodeGen.hs | 175 ++++---
compiler/ghci/ByteCodeInstr.hs | 55 +--
compiler/ghci/ByteCodeItbls.hs | 437 ++---------------
compiler/ghci/ByteCodeLink.hs | 284 ++++-------
compiler/ghci/ByteCodeTypes.hs | 90 ++++
compiler/ghci/Debugger.hs | 8 +-
compiler/ghci/DebuggerUtils.hs | 2 +-
compiler/ghci/GHCi.hs | 499 +++++++++++++++++++
compiler/ghci/Linker.hs | 544 ++++++++++++---------
compiler/ghci/RtClosureInspect.hs | 14 +-
compiler/main/Annotations.hs | 14 +-
compiler/main/DriverPipeline.hs | 9 +-
compiler/main/DynFlags.hs | 77 +--
compiler/main/DynamicLoading.hs | 5 +-
compiler/main/GHC.hs | 51 +-
compiler/main/GhcMake.hs | 2 +-
compiler/main/GhcPlugins.hs | 4 +-
compiler/main/Hooks.hs | 33 +-
compiler/main/HscMain.hs | 55 ++-
compiler/main/HscTypes.hs | 29 +-
compiler/main/InteractiveEval.hs | 332 ++++---------
compiler/main/InteractiveEvalTypes.hs | 26 +-
compiler/main/SysTools.hs | 10 +-
compiler/specialise/SpecConstr.hs | 2 +-
compiler/typecheck/TcRnDriver.hs | 8 +-
compiler/typecheck/TcRnMonad.hs | 2 +
compiler/typecheck/TcRnTypes.hs | 2 +
compiler/typecheck/TcSplice.hs | 200 +++++++-
compiler/typecheck/TcSplice.hs-boot | 1 +
compiler/utils/Binary.hs | 10 +
compiler/utils/Outputable.hs | 4 +
compiler/utils/Panic.hs | 43 +-
ghc.mk | 12 +-
ghc/GhciMonad.hs | 127 +++--
ghc/InteractiveUI.hs | 65 ++-
ghc/Main.hs | 46 +-
ghc/ghc-bin.cabal.in | 3 +-
iserv/Main.hs | 94 ++++
iserv/Makefile | 15 +
iserv/ghc.mk | 67 +++
iserv/iserv-bin.cabal | 26 +
iserv/iservmain.c | 16 +
libraries/ghc-boot/GHC/LanguageExtensions.hs | 8 +-
.../utils => libraries/ghc-boot/GHC}/Serialized.hs | 30 +-
libraries/ghc-boot/ghc-boot.cabal | 1 +
libraries/ghci/GHCi/CreateBCO.hs | 147 ++++++
libraries/ghci/GHCi/FFI.hsc | 149 ++++++
libraries/ghci/GHCi/InfoTable.hsc | 348 +++++++++++++
libraries/ghci/GHCi/Message.hs | 386 +++++++++++++++
{compiler/ghci => libraries/ghci/GHCi}/ObjLink.hs | 88 ++--
libraries/ghci/GHCi/RemoteTypes.hs | 91 ++++
libraries/ghci/GHCi/ResolvedBCO.hs | 62 +++
libraries/ghci/GHCi/Run.hs | 308 ++++++++++++
libraries/ghci/GHCi/Signals.hs | 46 ++
libraries/ghci/GHCi/TH.hs | 175 +++++++
libraries/ghci/GHCi/TH/Binary.hs | 73 +++
libraries/ghci/GNUmakefile | 4 +
libraries/ghci/LICENSE | 31 ++
libraries/ghci/SizedSeq.hs | 37 ++
libraries/ghci/ghc.mk | 5 +
libraries/ghci/ghci.cabal | 41 ++
rts/Interpreter.c | 7 +-
rules/build-prog.mk | 18 +-
rules/shell-wrapper.mk | 2 +-
testsuite/config/ghc | 5 +-
testsuite/driver/testlib.py | 17 +-
testsuite/tests/annotations/should_run/annrun01.hs | 2 +-
testsuite/tests/cabal/cabal04/Makefile | 3 +-
testsuite/tests/cabal/cabal04/all.T | 0
testsuite/tests/ghc-api/T4891/T4891.hs | 19 +-
.../tests/ghci.debugger/scripts/break006.stderr | 4 +-
.../tests/ghci.debugger/scripts/break011.script | 3 +
.../tests/ghci.debugger/scripts/break011.stdout | 12 +
.../tests/ghci.debugger/scripts/break013.stdout | 2 +-
.../tests/ghci.debugger/scripts/break024.stdout | 4 +-
.../tests/ghci.debugger/scripts/print019.stderr | 2 +-
.../prog001/{prog001.stdout => prog001-ext.stdout} | 0
testsuite/tests/ghci/prog001/prog001.T | 4 +-
testsuite/tests/ghci/scripts/T10110A.hs | 1 +
testsuite/tests/ghci/scripts/all.T | 12 +-
.../tests/profiling/should_run/scc003.prof.sample | 48 +-
testsuite/tests/rts/LinkerUnload.hs | 4 +-
testsuite/tests/rts/T2615.hs | 2 +-
testsuite/tests/th/Makefile | 7 +
testsuite/tests/th/TH_Roles2.stderr | 5 +-
testsuite/tests/th/TH_finalizer.hs | 11 +
testsuite/tests/th/TH_finalizer.stderr | 2 +
testsuite/tests/th/TH_spliceE5_prof_ext.hs | 14 +
...spliceE5.stdout => TH_spliceE5_prof_ext.stdout} | 0
testsuite/tests/th/TH_spliceE5_prof_ext_Lib.hs | 8 +
testsuite/tests/th/all.T | 10 +
utils/ghctags/Main.hs | 6 +-
101 files changed, 4163 insertions(+), 1779 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 4905b83a2d448c65ccced385343d4e8124548a3b
More information about the ghc-commits
mailing list